/ Forums / Advansys Formativ / Creating Solutions with Formativ / Print contents of a portal

  • Creator
    Topic
  • #4134
    redz
    Participant

    Hi,

    The subject says it all: How can I print the contents of a portal? If possible, without any user intervention. (Print-dialogs etc.)

    Thanks in advance!

  • Author
    Replies
  • #7225
    Support 1a
    Participant

    This should be possible using the NativeInterface property of a portal. The nativeInterface property gives you the IWebBrowser2 interface for the portal, which in tern has an ExecWB() method. You can use this method to print the contents of the portal.

    Here’s an example:

    Sub Main(Client, GWEvent)
    
       dim iPortals
       dim iPortal1
       dim iret
    
       Set iPortals = GroupWise.PortalManager.Portals
       Set iPortal1 = iPortals.Item("PORTAL1")
    
       If iPortal1 is Nothing Then
         Set iPortal1 = iPortals.Add
         iPortal1.Caption = "Advansys Home"
         iPortal1.TabCaption = "Advansys"
         iPortal1.ID = "PORTAL1"
         iPortal1.NavigationControlsEnabled = True
         iPortal1.URLInputEnabled = True
         iPortal1.Url = "www.advansyscorp.com"
       else
         MsgBox "Found it - try to print it"
         const IDM_PRINT = 6
         call iPortal1.NativeInterface.ExecWB(IDM_PRINT, -1)
       End If
    
    End Sub

    This is somewhat incomplete, because the printer selection dialog still appears. I understand it should be possible to turn this off by using flags. See the Microsoft Documentation on the IWebBrowser2.ExecWB() method, and the IDM_PRINT command. More information is available at http://msdn.microsoft.com/workshop/browser/mshtml/reference/constants/idm_print.asp.

    I hope this helps.

    Advansys Support

    #7229
    zdelav
    Participant

    Hi,

    I have further question about printing content of portal. Is it possible edit or better completelly remove default information written on printed page in bottom-left corner (in Your case is URL address http://www.advancesys.com/) or (in my case) there is a text “about:blank” and bottom-right corner – date?

    Thanks in advance for information!
    kind regards,
    Zdenek

    #7226
    Support 3
    Participant

    You can use Portal.HTML property to get the HTML source for each Portal. Setting the HTML property will render the page within the Portal. See Formativ Language Guide (Portal object) for more information.

    If you use Portal.URL to set Portal contents then you can use example code below to extract Portal HTML, update contents and reset.

      
       Set oPortals = GroupWise.PortalManager.Portals
       Set oPortal1= oPortals.Item("PORTAL1")
    
      If not (oPortal1 is nothing) then
       iHtml = oPortal1.html
       iHtml = replace(iHtml, "about:blank", "NewText", vbTextCompare)
       oPortal1.html = iHtml
      end if
    
      set oPortals = nothing
      set oPortal1 = nothing
    

    Alternatively, if you use Portal.HTML to set page contents at the beginning then you should update it prior to set.

    Regards,
    Advansys Support

    #7228
    zdelav
    Participant

    I think You don’t understand what I meant. The text I want to change (or better remove) is not in origin html file, but on printed page of this file. I create example for You:

    http://www.oktet.cz/download/Example.jpg

    On the left You can see whole html file opened by Internet Explorer. On the right You can see this file printed by pdf creator software from Portal (it’s the same look when I print to real printer). As You can see, on the bottom (red marks), there is extra text, which is not in origin html file. I would like to remove this text, is it possible?

    #7227
    Support 3
    Participant

    Thanks for the clarification.

    Browsers usually set to add title, date, page number and URL to any page printed from the Internet. You will need to change browser print settings. Link below shows steps to change print settings (follow the Internet Explorer 6 & 7 instructions):

    http://www.mintprintables.com/print-tips/header-footer.php

    Hope this helps.

    Regards,
    Advansys Support

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.