5 Replies Latest reply on Nov 27, 2008 4:48 AM by Pinkepunk

    Print Button on Drop-Down window


      our internal customer wants to be able to print topics from a drop-down window.

      This worked well with "RoboHelp for Word" and WinHelp output, but I fail to add the same functionality in a "Robohelp for HTML" (R 7) project with HTML Help (CHM) output. In fact the functionality seems to work (Topic is printed correctly), but in the window I immediately get a browser message that the content cannot be diplayed (topic disappears). The same is true for the "Copy" function (content is copied to windows clipboard but error message appears in the window). For the "Close" function the HTML help is minimized to the bottom tray. I added the following snippet

      <table x-use-null-cells style="background-color: #808080; width: 100%; height: 50px; border-style: 0;"
      height=50 width=100% bgcolor=#808080>
      <input type=submit name=button1 value=Print onClick="window.print();">
      <input type=submit name=button3 value=Copy onClick="javascript:CopiedTxt = ocument.body.createTextRange();CopiedTxt.execCommand('Copy')">
      <input type=submit name=button2 value=Close onClick="window.blur()">

      What's wrong? Unfortunately I'm not fluent in Javascript :-(

      Regards, Pinkepunk
        • 1. Re: Print Button on Drop-Down window
          Peter Grainge Adobe Community Professional (Moderator)
          Maybe a simpler solution would be a single button on the toolbar that will print whichever topic is displayed without requiring any code in that topic.

          See Snippet 24 on my site.

          • 2. Re: Print Button on Drop-Down window
            Pete Lees Level 2
            Hi, Pinkepunk,

            I can't reproduce the print issue in my test .chm file (no browser message), so I assume that there is something else in the help topic that causes the problem to arise. Perhaps you can post the complete contents of a topic?

            The error message that I see when using the Copy function is caused by the "ocument.body.createTextRange();" method, which should be changed to " d ocument.body.createTextRange();".

            If you want to quit the help window when the Close button is clicked, you need to use an HTML Help Close Window control. See the example below.

            • 3. Re: Print Button on Drop-Down window
              Pinkepunk Level 1
              Hi, Pete,

              Thanks for answering.

              > document.body.createTextRange();"
              The 'd' got lost when I formatted the post the forum.

              HHCTRL does not seem to be know object in my project.

              The problem is not connected with the topic content. I created a test project from scratch with just two topics and the snippet in it: Same problem. The error page has the following address (right click):

              res://C:\WINNT\system32\shdoclc.dll/dnserror.htm#mk:@MSITStore:C:\Apps\Test\Test%20Buttons \TestSnippets\!SSL!\Microsoft_HTML_Help\TestSnippets.chm::/DropDown.htm?button2=Schlie%DFe n

              It seems that the page name is confusing RoboHelp: Schlie%DFen refers to the German "Schließen" which includes a special character.

              Regards, Pinkepunk
              • 4. Re: Print Button on Drop-Down window
                Pete Lees Level 2
                Hi, again,

                Can you zip up and send me your test project so that I can take a closer look at it?

                Click my user name at the left to contact me.

                • 5. Re: Print Button on Drop-Down window
                  Pinkepunk Level 1
                  Hi Pete,

                  we finally found the error: the input type should be "button" instead of "submit". The correct code for our snippet with three buttons ("Print", "Copy", "Close") is now (see attached code below):

                  Cheers, Pinkepunk
                  ------------------------------------------------------------------------------------------ -------------------------