26 Replies Latest reply on Jan 22, 2007 1:02 PM by kewal_tech

    Printing Button on WebHelp Skin

    kewal_tech
      Hi,

      I am generating webhelp.

      I was able to follow the instructions and create a custom button on the WebHelp Skin and to print the topic which is open. When I try to print it prints a page with the Toolbar of the skin but no contents..

      Code used

      if (top.frames[1].frames[1].frames[1] != null)
      {
      top.frames[1].frames[1].frames[1].focus(); window.print();
      }
      else
      {
      top.frames[1].frames[1].focus(); window.print();
      }

      Please help
        • 1. Re: Printing Button on WebHelp Skin
          Captiv8r Adobe Community Professional & MVP
          Hi Kewal

          Where did you get your script? Your description seems to imply that you are simply printing the frame the button is in. Also, what browser and version?

          Cheers... Rick
          • 2. Re: Printing Button on WebHelp Skin
            kewal_tech Level 1
            Hi Rick,

            To be honest I dont remeber it where I got the script but until i recall it was from one of the forums which directed me to Peter's or one the great authors like you
            :)


            • 3. Re: Printing Button on WebHelp Skin
              Captiv8r Adobe Community Professional & MVP
              Hi again

              Have you tried the script in my Skinny on Skins file?

              javascript:parent.frames[1].bsscright.focus();window.print();

              Maybe that will help? Rick
              • 4. Re: Printing Button on WebHelp Skin
                kewal_tech Level 1
                Hi Rick,

                hmmm..this didnt work..
                I replaced my code with code above code..

                :|
                • 5. Re: Printing Button on WebHelp Skin
                  kewal_tech Level 1
                  And forgot..
                  using IE 7.0.5450.4
                  • 6. Re: Printing Button on WebHelp Skin
                    Captiv8r Adobe Community Professional & MVP
                    Hmmm, could be that IE7 is the culprit here. Have you tried this using an earlier version of IE?
                    • 7. Re: Printing Button on WebHelp Skin
                      kewal_tech Level 1
                      Not yet will do it soon..

                      But even if it works in <IE7 is not good, as my help can be used by any version of IE's or other browsers.

                      Is there another way to slove this?
                      • 8. Re: Printing Button on WebHelp Skin
                        Captiv8r Adobe Community Professional & MVP
                        Hi again

                        If my hunch is correct and it is an IE 7 specific issue, I'm guessing the scripts will need revising.

                        Cheers... Rick
                        • 9. Re: Printing Button on WebHelp Skin
                          kewal_tech Level 1
                          hmmm...

                          well some more troubleshooting...

                          Using the code I was able to print the default page that opens up, i.e. Home page. But when I open any other page it will just print the toolbar..

                          • 10. Re: Printing Button on WebHelp Skin
                            kewal_tech Level 1
                            ahh..got it..the problem was with IE7 tab function..

                            using any of the below script would only print the frame..the script does not work for tabbed windows..

                            javascript:parent.frames[1].bsscright.focus();window.print();

                            OR

                            if (top.frames[1].frames[1].frames[1] != null)
                            {
                            top.frames[1].frames[1].frames[1].focus(); window.print();
                            }
                            else
                            {
                            top.frames[1].frames[1].focus(); window.print();
                            }

                            So yes Rick, the script needs some revision..

                            Any help on that?
                            • 11. Re: Printing Button on WebHelp Skin
                              kewal_tech Level 1
                              hmm..still not able to figure this out..
                              any help?
                              • 12. Re: Printing Button on WebHelp Skin
                                brj311
                                here's the script i use. I just added it to the template used on each page (in the footer).

                                I can't remember where i found it (either Rick or Peter's site).




                                <!--
                                // please keep these lines on when you copy the source
                                // made by: Nicolas - http://www.javascript-page.com

                                var message = "Print This Page";

                                function printpage() {
                                window.print();
                                }

                                document.write("<form><input type=button "
                                +"value=\""+message+"\" onClick=\"printpage()\"></form>");

                                //-->
                                • 13. Re: Printing Button on WebHelp Skin
                                  kewal_tech Level 1
                                  Hi Brj311,

                                  Thx for the script, I agree it will work.
                                  But this is not something that I can use in the webhelp skin custom button.

                                  Not sure if javascript has got some tag known as "tab.print" as window.print in IE7 should not work due to the tab feature..

                                  Not sure if am right or not..

                                  • 14. Re: Printing Button on WebHelp Skin
                                    Roger N Level 2
                                    Kewel -

                                    Paste this script into your target page; it will outline what frames/tabs are involved. You can build your print() based on the structure it displays, but you will need to accomodate both versions of IE, so be sure to include a test in your print function to determine which frames exist (similar to your IF statement in your first post).
                                    • 15. Re: Printing Button on WebHelp Skin
                                      kewal_tech Level 1
                                      Hi Roger,

                                      Thx for the script, much appreciate.

                                      I did the below:
                                      1. I used the script in the template that my topics are using, so I pasted the script in my template. For the print button I used both scripts from Rick and the script I had - None of this worked, no print command would execute.

                                      2. So I used your script in one topic only, what I noticed in my output for that topic it displayed the below, the print button on the screen worked but it prints only toolbar like before.
                                      file:///C:/abcd%20and%20abcd/abcd/Desktop/Output/New%20Folder%20(2)/NewProject.htm
                                      contains:
                                      The frame named , frames[0] (Title: "WebHelp Navigation Toolbar", file:///C:/abcd%20and%20abcd/abcd/Desktop/Output/New%20 2)/whskin_tbars.htm)
                                      The frame named , frames[1] (Title: "", file:///C:/abcd%20and%20abcd/abcd/Desktop/Output/New%20%20(2)/whskin_frmset01.htm), which contains
                                      The frame named , frames[0] (Title: "", file:///C:/abcd%20and%20abcd/abcd/Desktop/Output/New%20%20(2)/whskin_frmset010.htm), which contains
                                      The frame named , frames[0] (Title: "WebHelp Navigation Mini-bar", file:///C:/abcd%20and%20abcd/abcd/Desktop/Output/New%20%20(2)/whskin_mbars.htm)
                                      The frame named , frames[1] (Title: "Navigation Pane", file:///C:/abcd%20and%20abcd/abcd/Desktop/Output/New%20%20(2)/whskin_pdhtml.htm), which contains
                                      The frame named , frames[0] (Title: "Table of contents", file:///C:/abcd%20and%20abcd/abcd/Desktop/Output/New%20%20(2)/whtdhtml.htm)
                                      The frame named bsscright, frames[1] (Title: "advance search", file:///C:/abcd%20and%20abcd/abcd/Desktop/Output/New%20%20(2)/advance_search.htm)

                                      I guess am doing something wrong, not sure what. Doing some more thinking and troubleshooting lets see what happens.

                                      Thx again
                                      • 16. Re: Printing Button on WebHelp Skin
                                        Roger N Level 2
                                        Kewel -

                                        That script shouldn't really be in your template, as it doesn't help to print anything, it just reflects the hierarchy of frames in the current topic. You would use the information it provides to create your path in your print statement. Delete it from the page once you have figured it out.

                                        I'll give it a look when I access a project later today.

                                        • 17. Re: Printing Button on WebHelp Skin
                                          kewal_tech Level 1
                                          Hi Roger ,

                                          I have removed the script from the template, but am wondering if am suppose to use this script on my target page?do you mean all topics of the help?this would be lots of copy/pasting I dont mind but would be lot of work if any changes to the script is required at a later stage..may be in a later version of RH..or something like that..

                                          hmm..testing the script in a demo project's topics..

                                          thx
                                          • 18. Re: Printing Button on WebHelp Skin
                                            Roger N Level 2
                                            Kewel -

                                            The script is just an investigative tool. Use it to determine exactly what your path is to that bsscright frame. Once you post it into a topic, you can read the name(s) of the frames in your project, and create the appropriate path for the print() command. You will want to remove the script entirely once you have figured out what the frame hierarch is. something like "frame[0].frame[0].bsscright.focus(); print(); or something like that....
                                            • 19. Re: Printing Button on WebHelp Skin
                                              Roger N Level 2
                                              kewel -

                                              It seems that IE tabs don't affect the frame references.

                                              The script you were using instructed the browser to, if the toolbar frame exists, print it; otherwise, print the contents frame. Well, you always have the toolbar frame if you see the print button, so it makes no sense.

                                              All you really need is the second print statement in your Inline Javascript:

                                              function PrintIt()
                                              {
                                              top.frames[1].frames[1].focus(); window.print();
                                              }

                                              ...and be sure to add PrintIt() to your onclick event.
                                              • 20. Re: Printing Button on WebHelp Skin
                                                marilyng1950
                                                I have a similar problem... I'm trying to add (mouse over) alt text to a custom print button in the nav bar of a skin (for 508 compliance). The code I used is:

                                                onclick: PrintTopic()

                                                and the inline javascript is

                                                function PrintTopic()
                                                {
                                                parent.frames[1].frames[1].focus();
                                                parent.frames[1].frames[1].print();
                                                }

                                                Maybe this code will work for you. But what do I do about the alt text?
                                                I am not a developer, but I think I need to add an OnLoad action. Can you help me? Thanks!
                                                Product version: x5
                                                OS: Windows XP Pro
                                                Browser: Microsoft IE 6.0.29
                                                • 21. Re: Printing Button on WebHelp Skin
                                                  kewal_tech Level 1
                                                  quote:

                                                  Originally posted by: Roger N
                                                  kewel -

                                                  It seems that IE tabs don't affect the frame references.

                                                  The script you were using instructed the browser to, if the toolbar frame exists, print it; otherwise, print the contents frame. Well, you always have the toolbar frame if you see the print button, so it makes no sense.

                                                  All you really need is the second print statement in your Inline Javascript:

                                                  function PrintIt()
                                                  {
                                                  top.frames[1].frames[1].focus(); window.print();
                                                  }

                                                  ...and be sure to add PrintIt() to your onclick event.




                                                  hmm..well i tired this script but still the same problem.
                                                  • 22. Re: Printing Button on WebHelp Skin
                                                    Roger N Level 2
                                                    so, your project still prints the toolbar? strange. It's not the script then. You have other issues, but it can't be identified from the information you've provided so far.

                                                    Your frame hierarchy seems normal, but it's hard to tell from your earlier post, as the indenting has been lost while pasting.

                                                    Can you post a sample of the project, or email it?
                                                    • 23. Re: Printing Button on WebHelp Skin
                                                      marilyng1950 Level 1
                                                      One of the developers where I work gave me this script, which displays alt text for custom buttons:

                                                      In the onload use this

                                                      createAlt();

                                                      and in the inline javascript try this

                                                      function createAlt()
                                                      {
                                                      imgObj=document.getElementById('btncustom13639');
                                                      imgObj.innerHTML="<img src=\"bt_print_up.gif\" alt=\"Print\" border=\"0\">";
                                                      }
                                                      You may have to change the ID for btncustom.
                                                      • 24. Re: Printing Button on WebHelp Skin
                                                        kewal_tech Level 1
                                                        Hi

                                                        emailed Roger

                                                        Thx
                                                        Kewal
                                                        • 25. Re: Printing Button on WebHelp Skin
                                                          kewal_tech Level 1
                                                          Hi All,

                                                          Thx for your help Roger, this is now working all fine.
                                                          The problem was with my IE not sure why or how!!
                                                          I tested it on developers computer IE and it worked just fine.

                                                          Guess I should have done this ages back, sorry my bad!

                                                          Thx heaps to Roger and others
                                                          • 26. Printing Button on WebHelp Skin
                                                            kewal_tech Level 1
                                                            Hi All,

                                                            Thx for your help Roger, this is now working all fine.
                                                            The problem was with my IE not sure why or how!!
                                                            I tested it on developers computer IE and it worked just fine.

                                                            Guess I should have done this ages back, sorry my bad!

                                                            Thx heaps to Roger and others

                                                            This question was answered by Roger N, on Monday, January 22, 2007 12:59 PM

                                                            Answer
                                                            kewel -

                                                            It seems that IE tabs don't affect the frame references.

                                                            The script you were using instructed the browser to, if the toolbar frame exists, print it; otherwise, print the contents frame. Well, you always have the toolbar frame if you see the print button, so it makes no sense.

                                                            All you really need is the second print statement in your Inline Javascript:

                                                            function PrintIt()
                                                            {
                                                            top.frames[1].frames[1].focus(); window.print();
                                                            }

                                                            ...and be sure to add PrintIt() to your onclick event.