JS: How to make a script to print one page at a time and set print job name?

What I want is to print one page at a time to the printer.
Document.print(false, app.printerPresets.item(0)) almost get me there. But how do I get it to print page by page? There seems to be no way to set which page to print to printerPreset.
Also, is it possible to change print job name from the default of using document name?

>Is there any solution to this other than saving the document to a different name before each page print?
Here is an altered and abriged version of the script that I use. I use print preset called "PS to PDF" in it, so you should change it to your own.
if(app.documents.length == 0){
   alert("Please open a document and try again.");
   exit();
var myFolder = Folder ("~/Desktop");
var myDoc = app.activeDocument;
var myNoExtention = getFileNameOnly (myDoc.name);
var myPrintPrefs = myDoc.printPreferences;
if (app.printerPresets.item("PS to PDF") == null) {
   alert("Preset \"PS to PDF\" has not been installed");
   exit();
else {
   myPrintPrefs.activePrinterPreset = app.printerPresets.item("PS to PDF"); 
myDoc.sections.everyItem().sectionPrefix = "";
myDoc.sections.everyItem().includeSectionPrefix = false;
   var stop = myDoc.pages.length;
   var w = new Window ( 'window', 'Printing PS-files' );
   var pb = w.add ('progressbar', [12, 12, 300, 24], 0, stop);
   var txt = w.add('statictext');
   txt.bounds = [0, 0, 200, 20];
   txt.alignment = "left";
   w.show()
for(var myCounter = 0; myCounter < myDoc.pages.length; myCounter++){
   curPage = myCounter + 1;
   pb.value = curPage;
   var myText = String("Page " + curPage + " of " + myDoc.pages.length);
   txt.text = myText;       
   var myPageName = myDoc.pages.item(myCounter).name;
   var cornumber = pagenum(myPageName);
   var myFilePath = myFolder + "/" + myNoExtention + "_" + cornumber + ".ps";
   var myFile = new File(myFilePath);
   myPrintPrefs.pageRange = myPageName;
   myPrintPrefs.printFile = myFile;
   myDoc.print(false);
w.hide();
alert("Done!");
function pagenum(myNumber){
   if (myNumber >= 1 && myNumber <= 9)
   x =  "0" + "0" + myNumber;
   else if (myNumber >= 10 && myNumber <= 99)
   x = "0" + myNumber;
   else if (myNumber >= 100 && myNumber <= 999)
   x = myNumber;
return x
function getFileNameOnly (myFileName) {
   var myString = "";
   var myResult = myFileName.lastIndexOf(".");
   if (myResult == -1) {
      myString = myFileName;
   else {
      myString = myFileName.substr(0, myResult);
   return myString;
Kasyan

Similar Messages

  • I have an HP Photosmart C4180 all in one printer scanner and copier, I can't figure out how to scan more than one page at a time and then send as a PDF file via email

    I have an HP Photosmart C4180 all-in-one, printer, scanner and copier.  I can't figure out how to scan more than one page?  It will only let me do one page at a time and then I have difficulty sending pages 1, 2 and 3 as one docuement.  Any ideas??
    Thank you, Jetteski

    Hello Jetteski,
    Hello Jetteski, Thanks for the post.
    Since you are running a MAC, check the below links for some excellent information on scanning.  Good Luck!
    http://goo.gl/M8Cl2
    http://goo.gl/cufK6
    http://goo.gl/OTQoR
    I work for HP but my posts and replies are my own....Thank you!

  • I am trying to print all the PDF pages in a range of 5 pages but can only print one page at a time . . . It will print the current page, but not all or pages 1-5.  Can this be overcome?

    I am trying to print all the PDF pages in a range of 5 pages but can only print one page at a time . . . It will print the current page only, but not all or pages 1-5.  I need to go to the next subsequent page and command to print current page; continuing with this procedure until all pages are printed one at a time. Can this be overcome?

    You can use printPages(1, 5), however I need to know how you print current page.

  • Can only print one page at a time

    Using Adobe Reader 9.4.2
    Operating system Arch Linux
    Printer Brother DCP-115C
    When trying to print more than one page at a time in a PDF document,
    Adobe Reader appears to create the print
    the print job appears in my print queue
    the printer says 'Receiving Data', but only momentarily
    the printer resumes 'normal' status
    the printer does not print anything
    It is as if there is very little data actually sent to the printer, even though the print job appears to be 254k in size
    When I try to print one page at a time from a PDF document
    Adobe Reader appears to create the print
    the print job appears in my print queue
    the printer says 'Receiving Data' for several seconds
    the printer prints the page
    no problem
    It seems to me that Adobe is creating a print job (for multiple pages) that the printer either does not understand, or the printer believes that there is nothing to print.
    I am able to print everything that I need to, but only one page at a time!
    Does anyone else experience this problem? Do you know how to overcome this?

    You can use printPages(1, 5), however I need to know how you print current page.

  • Laserjet 2100 will only print one page at a time.

    I recently acquired a second hand Laserjet 2100 Series. Installation was fine but it will only print one page at a time, I have to keep pressing the 'Go' button, which is very frustrating. The manual tells me that it is in 'Manual' mode but not how to change it. Can anyone help, please? O/S Windows 7. Thank you.

    This seems to be a commercial product. For the best chance at finding a solution I would suggest posting in the forum for HP Business Support!
    You can find the Commercial Laserjet board here:
    http://h30499.www3.hp.com/t5/Printers-LaserJet/bd-​p/bsc-413
    Best of Luck!
    You can say thanks by clicking the Kudos Star in my post. If my post resolves your problem, please mark it as Accepted Solution so others can benefit too.

  • InDesign CS5 only prints one page at a time.

    InDesign CS5 only prints one page at a time. No multiple copies. Each page in a document has to be printed one at a time. I didn't have this problem with any version before this. No matter what I do, change settings, etc. I still have the same outcome. How do I work around this problem so I can print a 5 copies of a 3 page document without having to do each copy of each page one at a time.

    Sounds like a printer driver issue. Can you export to PDF and print that correctly?

  • When I print from my pad it only print one page at a time, why?

    Why can I only print one page at the time when using the iPad?

    Generally all you need to do is fill in an appropriate Album Artist. For more details see my article on Grouping Tracks Into Albums, in particular the topic One album, too many covers.
    tt2

  • Can't print off my statements like before...have to print one page at a time instead of whole statement...what gives?  did up dates ...updates no good?

    Can't print off my statements like I did before...have to print one page at a time now...what happened?   never had proble  before....I did an update that they said was available...did that cause the problem...Apple???

    Hi Charlott...
    Open System Preferences > Print & Scan then select the Print tab.
    Click:  Open Print Queue...
    Delete all documents in the queue
    Restart your Mac, turn off the printer then turn it back on then try printing.
    Not sure which update you are referring to. If you have Lion installed and updated to v10.7.3, I doubt that had any effect on printing.
    BTW... when you post, please tell us which Mac OS X you have installed. Thanks!  

  • How do I print one page at a time for a photobook .pse project?

    I am trying to print a photobook project one page at a time as I am using double sided paper that I need to turn over.  One other project I did asked me if I wanted both sides and would I do the turning myself, but this one doesn't.  I also wanted no border on the prints and it came out with a border.  It is also frustrating to have to wait for it to load 75 pages and then it prints them back to front.  Is this PSE or the printer software?

    Yes, you can print one page one at time as you want .
    In print dialog, select other pages and click on remove button.(refer to screenshot).
    For border click on more options and ensure check box is not selected ( refer to screenshot)

  • Printing data sent to printer one page at a time

    Before, when I printed on my Brother MFC-7840W printer, the data was sent to the printer instantaeously. But now, on my new MBA with Mavericks, when I print something, the printer queue says 'Printing - Sending data to printer" and sends the data one page at a time as it's getting printed. In other words, I can't close my laptop or disconnect from the printer until all the pages have been printed. Anyone knows how I can fix this?

    I have THE SAME issue
    I bought a HP Laserjet Pro 400 in August 2013, and it worked great till I upgraded to Mavericks
    Now, it prints 1 page, waits 20 seconds, then prints another
    my 18 ppm printer is now like 1.8ppm
    I hooked up a windows laptop to print the same document, and it screams through in top speed
    After updating the hp printer firmware, apple drivers, and replacing the cartridges, the problem points to Mavericks

  • How to read ibooks on landscape orientation one page at a time on iPhone 6 Plus

    How can I force iPhone 6 Plus to show me only one page at the time on landscape orientation on iBooks. Right now it show me one page at the time if it is in portrait orientation but as soon as I turn the phone to landscape orientation it splits and shows me two pages ie page 1 and page 2.

    I've looked everywhere I can think of to change the way that iBooks handles this and cannot find an option to change it. If you choose scrolling view then it will not show two columns but then you scroll to read rather than turning "pages."

  • Appleworks will only print one page at a time, please help!

    hi there ~
    no matter how many times I ask the printer to print ALL pages, it will only print one at a time, so I have to manually print page 18, 17, etc....
    Could this be because the pages are arranged left to right? that would seem strange.
    also, I cannot find a function to re-arrange the pages. for example, i want to re-organize to make page 18 at the front as page 1. I just don't get it though I've searched the program.
    THANKS SO MUCH!

    Hi td,
    Welcome to AppleDiscussions and the AppleWorks forum.
    "no matter how many times I ask the printer to print ALL pages, it will only print one at a time, so I have to manually print page 18, 17, etc...."
    My memory says the same as Yvan's.
    If the printer dialogue has a checkbox labeled "Collate", make sure the box is checked, even if you are printing a single copy. If memory serves, this suggestion was made in connection with HP printers.
    A second possible solution is to specify the page range when printing this document (or others that exhibit this problem). (eg. for a 25 page document specify printing From page 1 To page 25.) You might try specifying p. 1 to p. 99 for any document under 100 pages, although I don't know what effect this would have for a 5 page doc.
    regards,
    Barry

  • PLW NTR prints one page, then a blank, and stops

    I have a dependable 18 year old Personal Laserwriter NTR printer which has been running with a Dell running Windows XP for a couple of years. The printer is connected via a parallel cable to the computer. The printer has suddenly started printing only the first page of a multi-page document, then prints a blank and stops printing while the top light on the printer keeps flashing. However, if I open and close the feeder door, the next page and a blank will print, and the cycle repeats. Thinking that the printer driver "broke," I deleted the printer control program from the control panel and installed a new copy of Apple Personal LaserWriter NTR v2010.129 from the XP program. No change in the status. I have used Word, Excel and Wordpad with the same results. Any ideas as to the problem and how to correct? Thanks

    This should help you out...
    http://www.fixyourownprinter.com/kits/Apple/K53
    Sometimes sticking solenoids will cause this issue too, but if it were mine, I'd install the kit I mention above first, and see if that fixes it.
    Let us know how you fare.
    Cheers,
    Jason

  • Excel will only print one page at a time

    At work, we use Excel to track orders. I have a multi-page workbook that has linked pages. Last week, I could print fine, but this week I am only able to print the last page of a sheet. I saw in another forum: http://discussions.apple.com/thread.jspa?messageID=696138 person who had a similar problem, but only when trying to print to a PDF. I am able to preview and print to a PDF without problems. I have updated my OS and printer drivers, and installed all available updates to Office (I’m using version X). I think it is pertinent to note that no one else in my office is able to print these documents normally.
    Can anyone think of a solution short of completely rebuilding the workbook? In the past, saving the file as an Excel v.4 workbook and then reconverting it to the more current file solved the problem, but now if I try to do that, excel crashes.
    Thanks!

    Well, I rebuilt the entire workbook... that was a few months ago and so far, the problem hasn't resurfaced. It really wasn't fun to do, but whatever glitch there was in the file, I eliminated it.
    I think I should mention that I am using Office v.X, NOT Office 2004. I got a new Intel iMac this week and yesterday when I opened up my files, it opened up the test drive (a JOKE of a program if you ask me) Anyway, some of the very minor issues I had with Office v.X were solved in the 2004 version. (When opening up large multi worksheet files without Excel being already opened, the tabs have white text) Anyway, I am still going to wait for the universal version to come out, but it seems that the newer versions may have fewer glitches (as is to be expected)
    At any rate, best of luck to you!

  • Printing one page at a time....

    Suddenly, after adding a new printer (Lexmark E210), which required a number of additional programs to be added, as a work around, I can no longer print more than one page on any of the printers I have installed. Any ideas? They all work. They are all recognized. The only problem, one copy at a time....aaaarrrrrgggghhhh.

    What happens when you try to print more than 1? Do you have to do a force quit or does it just not print the others?

Maybe you are looking for

  • I had to do a system restore on my MacBook Pro. Every app opens except Photoshop CS6. I get an error message  "Could not complete your request because of a program error."

    My Mac was rebooted off the system disk. I have CS6 for Design and Web. Every other app opens. The only one that won't open is Photoshop. I tried to launch it without the preferences file, it still didn't launch. The Plug-ins folder is empty except f

  • How can I fix this line please

    Hello Everyone, I have in a form the following line <*font size="1" face="Verdana, Arial, Helvetica, sans-serif"> Champs obligatoires </td><td align="right"></td></tr> </table></td></tr></table></form> When I hit apply the words champs and obligatoir

  • Video behind sound

    I have a 60gb Fifth Gen Video Ipod. I got it in August, but only got round to putting vids on it now =p However, the two videos I put on have faster video than they do sound. This occurs on both Itunes and the actual Ipod. They play fine in WMP. I us

  • Camera Raw 6.7 and Canon 6D

    I wonder if Camera RAW 6.7 for Photoshop Elements 10 has been upgraded for the new Canon EOS 6D? If not - do somebody know if it will bee done?

  • Installing lion crashes

    While installing the Lion upgrade, my MBP crashes. The error message says that I have a bad hard drive. After trying to reboot, the computer goes into a unending cycle of flashing the apple image, question mark and slashed 0 image. If I force the com