Print postscript script giving error on .print(false) JS CS3

I found this example here:
Olav Kvern, "Need script for printing Postscript files (ID CS2)" #4, 19 Nov 2007 4:45 pm
But if the ID doc has a blank page an error on the myDocument.print(flase); will occur.
The message I'm getting is:
The configuration was invalid or the user cancelled. Please try the same operation in the user interface to see more detailed information.
Once you get rid of the blank or add something to the blank the error is gone. Does anyone know how to stop the error if a user adds a blank page?
Cheers.

Thanks priyan, Olav,
I will try your suggestion priyan. If I can check the page itme and get back a null result I should be able to get the for loop to skip to the next page correct?
Olav hope you don't mind but I made a slight change to give the user an option to print a specific page if required. Just a warning the script does not check that the number you enter is part of the doc. So if you doc range is from pages 19 to 24 and you try and print page 2 it will error.
For anyone else out there that finds this useful you can also change the browse option to a drop menu and set the paths for output. This will speed up the process if you have set paths.
Anyway here is the alteration.
//PrintEachPageAsPS.jsx
//An InDesign CS3 JavaScript
//Prints each page of an InDesign document as a PostScript file to
//a selected folder.
main();
function main(){
if(app.documents.length != 0){
//Display a "choose folder" dialog box.
var myFolder = Folder.selectDialog ("Choose a Folder");
if(myFolder != null){
myExportPages(myFolder);
else{
alert("Please open a document and try again.");
function myExportPages(myFolder){
var myPageName, myFilePath, myFile;
var myDocument = app.documents.item(0);
var myDocumentName = myDocument.name;
var myDialog = app.dialogs.add();
with(myDialog.dialogColumns.add()){
staticTexts.add({staticLabel:"Base name:"});
staticTexts.add({staticLabel:"Print only this page:"});
with(myDialog.dialogColumns.add()){
var myBaseNameField = textEditboxes.add({editContents:myDocumentName.substring(0,4), minWidth:160});
var myPageNumberField = integerEditboxes.add({editContents:"", minWidth:80});
var myResult = myDialog.show({name:"PrintEachPageAsPS"});
if(myResult == true){
var myBaseName = myBaseNameField.editContents;
var myPageNum = myPageNumberField.editValue;
//Remove the dialog box from memory.
myDialog.destroy();
//Specify PostScript file and device-independent PostScript.
myDocument.printPreferences.printer = Printer.POSTSCRIPT_FILE;
myDocument.printPreferences.ppd = PPDValues.DEVICE_INDEPENDENT;
if (myPageNum > 0){
myPageName = myPageNum+ "";
myDocument.printPreferences.pageRange = myPageName;
var myRegExp = new RegExp(":","gi");
myPageName = myPageName.replace(myRegExp, "_");
myFilePath = myFolder + "/" + myPageName + "_" + myBaseName + ".ps";
myFile = new File(myFilePath);
document.printPreferences.printFile = myFile;
myDocument.print(false);
}else{
for(var myCounter = 0; myCounter < myDocument.pages.length; myCounter++){
myPageName = myDocument.pages.item(myCounter).name;
myDocument.printPreferences.pageRange = myPageName;
//The name of the exported files will be the base name + the page name + ".pdf".
//If the page name contains a colon (as it will if the document contains sections),
//then remove the colon.
var myRegExp = new RegExp(":","gi");
myPageName = myPageName.replace(myRegExp, "_");
myFilePath = myFolder + "/" + myPageName + "_" + myBaseName + ".ps";
myFile = new File(myFilePath);
document.printPreferences.printFile = myFile;
myDocument.print(false);
alert("Done!");
else{
myDialog.destroy();

Similar Messages

  • The only working print-related function in BioBench1.2 on my PC is the "Print Report", all the other "Print" functions gave me "Error, the printer is not set up correctly".

    I used to print all my BioBench data by first exporting them to Excel and then print from there. Recently I need to print some of the screen shots and some data directly from array analysis, but when I click on the "print" buttons, the "Error, the printer is not set up correctly" message occurs. The only thing I can print from BB without this error is the report printing function. I have a postcript printer and I have set the postscript option to be "true"... Thanks !

    This problem is a result of a limitation in Windows 9x regarding the size of an image that you can send to the printer. The problem does not occur on Windows 2000/NT. This problem appeared with the increased color options of LabVIEW 6.0 on which the BB1.2 is based.Although it is not immediately obvious, your video driver and settings play a role in printing.
    1. Try adjusting the color palette your driver uses (i.e., 256 color, high olor, true color). The error may occur only in one of these modes. Also, change the resolution (number of pixels) to represent the Screen Area; e.g., change from a 1024 x 768 display to an 800 x 600 pixel display.
    2.Certain video drivers also support "acceleration" modes. Using a non-accelerated mode often eliminates the error. For
    Windows 95/98, right-click on your My Computer icon and select "Properties" from the pop-up
    menu. On the Performance tab, click the Graphics button and change the Hardware Acceleration (e.g., if it is set to "Full", lower the setting a notch or two); for Windows 2000/NT, right-click on your Desktop and select "Properties" from the pop-up menu. On the Settings tab, click the Advanced button and go to
    Troubleshooting.
    3.In Windows, the standard VGA driver provided by the operating system is very stable. Try using this driver in place of the specific one written for your video hardware. If the error is eliminated, there is likely a problem with your vendor-provided video driver.
    4.These errors are most often fixed with the latest
    video/printer driver. Be sure to contact your hardware manufacturer and install the latest driver. An easy way to determine if your error is "driver-related" is to move your code to another machine (and hopefully a different set of drivers) and see if th
    e error persists. If the problem is printer related, try another printer.
    5.Make sure there are at least 100M avalible space in your C: drive. If not, set the virtual memory to the other drive which has larger available space.

  • Surface pro giving error when printing to hp laserjet p1102w

    every time i try ang print either via wireless or connected with usb i keep getting an error message. why could this be happening. ive successfully installed all the software.
    any sugestions would be very much appreciated.
    thank you

    Hi dperomingo,
    Welcome to the HP Support Forums! I understand when you try to print to your HP Laserjet p1102w you get an error message. Can you please let me know the exact error message you are getting? Have you ever been able to successfully print to your LJ 1102w? Also which Operating system are you currently running?
    I would like you to go ahead and run the HP Print and Scan Doctor- It was designed by HP to provide users with the troubleshooting and problem solving features needed to resolve many common problems experienced with HP print and scan products connected to Windows-based computers.
    I will watch for your reply with the requested information, please run the PSDR and let me know the outcome!
    Thank you,
    HevnLgh
    I work on behalf of HP
    Please click “Accept as Solution” if you feel my post solved your issue, it will help others find the solution.
    Click the “Kudos Thumbs Up" to the left of the reply button to say “Thanks” for helping!

  • Chaining of test script giving error

    hi,
    I have created 2 test scripts -
    1) sales order creation
    2) sales order change.
    in sales order creation test script i have maintained sales order number as export parameter. for this i have made VBAK_VBELN as export parameter. I have done  -
    MESSAGE ( MSG_1 ).
    TCD ( VA01 , VA01_1 ).
    ENDMESSAGE ( E_MSG_1 ).
    For 2nd test script i have maintained VBAK_VBELN as import parameter.
    Now i have created 3rd test script to chain the above 2 test scripts.
    here i have maintained VBAK_VBELN as variable parameter. In command interface i have added VBAK_VBELN as "exporting" and "importing".
    still the output of 1st test script is not read as the import parameter of 2nd test script.
    thanks & regards
    sonalika

    Hi Sonalika,
    In your 3rd eCATT, after calling your eCATT to create a sales order, please read the log and see whether VBAK_VBELN  gets updated.  Or, please use the code below right after calling your first eCATT to check whether VBAK_VBELN  gets updated, something like this:
    * This is the 3rd eCATT
    * calling the 1st eCATT
    * VBAK_VBELN should be maintained in the command interface
    * SALES_ORDER_CREATION in the EXPORTING section
    REF ( SALES_ORDER_CREATION, SALES_ORDER_CREATION_1 ).
    * log the variable VBAK_VBELN
    LOG ( VBAK_VBELN ).
    * calling the 2nd eCATT
    * VBAK_VBELN should be maintained in the command interface
    * SALES_ORDER_CHANGE_1 in the IMPORTING section
    REF ( SALES_ORDER_CHANGE , SALES_ORDER_CHANGE_1 ).
    If VBAK_VBELN does not get updated at LOG ( VBAK_VEBLN ), I would suppose something has gone wrong already in the first eCATT.  Then please double check whether the sales order has really been created successfully.
    Kind Regards, Qian
    PS.  If you do not want to add the coding line of LOG ( VBAK_VBELN ), just use debugger to find out whether VBAK_VBELN is updated after the first eCATT runs.

  • Java script giving error

    Dear All,
    I am trying to a do a simple thing but nothing happens.
    Requirement :
    In my interactive form when I click on the check box i want a table to be invisible else it should be "visible" by default.
    The code which i have used on the click event is :
    if ( chb_acc.rawValue == "1" )
    then
    tbl_acc.presence = "hidden" ;
    endif
    When I click on the checkbox nothing happens.This is the exact code so please do let me know if I have missed out on anything.
    Regards,
    Geet

    hello geet ,
      you are not using the right code .
    If you are using Javaacript as scripting language ,then
    if  (CheckBox1.rawValue     == 1)
    Table1.presence     = "invisible" ;
    else
    Table1.presence = "visible" ;
    if  you are using Formcalc then code should be -
    if  (CheckBox1.rawValue     == 1)
    then
    Table1.presence     = "invisible"
    else
    Table1.presence = "visible"
    endif
    here , table1 and checkbox1 should be object names.
    hope this helps .
    thanks,
    sahiba

  • Error while printing RG1 register

    Dear All,
    the following error is cuming while printing excise register J2I6  -register RG1
    "SAP script layout not maintained for company code XXXX - register RG1"
    But same I have configured in 
    SPRO/Tax on Goods Movement/India/Business Transaction/Excise Register/Specify SAPScript forms
    Best Regards
    Sainath

    PowerPC Mac 10.4.11, Print with Safari with: Error while printing.
    Others AP: Printer Setting Utility can't pop up, no effective.

  • Error No print-relavant changes at me23n

    Hi Friends,
    I changed a smartform regarding work order of me23n.
    I Changes are working fine in Dev  as well as in Quality Servers also.
    i am printing long texts.
    I called this form at tcode ME23N - pRINT PREVIEW.
    when i press print preview button it througgs an error
    that... NO print-relavant changes to document <po num> exist.
    I checked all the requests are tranported to Pro and Nace configuration all are done.
    At smartform tcode it gives the output(without data).
    smartstyles also exist and tranported.
    I checked all the ways to resolve this but i am failed.
    Can anyone help me please.
    Edited by: anurag.radha on Jan 2, 2012 6:54 AM

    Hi,
    In message types it has the status with yellow light only.
    i reimport all the requests to Production.
    I debuged it using /H it goes to the  mehod if_output_mm~preview of class cl_po_header_handle_mm.
    Now  i came to knwo that for some po's it is giving pritpreview for some others not .. even thogh
    they have same output type.
    the difference is at the above statement break point the variables has the data, some others which are giving
    error 'no print-relevant...' doesn't fetch any data.
    i am totally confused.. this is because of not creating po properly or technical issue.
    plz guide me.
    Edited by: anurag.radha on Jan 2, 2012 10:34 AM

  • Error while printing.

    Error while printing.

    PowerPC Mac 10.4.11, Print with Safari with: Error while printing.
    Others AP: Printer Setting Utility can't pop up, no effective.

  • "Error while Printing" on ethernet network connected iMac.

    Have 2 iMacs sharing a Canon MP530, one directly connected, the other via a Linksys ethernet router. Upon a print request, the networked computer locates the MP530 and displays the standard print page, but shortly after clicking Print (or Preview) the "Error while Printing" message is displayed. Under some conditions in the past we have been able to print from the networked machine, but now we're stuck and nothing seems to fix the problem.

    Since you have 10.4.10 installed, I'm betting that you were able to print before this update was installed. Anyway, the first thing I would do is delete the printer from the 'client' (the iMac connecting to the shared printer). Open Printer Setup Utility, select the MP530 and delete it. Then click on Printer Setup Utility and select Reset Printing System. This should remove the Canon MP driver files. Then run the printer driver installer again and once completed, add the printer via the Printer Setup Utility, by clicking Add > Default Browser and select the Shared Printer.
    I would also try running a Repair Disk Permissions and if that doesn't help then try using Fixamac's Printer Setup Repair utility.

  • Problem in Barcode Printing using Scripts

    Hi All,
      i am trying to print the barcode in Warehouse Mgmt. for Putaway TO i.e LT32.
    I am able to see the barcode in print preview but when i take the printout the barcode is not printing.
    can any one help me in resolving the issue.
    Thanks & Regards
    Venu.
    <MOVED BY MODERATOR TO THE CORRECT FORUM>
    Edited by: Alvaro Tejada Galindo on Dec 15, 2009 9:17 AM

    Hi Dave,
       Thanks for your reply.
         Right now we are using the printer "HP Laserjet P4015n", using this we are able to print the barcodes in smartfroms but it is not printing for scripts only. if any printer modifications are required please let me know.
    we can't move to smartform as we are using the Standard DriverProgram itself.
    Thanks & Regards
    Venu

  • Printer name "ARCH" not defined - Archive printer

    Hi,
    We are trying to archive some FI objects and store it in the documentum.We have defined the ARCH printer as per SAP guidelines (Device type ARCHLINK, Access method- Archiving Device). While selecting the printer in transaction SARA for the archiving it was giving error message 'Printer name "ARCH" not defined'. The information on the error message is given below. But the printer is already exists in table TSP03. Checked note 639149 authorizations are in place and the printer is already added in content repository thru OAC0. Also note 739828 referred and the prerequisites required are in place. We use ECC 6.0 NW 7.01 release.
    Please provide some inputs, all inputs to solve this issue is welcome.
    Printer name "ARCH" not defined
    Message no. PT001
    Diagnosis
    Table TSP03 contains all valid printer names. The printer name specified here does not exist in the table.
    Procedure
    Enter a valid printer name from table TSP03. You can define new printers using the spool administration function.
    Thanks in advance.
    rgds,
    Shyl

    When we use any other printer which is not defined as Access method -I Archiving device then we are able to select the printer and continue
    Thats the way it should be
    But the intention here is to use the Archiving program (in Device class of SPAD) and continue with Archiving the print lists. So for that we have to make the printer working for Archiving mode
    The spool parameters are for the background job, you cannot use Method I for it, you already set the output method in OAC0 for the print lists.
    Also regarding the selection of 'Send to SAP spool' and 'Print Immediately'' we will be able to select this in the 'Properties' but the error message appears before that and no further selection possible.
    As I mentioned before you need to use a common printer for the background job spool.
    Regards
    Juan

  • My canon printer keeps prompting me that the print head is incorrect insert correct print head

    my canon printer mg5350 has message error incorect print head please insert corect print head

    Hi Brooks14,
    If your printer was purchased within a year, we may be able to replace it under the warranty without having you purchase a new one.  Since you have already tried reseating it without success, I recommend using the Contact Us link to get in touch with our support staff who can go through your warranty options
    Did this answer your question? Please click the Accept as Solution button so that others may find the answer as well.

  • FM SSF_CLOSE failing and giving error message while printing a smartform

    Hi,
    for language spanish the smartform is not getting printed for output type SG11 but for english it is getting printed? What could be the reason? I debugged and found that SSF_CLOSE is failing and giving error message.
    Thanks and regards,
    AP.

    Hi Aparajita,
    for changing from one languages to another translations in SE63 is to be done, either search on SCN for using SE63 , or atleast see these wiki help .
    Transaction SE63 - Translation Tools for Translators (BC-DOC-TTL) - SAP Library
    Transaction SE63 (SAP Library - Translation Tools for Translators (BC-DOC-TTL))

  • IW32- order-print is giving error for particular User.

    Dear Friends,
    IW32- order-print is giving error for particular User and output type.  Debugging authorization restricted on the system, hence I canu2019t trace out the problem. If anybody comes across such issues, please reply to the post.
    Thanks In Advance for your reply.
    Anil Dasari
    Thanks In Advance.

    Hi,
    Information about dump:
    1. User and Transaction:
    Runtime Errors         MESSAGE_TYPE_X
    Date and Time          06.05.2011 10:47:40
         MM Used. 13116304
         MM Free. 3639760
    User and Transaction
         Client.............. 700
         User................ "BLADEF01"
         Language key........ "N"
         Transaction......... "IW32 "
         Transactions ID..... "4DC387ECA12B684DE10000001A5B1803"
         Program............. "/MRSS/SAPLRSG_PM_ORDER"
         Screen.............. "SAPLCOIH 3000"
         Screen line......... 33
    Information on where terminated
         Termination occurred in the ABAP program "/MRSS/SAPLRSG_PM_ORDER" - in
          "/MRSS/RSG_MAINTAIN_MRS".
         The main program was "SAPLCOIH ".
         In the source code you have the termination point in line 441
         of the (Include) program "/MRSS/LRSG_PM_ORDERU04".
    2. Info. Where it got terminated.
    Information on where terminated
        Termination occurred in the ABAP program "/MRSS/SAPLRSG_PM_ORDER" - in
         "/MRSS/RSG_MAINTAIN_MRS".
        The main program was "SAPLCOIH ".
        In the source code you have the termination point in line 441
        of the (Include) program "/MRSS/LRSG_PM_ORDERU04".
    3. How to correct the error.
    How to correct the error
        Probably the only way to eliminate the error is to correct the program.
        If the error occures in a non-modified SAP program, you may be able to
        find an interim solution in an SAP Note.
        If you have access to SAP Notes, carry out a search with the following
        keywords:
        "MESSAGE_TYPE_X" " "
        "/MRSS/SAPLRSG_PM_ORDER" or "/MRSS/LRSG_PM_ORDERU04"
        "/MRSS/RSG_MAINTAIN_MRS"
        If you cannot solve the problem yourself and want to send an error
        notification to SAP, include the following information:
        1.1. The description of the current problem (short dump)
           To save the description, choose "System->List->Save->Local File
        (Unconverted)".
        2.2. Corresponding system log
           Display the system log by calling transaction SM21.
           Restrict the time interval to 10 minutes before and five minutes
        after the short dump. Then choose "System->List->Save->Local File
        (Unconverted)".
        3.3. If the problem occurs in a problem of your own or a modified SAP.
    I have been searching for notes recently implemented for IW32.
    Thanks and Regards,
    ANIL DASARI

  • Script Error when printing

    I have created a project using RH9 that I added a "Print" button to (Thanks Rick!) .  The print function seems to work well in IE9 but when the customer trys to print from IE7 they are receiving the below error......
    The following is the Java Script added to the Skin.......
    javascript:parent.frames[1].bsscright.focus();window.print();
    Unfortunately... the customer must use IE7 because it is part of a standard image provided by thier organization.
    Appreciate any insight ......

    Hi,
    You can try my toolbar scripts: http://www.wvanweelden.eu/premium-content/webhelp-toolbar-scripts
    It includes a print button that should work on all IE-versions.
    Greet,
    Willam

Maybe you are looking for

  • IPod-video stuck on black/gray apple screen-won't reset

    My iPod won't reset. It displays the black/gray apple screen. When I hold down the select and menu buttons the screeen goes blank for a second and then the black/gray apple screen comes back. When I plug the iPod back into my computer it is not recog

  • Question related to Java Concurrent Program

    Hi Friends, I have a basic question related to Java Concurrent Program in the Oracle application. I would like to know the how Java concurrent program is executed in Oracle applications.Also, want to know where can I find the document for the AOL pac

  • Archiving Purchase Orders.

    Hi Friends, I am trying to Archive Purchase order using archiving object mm_ekko. I get the following errors. 1. Could not delete some subitems                                  2. Delivery costs have not been balanced                           3. GR

  • Reserved stock quantity from MB25 t-code in R/3

    Hello Guyz 1. I have to extract reserved stock quantity (difference quantity) from t-code MB25 into my Inventory Cube (0IC-C03) in BW. 2. The user has advised me that the movement type is always '301' and the storage loc. is always '9998'. The proble

  • [CX] Unable to view Smart Lists on Data Forms

    Hello All! I've created and deployed CAPEX Planning Application using BPMA. Deploy and Initialize CAPEX Planning Application was successfull. But I can not view any smart lists on data forms - there are only usual cells, where I can insert data. I've