2 Replies Latest reply on Nov 7, 2013 6:03 AM by ryyno10

    Printing web browser (html, javascript)

    ryyno10

      I'm attempting to include a "print" hypertext link within a web browser ( I use html to display a departmental schedule) but I have been unsuccessful in setting up the correct page style (I need "Legal"). Also, I noticed (depending upon Filemakers zoom setting) that the webviewer content appears over-sized when the printing is in "preview".

       

      Has anyone used javascript (or another method) to ensure the print job is not "zoomed in" and the page style is set correctly? I'm not sure if someone has encountered a similiar scenario... Thanks in advance!!!

        • 1. Re: Printing web browser (html, javascript)
          mikebeargie

          I've dumped the webviewer content to a temporary HTML file somewhere, then opened that URL in a real web browser. That's the easiest way I've avoided limitations of the web viewer.

           

          I'm not sure FM ever meant for the web viewer to be a printable object, so I've never been surprised about how much it changes between different modes.

          2 of 2 people found this helpful
          • 2. Re: Printing web browser (html, javascript)
            ryyno10

            Hi Mike, thanks for your time.

             

            I ended up exporting the HTML page.  It wasn't too difficult to make it printer friendly, as long as the page is set left and the max width corresponds with the printing paper width (in my case I used "Legal" paper dimensons).  Also, I found a snippet of JavaScript that triggers printing setup as soon as the web browser loads (it also closes the browser automatically after printing) the page though I have not found a way to set the printer setup to "Legal" paper. 

             

            Here's the snippet I used in the calculation field:

             

            "<script type=\"text/javascript\">

                    function PrintWindow()

                    {                    

                       window.print();           

                       CheckWindowState();

                    }

                   

                    function CheckWindowState()

                    {           

                        if(document.readyState==\"complete\")

                        {

                            window.close(); 

                        }

                        else

                        {           

                            setTimeout(\"CheckWindowState()\", 2000)

                        }

                    }   

                   

                   PrintWindow();

            </script>"

             

             

            Anyway, thanks for offering some advice/insight.

            1 of 1 people found this helpful