Print this Page Java html snippet

I decided to try adding the above to one of my pages in iWeb.
I added the java code as shown on Old Toad's site:-
<form>input type="button" value=" Print this Page "
onclick="javascript:parent.window.print();return false;"/></form>
I placed this code in an html snippet in iWeb and applied it and it showed up as Print this Page in the site. I then published the site to a local folder and uploaded the changed pages to my external server. After uploading, I visited my site and tried clicking on the button and it did not work.
Anyone know why it did not work? The code is correct and I copied and pasted from OT's site directly into an html snippet.
Is the code site or page specific or generic, that it will work for any site?
Does it only work in MobileMe published sites and not for sites uploaded to an external server?
Any insights gratefully received.

Does the print button work when the site was on your HD locally? Here's some different code that you might try:
<SCRIPT LANGUAGE="JavaScript">
// This script was supplied free by Hypergurl // <a class="jive-link-external-small" href="http://www.hypergurl.com">http://www.hypergurl.com</a> <!--
hide script and begin if (window.print) { document.write('<form>Click Here
To ' + '<input type=button name=print value="Print" ' + 'onClick="javascript:window.print()">
This Page!</form>'); } // End hide --> </script>
The original code should work on any server as far as I know. Cyclosaurus is the authority on javascript and should have an answer.
This Google search has numerous examples of code:http://www.google.com/search?hl=en&safe=active&client=safari&rls=en-us&ei=MBCjSd X6LoK2sQOIj8zGCQ&sa=X&oi=spell&resnum=0&ct=result&cd=1&q=javascriptto+printpage&spell=1

Similar Messages

  • Is there a way to create a "Print This Page" link?

    I have a client who want to insert a print this page link that launches their print utility. Is this possible with Muse?

    This is not a function of Muse. You'll need to use the 'insert arbitrary HTML' function to add this.
    Here's where to get the javascript to insert.
    Beware that Muse only produces a generic stylesheet and does not define its specific media type. That means that printing a Muse-generated web page or rendering a Muse website on a mobile device can be extremely messy.  Elements may fall off of a page or may be sized oddly. The Muse showcase shows how the Horace and Lydia site falls apart in print. Elements appear broken and blank pages result.
    Muse developers need to employ semantic markup so that users can design stylesheets for different media types. This topic is related to the frequent requests that Muse should be able to design for mobile devices. Muse just isn't smart enough to do what a professional designer would want.

  • Tell a friend/print this page

    how can you add those links on your page?
    ...tell a friend...
    ...print this page...
    Thanks

    Hoi Bart,
    Have a look here, it's all Javascript post-publish stuff, you know the drill.
    http://www.hypergurl.com/printpage.html
    http://www.sitetoolcenter.com/website-tools-and-tutorials/tell-a-friend-javascri pt.php
    See you soon
    Leo

  • How do I add a "Print this page" button (not just a "Print" button) to a PDF?

    I am creating a multipage PDF in Acrobat Pro 8 for a client and it includes a linked table of contents with several sections and also several forms sprinkled throughout. I need to be able to add buttons that allow the user to print specific page numbers. Is it possible to add a "print this page" button to a page ... or even a "print this form" in case the form within the larger document is multiple pages? I would appreciate any help, thanks!

    I was just coming back to here to say I've figured it out and am using an invisible button (over text that was created to look like a link) on each page... tested and working (when combined with the code). Thank you for your replies!

  • Button to 'Print This Page Only to a printer of your choosing'

    I need to create a button to allow my user to print their current page to a printer of their choosing.
    Having them go to file print, etc etc is not an option as it will be used by hundreds of people, and the pdf is hundreds of pages long. (if they just select 'Print' that would be a lot of wasted paper)
    Ive been able to locate a Javascript that prints to the Default Printer, but my users change computers several times per day, and the default printer might located on the other side of town!
    Here is the script for 'Print this page to default printer' if anyone can assist by altering it to choose which printer, that would be amazing..
    Javascript:
    this.print(false, this.pageNum,this.pageNum);
    Even creating a button to open the print dialog box with 'Current Page' pre-selected would be ok.

    You need to use the PrintParams properties to get/set the print UI:
    var pp = this.getPrintParams();
    pp.firstPage = this.pageNum;
    pp.lastPage = pp.firstPage;
    pp.interactive = pp.constants.interactionLevel.full;
    this.print(pp);

  • How do I add a print this page link? Here is what I've done so far...

    I have tried this code:
    // Print current page silently
    print({bUI : false, nStart : pageNum, nEnd : pageNum});
    which works from the bookmark column. However, when I try to apply it (set link) within a document, it doesn't work.  My clients really want to be able to add a "print this page" link on every page (fun)... so your help is appreciated. Cheers.

    I was just coming back to here to say I've figured it out and am using an invisible button (over text that was created to look like a link) on each page... tested and working (when combined with the code). Thank you for your replies!

  • Print this page button

    Hi,
    I found this very handy liittle script for adding a print
    this page button to my pages. See below. I'd like to change the
    button though to a small image of a printer. Does anyone know how I
    can modify this script to achieve that.
    Thanks
    K
    <SCRIPT Language="Javascript">
    This script is written by Eric ([email protected])
    For full source code, installation instructions,
    100's more DHTML scripts, and Terms Of
    Use, visit dynamicdrive.com
    function printit(){
    if (window.print) {
    window.print() ;
    } else {
    var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0
    HEIGHT=0
    CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>';
    document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
    WebBrowser1.ExecWB(6, 2);//Use a 1 vs. a 2 for a prompting
    dialog box WebBrowser1.outerHTML = "";
    </script>
    <SCRIPT Language="Javascript">
    var NS = (navigator.appName == "Netscape");
    var VERSION = parseInt(navigator.appVersion);
    if (VERSION > 3) {
    document.write('<form><input type=button
    value="Print this Page" name="Print"
    onClick="printit()"></form>');
    </script>

    Looks a bit archaic to me.
    Just do this -
    <form>
    <input type="image" name="printMe"
    src="images/whatever.jpg"
    onclick="self.print();">
    </form>
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    ==================
    "KHam1234" <[email protected]> wrote in
    message
    news:gdpre8$mgq$[email protected]..
    > Hi,
    >
    > I found this very handy liittle script for adding a
    print this page button
    > to
    > my pages. See below. I'd like to change the button
    though to a small image
    > of a
    > printer. Does anyone know how I can modify this script
    to achieve that.
    >
    > Thanks
    >
    > K
    >
    > <SCRIPT Language="Javascript">
    >
    > /*
    > This script is written by Eric ([email protected])
    > For full source code, installation instructions,
    > 100's more DHTML scripts, and Terms Of
    > Use, visit dynamicdrive.com
    > */
    >
    > function printit(){
    > if (window.print) {
    > window.print() ;
    > } else {
    > var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0
    HEIGHT=0
    >
    CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>';
    > document.body.insertAdjacentHTML('beforeEnd',
    WebBrowser);
    > WebBrowser1.ExecWB(6, 2);//Use a 1 vs. a 2 for a
    prompting dialog box
    > WebBrowser1.outerHTML = "";
    > }
    > }
    > </script>
    >
    > <SCRIPT Language="Javascript">
    > var NS = (navigator.appName == "Netscape");
    > var VERSION = parseInt(navigator.appVersion);
    > if (VERSION > 3) {
    > document.write('<form><input type=button
    value="Print this Page"
    > name="Print" onClick="printit()"></form>');
    > }
    > </script>
    >

  • Thank you. Save or print this page for your records. We'll also send you an email confirmation. Case ID: 421912520 You have chosen to call Apple later. When you're ready, call the phone number below during business hours and refer to your Case ID for fas

    Thank you.
    Save or print this page for your records. We'll also send you an email confirmation.
    Case ID: 421912520
    You have chosen to call Apple later. When you're ready, call the phone number below during business hours and refer to your Case ID for faster support.
    1-800-MY-IPHONE
    6:00 a.m. to 11:00 p.m. Central
    iPhone
    Restore or update not working as expected
    You can review this case in the Cases &amp; Repairs section.
    Additional Resources
    Return to Apple Support home.
    Visit your Support Profile.
    Create another support request.
    Your contact information
    Onechai John
    <Email Edited by Host>

    They already have your number and/or email address and maybe have sold it several times already to others as well. They also use number generators - software that will automatically create them - some work and some don't, they don't care, they send out millions and a few will fall for it and send them money. The only way to "hide" would be to change both and your password, but then it would happen again at some point.

  • Print this page

    I am trying to add a PHP "print this page" script to my
    dreamweaver template, that I created myself and it does not want to
    work once uploaded. The template has one editable area for content.
    This is the script ( I found on the internet). I am not a developer
    but I suspect that the fact I am using a template is the problem.
    <?php
    /*PHPrint - Save this file as phprint.php
    Make any Page Printer Friendly!
    Copyright by MikeNew.Net, Notice must stay intact
    Legal: MikeNew.Net is not responsible for any damages caused
    by use of this script. (Not that it will, probably. Never
    has.)
    This script will make your pages printer friendly.
    Optionally, it will strip images as well. */
    //Do you want to strip images from the printable output?
    // If no, change to "no". Otherwise, images are stripped by
    default.
    $stripImages = "no";
    // That's it! No need to go below here. Upload it and test.
    $startingpoint = "<!-- startprint -->";
    $endingpoint = "<!-- stopprint -->";
    $read = fopen($HTTP_REFERER, "r");
    $value = "";
    while(!feof($read)){
    $value .= fread($read, 4096);
    fclose($read);
    $start= strpos($value, "$startingpoint");
    $finish= strpos($value, "$endingpoint");
    $length= $finish-$start;
    $value=substr($value, $start, $length);
    function i_denude($variable)
    return(eregi_replace("<img src=[^>]*>", "",
    $variable));
    function i_denudef($variable)
    return(eregi_replace("<font[^>]*>", "", $variable));
    $PHPrint = ("$value");
    if ($stripImages == "yes") {
    $PHPrint = i_denude("$PHPrint");
    $PHPrint = i_denudef("$PHPrint");
    $PHPrint = str_replace( "</font>", "", $PHPrint );
    echo $PHPrint;
    // Next line mandatory. Please don't remove. Nobody will see
    it except SE crawlers, anyway. Thanks! :)
    echo "<br><a href=\"
    http://www.mikenew.net/\"><img
    src=\"
    http://www.mikenew.net/images/php.gif\"
    echo "alt=\"printer friendly pages script, php\" width=\"20\"
    height=\"8\" border=\"0\"></a>";
    echo "<br/><br/>This page printed from:
    $HTTP_REFERER";
    flush ();
    ?>

    What are you expecting this script to do? What attracted you
    to it?
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    ==================
    "fatpad" <[email protected]> wrote in
    message
    news:[email protected]...
    >I am trying to add a PHP "print this page" script to my
    dreamweaver
    >template,
    > that I created myself and it does not want to work once
    uploaded. The
    > template
    > has one editable area for content. This is the script (
    I found on the
    > internet). I am not a developer but I suspect that the
    fact I am using a
    > template is the problem.
    >
    > <?php
    >
    > /*PHPrint - Save this file as phprint.php
    > Make any Page Printer Friendly!
    > Copyright by MikeNew.Net, Notice must stay intact
    > ************
    > Legal: MikeNew.Net is not responsible for any damages
    caused
    > by use of this script. (Not that it will, probably.
    Never has.)
    > This script will make your pages printer friendly.
    > Optionally, it will strip images as well. */
    >
    > //Do you want to strip images from the printable output?
    > // If no, change to "no". Otherwise, images are stripped
    by default.
    > $stripImages = "no";
    > // That's it! No need to go below here. Upload it and
    test.
    >
    > $startingpoint = "<!-- startprint -->";
    > $endingpoint = "<!-- stopprint -->";
    >
    > $read = fopen($HTTP_REFERER, "r");
    > $value = "";
    > while(!feof($read)){
    > $value .= fread($read, 4096);
    > }
    > fclose($read);
    > $start= strpos($value, "$startingpoint");
    > $finish= strpos($value, "$endingpoint");
    > $length= $finish-$start;
    > $value=substr($value, $start, $length);
    >
    > function i_denude($variable)
    > {
    > return(eregi_replace("<img src=[^>]*>", "",
    $variable));
    > }
    >
    > function i_denudef($variable)
    > {
    > return(eregi_replace("<font[^>]*>", "",
    $variable));
    > }
    >
    > $PHPrint = ("$value");
    >
    > if ($stripImages == "yes") {
    > $PHPrint = i_denude("$PHPrint");
    > }
    >
    > $PHPrint = i_denudef("$PHPrint");
    > $PHPrint = str_replace( "</font>", "", $PHPrint );
    >
    > echo $PHPrint;
    > // Next line mandatory. Please don't remove. Nobody will
    see it except SE
    > crawlers, anyway. Thanks! :)
    > echo "<br><a href=\"
    http://www.mikenew.net/\"><img
    > src=\"
    http://www.mikenew.net/images/php.gif\"
    > echo "alt=\"printer friendly pages script, php\"
    width=\"20\" height=\"8\"
    > border=\"0\"></a>";
    > echo "<br/><br/>This page printed from:
    $HTTP_REFERER";
    > flush ();
    > ?>
    >

  • IWeb 09 java html snippet crash

    Hi.
    I'm trying to add a java irc (pjirc) applet as an HTML snippet, and everytime I do, iweb 09 freezes with a swirling beach ball, and makes me force quit it.
    Any idea how to fix this? Has anyone else had luck with a java irc client in iWeb?
    Thanks!

    Launch the Console (in the Applications/Utilities folder) and see what messages are recorded when it crashes. I could be that that particular applet is not compatible with iWeb. Cyclosaurus would know if it was or not.
    OT

  • My HTML snippet widget on iWeb looks great on iWeb, but when I publish the page the HTML snippet doesn't appear on the webpage.  Why?

    I pasted in some HTML code generated by Google Forms into the iWeb HTML snippet widget.  It looked great on my iWeb viewer, but when I published it to my website, the HTML snippet google form did not appear on my webpage.  Does anyone know how to fix this?

    What is the code?

  • Creating 'print this page' button using AS3

    Hi all,
    I need to create a button, or at least a movie clip that
    functions like a button that will print a page when clicked.
    Ideally I would like to have the button as part of the flash
    application, which will be online embedded into a web page as a
    .swf. on click the print page dialog box will appear, and the user
    will be able to print out the web page. What is the best way to
    code this?

    sure. the swf's main timeline is a movieclip, so if you want
    to print everything that's on the swf stage, use the printjob()
    class to print the main timeline.

  • "print this page" firefox crashed. How can I get back to that page?

    Sending my ipod nano in for repair. Lost the page at the end that needed to be printed and brought to a ups store. Now I can't seem to get back to that.
    Can I just print out the status page or something? I didn't even get to see what information was really on it.

    I did it all online so I haven't contacted tech support yet, but it looks like I might have to for this simple little issue

  • Which number I have to call for double payment for ' document to go' see my bills.Save or print this page for your records. We'll also send you an email confirmation. Case ID: 341915446 You have chosen to call Apple later. When you're ready, call the phon

    Where I have to resolve my problem for double billing for an app I purchased. App under question is ' DOCS TO GO' both normal and premium version.
    Help me
    Thanks

    Where I have to resolve my problem for double billing for an app I purchased. App under question is ' DOCS TO GO' both normal and premium version.
    Help me
    Thanks

  • Printing multiple pages in Java...

    I have created a JEditorPane that needs to print multiple pages of html text. I have it printing out the first page but that's it. Also, text that is print out is cut off on the right hand side. Can anyone help me with this? My code is below. I left out the import statements for space.public class
    Browser_1 extends JFrame implements ActionListener//, HyperlinkListener
    public static void main(String[] args)
    new Browser_1("http://www.cnn.com/");
    protected JEditorPane htmlViewer;
    protected String initialURL;
    public Browser_1(String initialURL)
    setTitle("Browser_1");
    //this.initialURL = initialURL;
    //setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    JButton openButton = new JButton("Open");
    openButton.addActionListener(this);
    JButton printButton = new JButton("Print");
    printButton.addActionListener(this);
    JPanel buttonPanel = new JPanel();
    buttonPanel.add(openButton);
    buttonPanel.add(printButton);
    getContentPane().add(buttonPanel, BorderLayout.SOUTH);
    try
    htmlViewer = new JEditorPane(initialURL);
    htmlViewer.setEditable(false);
    htmlViewer.addHyperlinkListener(new _LinkListener());
    JScrollPane scrollPane = new JScrollPane(htmlViewer);
    getContentPane().add(scrollPane, BorderLayout.CENTER);
    catch (IOException ioe)
    warnUser("Can't build HTML pane for " + initialURL + ": " + ioe);
    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    int width = screenSize.width * 8 /10;
    int height = screenSize.height * 8/10;
    setBounds(width/8, height/8, width, height);
    setVisible(true);
    //openDocument(new File("./htdocs/index.html"));
    private void openDocument(File doc)
    try {
         htmlViewer.setPage(doc.toURL());
    catch(MalformedURLException e)
         e.printStackTrace();
    catch(IOException e)
         e.printStackTrace();
    public void actionPerformed(ActionEvent event)
    String command = event.getActionCommand();
    if(command.equals("Open"))
    JFileChooser chooser = new JFileChooser();
    chooser.setFileFilter(new _FileFilter());
    if(chooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION)
         openDocument(chooser.getSelectedFile());
    else if(command.equals("Print"))
    PrintUtilities.printComponent(htmlViewer);
    private void warnUser(String message)
    JOptionPane.showMessageDialog(this, message, "Error", JOptionPane.ERROR_MESSAGE);
    // Inner class implements the FileFilter interface for '.html' files
    class _FileFilter extends javax.swing.filechooser.FileFilter
    public boolean accept(File f)
    return(f != null && (f.isDirectory() || f.getName().endsWith(".html")));
    public String getDescription()
    return("HTML Documents (*.html)");
    // Inner class implements the HyperlinkListener interface
    class _LinkListener implements HyperlinkListener
    public void hyperlinkUpdate(HyperlinkEvent event)
    if(event.getEventType() != HyperlinkEvent.EventType.ACTIVATED)
    return;
    if(event instanceof HTMLFrameHyperlinkEvent)
    HTMLDocument doc = (HTMLDocument)htmlViewer.getDocument();
    doc.processHTMLFrameHyperlinkEvent((HTMLFrameHyperlinkEvent)event);
    else
    try {htmlViewer.setPage(event.getURL());}
    catch(IOException e) {e.printStackTrace();}
    class PrintUtilities implements Printable
    protected Component componentToBePrinted;
    public static void printComponent(Component c)
    new PrintUtilities(c).print();
    public PrintUtilities(Component componentToBePrinted)
    this.componentToBePrinted = componentToBePrinted;
    public void print()
    PrinterJob printJob = PrinterJob.getPrinterJob();
    printJob.setPrintable(this);
    if (printJob.printDialog())
    try
    {printJob.print();}
    catch(PrinterException pe)
    {System.out.println("Error printing: " + pe);}
    public int print(Graphics g, PageFormat pageFormat, int pageIndex)
    double height = pageFormat.getImageableHeight();
    double width = pageFormat.getImageableWidth();
    int totalNumPages = (int)Math.ceil(componentToBePrinted / height);
    if (pageIndex >= totalNumPages)
    { return(NO_SUCH_PAGE); }
    else
    Graphics2D g2d = (Graphics2D)g;
    g2d.translate(pageFormat.getImageableX(), pageFormat.getImageableY());
    disableDoubleBuffering(componentToBePrinted);
    componentToBePrinted.paint(g2d);
    enableDoubleBuffering(componentToBePrinted);
    return(PAGE_EXISTS);
    public static void disableDoubleBuffering(Component c)
    RepaintManager currentManager = RepaintManager.currentManager(c);
    currentManager.setDoubleBufferingEnabled(false);
    public static void enableDoubleBuffering(Component c)
    RepaintManager currentManager = RepaintManager.currentManager(c);
    currentManager.setDoubleBufferingEnabled(true);

    A recent article in JavaPro has a nice solution for this problem. Check out
    http://www.fawcette.com/javapro/2002_12/online/print_kgauthier_12_10_02/
    It describes a way of using Views to break down the pages.

Maybe you are looking for

  • Performance tuning in Smart form

    Hi, How to performance tuning in Smart form level Any tips available kindly send me any one . Thanks&Regards, Maya

  • How .xml and ~/Music/iTunes/iTunes Music work

    Have posted this before, just reposting in hopes of getting an answer... In 2.5 years we've had 3 hard drives, 2 logic boards, a power supply, multiple crashes, etc. During all this time of data recovery and frantic backing up, I managed to duplicate

  • Why setRolloverIcon cant function in JToolBar ** NEED HELP ** URGENT

    this is the sample coding * WHY when the user positions the mouse over button...the Images dint change import javax.swing.JToolBar; import javax.swing.JButton; import javax.swing.ImageIcon; import javax.swing.JFrame; import javax.swing.JTextArea; imp

  • Quick question re. 8 bit vrs. 16 bit print devices

    Do applications like Apple's Aperture print 16 bits to the Epson updated driver? Would the Epson 3800 be considered a "16 bit device". Need to make sure before I assert "a fact" elsewhere. I think it's correct in saying the LR does not yet print 16 b

  • Runtime Error When executing Method from JavaScript

    Greetings In the name of the creator of all things, space, and time. I have a problem with scripting an applet using Javascript (JScript). The problem is as follows: I receive the runtime error - An outgoing call cannot be made since the application