Javascript Print Dialog

I'm new to applescript and I am trying to automate printing a page using the "Print Page" button provided on the page. I have found the javascript that invokes the print dialog but when I try to use something like keystroke return to go through the page setup and then the print screen it doesn't seem to work. The script seems to wait until the JavaScript opened page setups and print dialogs are closed.
Anyone had any luck?
Here's my code:
tell application "Safari" to activate
repeat 1 times
tell application "Safari"
do JavaScript "Sl.NR();return false;" in document 1
end tell
delay 1
tell application "System Events"
keystroke return
delay 1
keystroke return
end tell
delay 5
tell application "Safari"
do JavaScript "_3.Mz.Nb();return false;" in document 1
end tell
end repeat
Also I can't seem to select the safari window after this - do I need to free safari from applescripts control?

This is a question for the application forum for Acrobat since it has to do its JavaScript implementation - try there.

Similar Messages

  • Open Print Dialog using JavaScript

    Hi folks, I'm trying to open dynamically the print dialog window for printing the PDF (Ctrl + P) in WebDynpro ABAP using JavaScript.
    The JavaScript seems to be executed only for Interactive Forms, however I don't need to use interactive but only Print-Based Forms.
    This line of code works if I assign it to an event like click for a button, I tried to call it in the doc:ready event but it does not work
    xfa.host.print(1, "0", "0", 0, 1, 0, 0, 0);
    Please I need some help and I hope it's possible!
    Alex

    Thanks, we are getting close!
    This line of code works, but it does not prompt me with the print dialog box (because of the first parameter is 0)
    xfa.host.print(0,"0","0", 0, 1, 0, 0, 1);
    I got this message box "This document is trying to print. Do you want to allow this?" Yes/No....
    Ok, that works but I would like to have the standard print dialog window instead, where you could select your printers.
    This line of code prompt me to save the XDP, this is not what I want
    xfa.host.exportData("",1);
    In which event should I place the script??
    Also, script only seems to be executed for interactive forms, I don't want to generate interactive forms, they are more heavy to render, this is only for print based forms!
    thanks
    Alexandre Giguere

  • How to suppress print dialog box from popping up under a condition

    Greetings...
    There may be a better way to accomplish what I'm trying to do, so I'm open to outside-the-box suggestions.
    I have a pretty simple page which lists a set of statuses and descriptions of each. The user can edit these status flags and their descriptions on the page as well. When I view the page in "printer friendly" mode, I see a nice simple report of what the statuses are and their descriptions. Everything works great so far.
    In our work request system built in ApEx, there's a page where someone can view the details of a work request, including the current status. When someone clicks on the help of that item, what I'd love to do is simple show the "printer friendly" version the status page mentioned above in a pop up window. My problem is that the print dialog box automatically shows up when a page is displayed in "printer friendly" mode and I do not want this to happen in this case.
    I see the javascript code in the Printer Friendly page template which causes the print dialog box to show up automatically, but I don't want to remove it in the template just for this one case. This would suppress the print dialog box on all "printer friendly" page views and the users are used to it showing up when they ask to print the page.
    I guess I could create a custom request to pass to the master status page which would pretty much do everything that the "printer friendly" mode is doing, but that seems like a lot of work when I'm so close to using something that is built in.
    Am I not seeing some simple other way of doing it or perhaps asking too much? Any suggestions?
    Shane.

    Hi,
    I think you have to call the FM GET_PRINT_PARAMETERS and pass NO_DIALOG = 'X'.
    Something like:
      CALL FUNCTION 'GET_PRINT_PARAMETERS'
        EXPORTING
          no_dialog      = 'X'
        IMPORTING
          out_parameters = ls_params
          valid          = lv_valid
        EXCEPTIONS
          OTHERS         = 1.
      NEW-PAGE PRINT ON PARAMETERS ls_params NO DIALOG.
    * Display Table
      lr_table->display( ).
    add: Spool numbers can be found in TSP01 or in system field SY-SPONO available in the submitting program...
    Hope it helps,
    Kr,
    m.
    Edited by: Manu D'Haeyer on Sep 28, 2011 10:02 AM

  • How do I force the print dialog to default to Print All?

    Hi all,
    I've searched the forums for this and found several similar requests but no answers so I am posting this as a fresh post.
    I have a requirement to have the print dialog appear when printing from javascript and have it always default to Print All.  From my research, it appears that there are only two API methods to do this:
    1) Print()
    2) PrintWithDialog()
    Neither take paramters.  Both have the same description in the documentation (which seems odd in of itself).
    From our research, PrintWithDialog() appears immediately when called (even if the PDF is not yet fully loaded) but always defaults to, "Print 1 of x" unless the PDF is only 1 page.  In that case, it defaults to Print All.
    The Print() method defaults to Print All.  However, if you call it before the PDF is fully loaded, it does not show.  I have searched these forums and found many other people running into this issue.  One thread suggested to put in a timer to make sure the PDF is loaded and then call print.  This works for small PDFs but our customers could be printing thousands of pages so there is no way to know how long to make the delay.
    I tried paying for Support to answer this question and was told there were NO PAID OPTIONS for getting support on the Acrobat SDK and to come post the question here.  The Support Engineer I spoke with assured me developers read and respond to these forums.
    This is a critical issue for an important customer so any feedback is much appreciated.
    An Adobe employee (Irosenth) mentioned something about a bug being reopened in this thread (http://forums.adobe.com/message/2601148#2601148) but no bug number was ever given.  If it truly is a bug, please provide the number, description and ETA for fix.
    If there is no solution, can I get a response from Adobe that supports my research as posted above?  In other words, confirm that both the API are working as expected?
    Finally, given that it seems many people want this functionality, how do I submit an enhancement request?
    Best Regards,
    Brian

    I downloaded Reader X and the problem is still occurrring, as was reported by the originator of this thread back in November.
    Are there any parameters that need to be set for this to work?  My customer is getting very impatient with this.
    Also, since downloading Reader X the toolbar does not appear by default. It pops up when you hover over the top of the window.   How do I get the toolbar to appear by default?  (this is not nearly as important as defaulting the print dialog to Print All on mulitple page docs when using printwithdialog).

  • Adobe Reader 9.4.6: how to skip print dialog

    Hello,
    in our company we implement a freestanding self-services kiosk project.
    The kiosk uses a browser, which links with internal application server, which contains the required information.
    There's also an option to print some documents via Adobe ActiveX PlugIn. Explored some versions of Adobe Reader, we considered that the most appropriate is version 9.4.6. We strongly needed to set Adobe Reader so that the only clickable button in upper toolbar is “Print” button, and also side navigation panel is hidden (because pdf file opens in the frame within the kiosk system page). We've succeeded with this issue.
    But now we experience one more problem. When the user clicks the "Print" button, the print dialog appears. Is it possible to choose default printing settings and start printing avoiding print dialog by some standard options?
    Or maybe you can provide us an event, which initiates Adobe print dialog, so that we can use it to fire the OK within java script.
    Best regards
      Anton.

    Looks like you need a silent print, take a look at:
    http://blogs.adobe.com/acdc/2011/03/silent-print-in-acrobat-using-javascript.html
    The steps are for Acrobat. You'll need to see if they work with Reader.

  • Print dialog slow to bring up and work with in Adobe Reader XI

    Hi,
    Since I upgraded Adobe Reader from version 9 to version 11, everyone is complaining about an extreme slow response from the print dialog box to bring up, but to work with it (mostly change printer and browse advanced properties) as well. It may takes at least 6 to 14 seconds to respond some times...
    I did not uninstall the previous version before installing the new one. Once I noticed the problem, I used the Adobe Cleaner Tool, and also manually removed the registry key HKEY_LOCAL_MACHINE\SOFTWARE\Adobe\Acrobat Reader and the Adobe Reader folders in Program Files. I restarted the server, then I installed version XI one more time, and restarted again. Unfortunatly, still experiencing same problem...
    Adobe Reader is installed on Windows 2003 R2 Terminal servers, on which every users are logging using RDP or ICA protocol. The printers are connected on their profiles from a print server via GPO.
    Any suggestions ?
    Thanks in advance.
    Eric

    I believe this is covered in the Acrobat JS API Referecne saveAs entry. Follow the link for safe path.
    Safe path
    Acrobat 6.0 introduced the concept of a safe path for JavaScript methods that write data to the local hard drive based on a path passed to it by one of its parameters.
    A path cannot point to a system critical folder, for example a root, windows or system directory. A path is also subject to other unspecified tests.
    For many methods, the file name must have an extension appropriate to the type of data that is to be saved. Some methods may have a no-overwrite restriction. These additional restrictions are noted in the documentation.
    Generally, when a path is judged to be not safe, a NotAllowedError exception is thrown (see Error object) and the method fails.

  • How to access Print Dialog boxe's "Pages" property

    Hi,
    I am using the following line to populate the Print dialog box.
    xfa.host.print(1, "0", (xfa.host.numPages-1).toString(), 0, 1, 0, 0, 0)
    Is there any way that I can access Pages option using JavaScript with Adobe LiveCycle Designer 8.0 where I can show the page range to print?
    I want to print 3 copies of 1st Page and then the one copy of full PDF. So in the Pages option of Print dialog box I want to display 1,1,1,1-9. Is there any way to accomplish this programmatically?
    Or is there any better way to print 3 copies of 1st page and then 1 copy of whole pdf?
    Thanks.
    Niketa Parekh

    Hi,
    I am using the following line to populate the Print dialog box.
    xfa.host.print(1, "0", (xfa.host.numPages-1).toString(), 0, 1, 0, 0, 0)
    Is there any way that I can access Pages option using JavaScript with Adobe LiveCycle Designer 8.0 where I can show the page range to print?
    I want to print 3 copies of 1st Page and then the one copy of full PDF. So in the Pages option of Print dialog box I want to display 1,1,1,1-9. Is there any way to accomplish this programmatically?
    Or is there any better way to print 3 copies of 1st page and then 1 copy of whole pdf?
    Thanks.
    Niketa Parekh

  • How to view the print dialog

    Hello,
    Does anyone know how I can view the print dialog on the client's screen instead of the server screen. I use java.awt.print classes.
    Frame f = new Frame("test");
    f.pack();
    PrintJob pj = f.getToolkit().getPrintJob(f,"PRINTING NCN", new Properties());
    Paper paper = new Paper();
    paper.setImageableArea(0,10,74,105);
    PageFormat pageFormat = new PageFormat();
    pageFormat.setPaper(paper);
    if (pj != null) {
         Graphics g = pj.getGraphics();
    Thx.

    if what you want, it is to print what it is seen in the server in the client, you must follow these steps:
    1. server: make an screen capture in a JSP page and send the image to the client in jpg format
    2. client: show the jpg image in a hidden frame or window and use javascript to show the print dialog
    3. client: the javascript code is parent.print();
    This works. I sure.
    Good luck.

  • Print Dialog in JSP

    Dear All,
    This my problem. From JSP on clicking a Button , a Print Dialog Box has to appear. On Clicking Print it has to print a Dynamically Generated HTML Page. My Architecture Goes LIke this. Jsp --> Servlet --> In servlet a HTML is generated.
    When Clicking the Button in JSP, The page should not refresh again. It has to straight away display the Print Dialog Button. I can do this for displaying open-dialog box. now the requirement is to display the print dialog box.
    this is the snap shot code i used in servlet to open the html. But Now Requirement is to Open a Print Dialog Box Instead of Open Dialog Box.
    Can any one help me out in this regard.
    public void doPost(HttpServletRequest request,HttpServletResponse response) throws IOException,ServletException
    PrintWriter pw = response.getWriter();
    response.setContentType("text/html");
    response.setHeader("Content-disposition","attachment;filename=report.html");
    pw.print(generateHTMLContent());
    pw.close();
    Post reply here / mail me @ [email protected]

    If you don't mind restricting yourself to the newer browsers you can use the LINK tag to designate the servlet as an alternate html page that will be printed when a JavaScript function does a document.print.
    Here is a link that may help:
    http://www.htmlhelp.com/reference/html40/head/link.html
    I have used this for intranet applications where I knew that all users would be using IE 5+ but I don't have an example readily available.

  • How to show print dialog as soon as it opens in browser

    I need to open a pdf with print dialog through AcroJS. The code that I used is:
    console.show();
    var pp = this.getPrintParams();
    pp.interactive = pp.constants.interactionLevel.full;
    this.print(pp);
    In order to add the script I used iText. I made a PdfAction object which add the javascript  to the file. I used PdfWriter to set the open action as:
    writer.setOpenAction(PdfAction.javaScript(<script>));
    But it is not working. It gives the following error when I open the pdf.
    InvalidArgsError: Invalid arguments.
    Global.print:1:Doc undefined:Open
    The acrobat reader version is 7. Any help will be appreciated. Thanks in advance.

    Thanks George. Your solution worked to perfection. I was looking at all kinds of twisted scipts and all it took was an event. Thanks again.

  • How to invoke print dialog as soon as pdf is open?

    A pdf template was created using adobe livecycle, then the final pdf is created using pdfMerger. Is there a way to invoke the print dialog as soon as the pdf is open? Is there any javascript thate needs to be used?

    Thanks George. Your solution worked to perfection. I was looking at all kinds of twisted scipts and all it took was an event. Thanks again.

  • BUG: Printer default settings not being used when selected in Print Dialog Prompt

    We have 2 styles of printers on our computers: and Epson Receipt Printer (paper size Roll Papper 80mmx257m) and a Dell printer (paper size 8.5x11)
    Our issue is if use us the non-defaulted printer to print something in Internet Explorer, it overrides the default printer setting with its default settings of that non-default printer.  When we try to use the default printer again, the settings will
    not switch back to the appropriate settings of that default printer.  
    Example: (Epson selected as Default Printer in Windows 7 Professional)
    I open IE and select print on a page.  I select the Dell printer and hit apply to change the print settings to the default settings of that Dell.  Everything prints fine.  I then try that same page, but this time I select the Default Printer
    (Epson) and hit "apply" in the Printer Dialog Prompt and print.  The print out is of the paper size letter and not the default settings for the Epson which is Roll Paper.  I look at the settings in the preferences from IE's Print Dialog
    Prompt and it shows it will use the Paper Size: LT 8.5x11 in.  
    If I close and re-open IE and print that same page to the Epson without selecting the Dell I see that the settings are back to the defaults for the Epson and things print as they should.
    Why doesn't IE use the default settings after selecting any printer and hitting apply in the print dialog prompt past the first change of printer selection? 

    Hi Dan,
    This forum is to discuss HTML, CSS and Javascript for IE. Please post your thread on TechNET IE forum.
    http://social.technet.microsoft.com/Forums/ie/en-US/home?forum=ieitprocurrentver.
    Thank you for understanding.
    Regards,
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Scripting Print Dialog and Epson Print Dialog - Consultant Required

    I have a project I would like to pay a Scripting  Consultant to develop.
    The script should run on Photoshop CS 3 , Mac OS Leopard 10.5.6,
    I would like the script to be preferrably in Applescript to link with the Mac OS, but it can be Javascript
    Functionality
    1. The script should  script the settings within the Photoshop print dialog box such as the colour profile
    and colour management options
    2. I would also like the script to control the Epson Print Settings in the Epson print dialog
    boxes such as the Page Size/Set Up and Printer settings such as paper type=  Epson Premium Glossy.
    3. Finally I would like  the script to be triggered via a button/palette which floats in Photoshop, so immediately we want to print
    a design to a particular Epson printer (we have 4 different Epson printers ) we can click that button and it will
    send the print to that printer with the correct profile, media settings, page set up etc
    Notes
    I have been told that "Configurator" made be the best application to create these printer buttons.
    I have also been told that it may be possible to script the Epson Dialog using information from the Script Listener
    As you can tell I am not a scripter but have a clear idea of what is required and am happy to pay for the experitise required here.
    If you want to email directly please do so -
    [email protected]
    Thanks very much
    Josh

    I have been told that "Configurator" made be the best application to create these printer buttons.
    But Configurator is for CS4.
    I’m not sure the print-dialog can be Scripted the way You want it; at the company where I work we use a Server-Hotfolder-setup which makes such things easier, as one can simply save separated copies into the respective Folders.
    You could also post on http://www.ps-scripts.com/
    Many of the most knowledgeable contributors to this Forum are involved in that Forum.

  • Keboard navigation doesn't work in print dialog

    Hi,
    We are using JRE 1.6.0_04 . I just found that the tab and shift+tab keys don't work on the print dialog . Also the properties button is disabled .
    Does anybody know the reason ?
    Regards,
    R D
    Edited by: RagD on 18-Feb-2009 01:28

    Been there, done that burnt the T-shirt.
    Although the suckerfish drop-downs look really good I got
    into the same sort
    of mess that you did. Found this newsgroup, took their advice
    and now use
    the menus at www.projectseven.com. Free to use their
    tutorials or
    reasonably-priced ready-made.
    Jo
    "karrimac" <[email protected]> wrote in
    message
    news:e2beer$k58$[email protected]..
    >I used the directions on this site,
    >
    http://htmldog.com/articles/suckerfish/dropdowns/,
    to help me create
    > navigation
    > using css that would be compatible with IE However it
    doesn't seem to
    > work,
    > when I load it in IE I get "errors on page" and the drop
    down menu doesn't
    > work. It seems to work fine in firefox. Here's the page
    >
    http://whatcom-mrc.wsu.edu/mrc_base.htm
    >
    > Is this a problem with my css or the javascript. Any
    help would be
    > appreciated.
    >

  • Turn off print dialog box

    I want to turn off the print dialog box in Adobe Reader.  I want a similar function "quick print"  that Word has in order to use Adobe Reader more efficently with other software.  Is this possible?

    You will have to write some custom JavaScript and with versions 7 or newer or Acrobat/Reader, you will need to install a special script in a special application folder due to revised security restrictions.  You will also need to write a script file to add a menu item or tool bar button.
    The basic Acrobat JS code is:
    // Print a file silently
    this.print({bUI: false, bSilent: true, bShrinkToFit: true});

Maybe you are looking for