Help with "Print to PDF" Script...

Hi All,
I'm a Web Designer and I would need help creating a Print to PDF Script...
Here's what I have:
// Illustrator Export Script
var difDocuments;
difDocuments = documents.length;
    for(i=0;i<difDocuments;i++) {
        var aDocument;
        aDocument = documents[i];
        var docName;
        docName = aDocument.name;
        var docPath;
        docPath = aDocument.path;
        var docPathStr = docPath.toString();
            if (docPathStr.length>1) {
                var documentPath;
                documentPath = aDocument.path + "/" + aDocument.name;
            else {
                var documentPath;
                documentPath = "Z://Users//Fred//Chavi Files//Saved Exported PDF" + "/" + aDocument.name;
        var printOpts;
        printOpts = new PDFSaveOptions();
        printOpts.printPreset = "Print As PDF";
        var fileToSave;
        fileToSave = new File(docPath + "/" + "Saved Flat PDF" + "/" + aDocument.name);
        aDocument.print(fileToSave,printOpts);
So what I'm attempting to do is to make a Print to PDF script rather then a Save As PDF, since print as PDF takes half the space...
The settings would either be from a Print Preset or just by regular options...(if someone could make a list of the attributes and the "formatting" it'd be extremely appreciated...
Thanks,
Fred.

I already tried that...my test file was around 60kb with the "Print as PDF" and 104kb using the "Save as PDF" and then Optimizing....
I'm mostly doing the exporting to PDF on the Windows machine and I tested my script in Windows as well...
Am I just formatting it wrong?
It tells me:
"Error 1242: Illegal argument - argument 1 - Object Expected
Line: 30
->
aDocument.print(fileToSave,printOpts);"
and just before that I had a couple of "Constructor" errors...in the "Adobe Illustrator Scripting Guide" it was saying that:
"The following objects must be created explicitly:
Illustrator save options
PDF save options
PPD file
PPD file info
printer
print flattener options
print job options
print options"
What exactly do they mean? I created the objects like so: "object = new object();"
It also mentionned a "var object = app.document[0].add();" Those are to create paths and shapes if I'm not mistaken (ActionScript background).
Hopefully I'll find a way around this...
P.S: how much slower would an Action be? And could an action be "transformed" into a Script?
Thanks a lot for your help

Similar Messages

  • Problem with printing a PDF

    Hi All,
    I'm developing a web application written in J2EE that uses Java Reporting Component (JRC) to display crystal reports from some filters recovered from a jsp and passed to a report .rpt previously designed and invoked just at runtime.
    I have a problem with printing a PDF:
    I want, after entering the filters in a jsp, to print a report in PDF format (WORD) without opening it
    with Adobe Reader (Microsoft Word). The class of API JRC used for export is ReportExportControl.
    Can anyone help me?
    I wish a great day to You all.

    Hi Ted Ueda,
    sorry for the delay of my answer.
    I understand very well the problems related to security.
    With the following code that I used to produce a report (PDF) at runtime,
    is the PDF created on the server and then sent to the client, or is it directly created on the client as PDF
    from RTF previously realized?
    ReportExportControl exportControl = new ReportExportControl();
    String report = report path;
    ReportClientDocument reportClientDoc = new ReportClientDocument();
    reportClientDoc.open(report, OpenReportOptions._openAsReadOnly);
    Object reportSource = null;
    reportSource = reportClientDoc.getReportSource();
    //The method setConnectionProperties() stores all the connection parameters in the collection
    //ConnectioInfos
    ConnectionInfos connInfos = setConnectionProperties(request, reportClientDoc);
    exportControl.setEnableLogonPrompt(false);
    exportControl.setEnableParameterPrompt(false);
    exportControl.setReportSource(reportSource);
    exportControl.setDatabaseLogonInfos(connInfos);
    //Single method to pass parameters to Crystal Reports. Using classes ParameterFieldController and
    //ParameterFieldDiscreteValue
    setReportParametersValue(reportClientDoc, reportParameters, subReportParameters);
    ExportOptions exportOptions = new ExportOptions();
    //Set the export format (PDF)
    exportOptions.setExportFormatType(ReportExportFormat.PDF);
    PDFExportFormatOptions PDFExpOpts = new PDFExportFormatOptions();
    exportOptions.setFormatOptions(PDFExpOpts);
    exportControl.setExportOptions(exportOptions);
    exportControl.setExportAsAttachment(true);
    try {
          exportControl.getHtmlContent(request, response, getServletConfig().getServletContext());
    } catch (ReportSDKExceptionBase e) {
    throw new ApplicationException("error code", ": error message"); }               
    As, however, I predicted in my previous message about the direct printing on the client,
    I read about ActiveX, but I don't know how to use them.
    I read this information in the 'Crystal Reports for Eclipse Developer Guide' about "printMode" attribute:
    "In ActiveX print mode, an ActiveX control is downloaded to the client machine and the report is send directly to the printer...."
    The ActiveX alternative is a java applet that runs on the client and takes the pdf from the server and prints directly onto the clients through the commands that I used in the DOS command line:
    1)     AcroRd32.exe /p /h FILENAME
    where
    /p = print
    /h = hide window
    to print the report and
    2)     tkill AcroRd32
    to close Adobe Reader, because it doesn't end automatically after printing and the command  /h  is used just to minimize the process.
    I hope you can give me advice because I need to print directly on the client. Thank you

  • Help with Print Layout Designer

    Hi all,
    I'm not sure if I should post this here or not, I already posted it in the Business One Forum.  Moderator(s)  if this is not the proper place please delete it and let me know that it is not the appropriate venue.
    I need some help with Print Layout Designer.  I am running 2005A SP01, and my customer wants a modification to the Sales Backorder Report.  They want to add the column "In Stock" to both the report as displayed on the screen and the printed document.  The report rendered to the screen has the In Stock, but it is not checked as visible.  I check it and In Stock shows up as designed.  The part I am having problems with is the printed document. I opened the PLD from the Backorder Report, and saved it under a different name.  I resized some of the columns in the repetitive area (header and data) to make room for the In Stock column.  I CAN add the text field Instock as free text and enter "In Stock" as the content.  I looked at the "backorder" column in the PLD, and it is a text field with the source System Variable and the variable is 109.  I would assume that all I need to do in my added column is to set the source to System Variable and enter the variable number.  That is the problem; I can't find the variable number for that column.  I looked on the report rendered to the screen with system information on and the variable is "3 #000027825,OnHand".  I looked at the Back Order column of the report rendered to the screen and the variable is "3 #000028725,OpenCreQty".  I found a spreadsheet that is supposed to contain a list of system variables for 2007A, but the document type for this report is BRDR and that document type does not appear in the list of document types in that spreadsheet.  I looked for a similar spreadsheet for 2005A SP01 but didn't find one.  I DID find a document "How To Customize Printing Templates with the Print Layout Designer".  According to that document, I should be able to get the system variable from the report rendered to the screen with System Information turned on.  Can anyone help?
    TIA,
    Steve

    I haven't dealt with this before so I can't be certain, but here are my thoughts.
    The Backordered Qty is probably a calculated field, so that's why it's a system variable. The In Stock is a defined field, so you probably can use the file and field number, OITM, OnHand. I would look at maybe the stock number or description to see how those are setup on the form instead of the backordered qty field.

  • I need help with printing labels.  please

    I need help with printing labels.  thanks in advance

    Welcome to Apple Support Communities.
    In Address Book, first select a name or group of names to print.
    Then File, Print, select Style, Mailing Labels, then Layout to select a specific target label (such as an Avery number), or define your own...

  • Please help with problem in PDF file and printing

    I have created an Illustrator file with a logo on it. The logo looks fine in Illustrator (CS3 and CS5). If I use "save as" to then save the .ai file to a .pdf file, the logo looks the same as in the .ai file. However, if I use "print" to create a .pdf file, the logo sometimes loses some of the elements in it.
    Here is what the logo should look like:
    Below is what it looks like when I use "print" to generate the PDF file:
    An additional problem is that even if I used "save as" to generate the pdf file, some times, when the file is actually printed physically onto paper, the logo appears in the wrong version (although it looks right on screen).
    Can someone help me with this? I am quite desparet right now because I can't see how I can control this.
    Also, is there any way I can attached the .ai file so someone can look at it?
    The white lines that disappear are not "lines" they are a slightly larger shape placed behind the smaller black one in fonrt.
    Thanks for any help!

    Why are you "printing to pdf"? Does "Save As" yield better results?

  • Help with printing a SCORE To PDF! Urgent

    so once again I'm on a deadline and struggling with the score editor. I have a large score. I have been formatting one page at a time, and then moving on. What I mean exactly is that I get page 1 the way I want it, select print and then preview, save as to a PDF, and then move on with page 2 and do the same thing.
    This was working, up until page 13 (ironic). Page 13 had much more going on notes wise, so I dropped the scale of the score set by one percentage point, from 82 to 81%, so that I could still fit everything I wanted on the page and have it look good. But then when I went to print preview, the formatting was all screwed up, and now I can't figure out how to make it look good, while still keeping the decreased scale.
    Please, someone tell me you know how to get around this. It seems like what it says in the manual doesn't apply at all when it comes to preparing a score for printing, and I'm on a deadline for a grant and very frustrated.
    Help?
    Thanks....

    There are 3 ways in which you can affect the size of the Score to Print:
    1) The Page Set up ( which is probably the one you have been using - it may be that below 80% the Score cant be defined in terms of the information on it.. not sure about this)
    2) In the Score Editor if you go to Layout>Create Score Set from Selection and then open Staff Styles.. there is a Scaling Parameter there which reduces/enlarges the Score
    3) In Layout>Staff Styles> You can also change the size of the stave in individual parts which would reduce your Score size
    Hope this is in time for that deadline
    MS
    PS You are correct to print from PDF - printing from the Score Editor will not solve your problem AFAIK
    Message was edited by: musicspirit

  • Help with printing hard copy from Acrobat PDF

    Copy created in InDesign and printed to Adobe PDF is OK on screen but printing hard copy with random chunks of text missing. Same on both my printers, doesn't happen with doPDF. Any ideas? Thanks

    I suspect that what you are asking is simply to print to a new PDF with print as image selected. You can also save as an image file and then open the images as a new PDF.

  • Text problems with printing to PDF from AutoCAD 2011

    When we print to PDF from AutoCAD, the text in the PDF looks wrong/bad.  It takes on a jagged appearance and doesn't look anything like what the font is supposed to look like.  Any suggestions?

    Yup. It's not that it won't do it, it is just limited to 129". Thanks for the thought. When you print in Acrobat you can see the document size and the page size the program is assuming below the print window. The properties have been set, document adjusted, page size customized. It works exactly as it's designed (according to Adobe help, their knowledge base, etc) but only up to 129". Can do it at any size, decminal, etc. up to and including 129 inches. Prints beautiful, doesn't get chopped no issues at all. Just hits a wall at 129". Been doing it with blueprints for years. Just never needed it this big. In my case it's not a printer/plotter limitation. It's the Adobe PDF printer which is advertised to be able to cusomize page size to 15,000 inches.
    Tried customizing in post script, no luck there either.
    Again, I very much appreciate the suggestions....
    S.

  • Problems with Printing a PDF of DWG with details as raster refernces???...

    So, I'm trying to print a detail sheet that has a few client details refenced as raster images among our own details. Made a PDF using Adobe PDF. Unfortunately, when printing the PDF of this sheet, somehow the raster details get scaled down and a huge black border appears around where the extents of the original image was in the PDF....
    After doing some more digging I noticed that if I uncheck "print as image" in Adobe, the problem goes away. Unfortunately, the "print as image" option is generally very helpful for printing large drawings or drawing sets...
    Any idea how to fix???
    Thanks guys!

    Bruce De Benedictis wrote:
    I looked at the specs, and it seems this printer has PostScript emulation.
    The Australian stores I looked at showed that PS was an option with this model, with the Samsung proprietary language as standard.
    These days, emulators are quite good,
    I've never seen a machine running a PS emulator do a good job with a large file, especially when it is a multifunction as the CPU still has to be informed of the other functions while it is processing the spool file.
    so I would be more likely to suspect that you would get more bang for the buck by adding memory to the printer. You could probably find that fairly inexpensively, if you go for third-party memory. Manufacturer-supplied memory for printers is usually outrageously expensive.
    Agree with this. More memory would help if it hasn't got the maximum already and vendor supplied memory is always dearer than 3rd party.
    Other ways to get around memory limitations are to print only a few pages at a time, and also to turn off collation.
    Collation is an issue when performing multiple copies. But when the file is a multiple page single document then the Collate button has no impact.

  • Need some help with printing Templates

    Hi All,
         So I was hoping for a bit of help. I am currently doing all illustrator work for my new job. I have not been on the program in a long time and the version I am using is CS4. I have been creating brochures and flyers all A4 size and i have hit a bump in the road. I need a 6pp A4 Z folded (Inside) and 6pp A4 Z folded (outside) template. I Have been using the A3 folded to A4 guides to great affect for a two page brochure. But i cannot for the life of me find a template guides for 6pp A4 brochure.
    This was the best i could do, its a pdf but I prefer working with the guides. I have just been downloading the previous templates from commercial printing websites. I found one that was right but not compatible with CS4.
    Any help with finding one or any ideas on a path to take would be greatly appreciated.

    Why don't you just setup the file you need?
    Create your guidelines and there you go.

  • [SOLVED] Need a little help with ACPI handler.sh script.

    By using ACPI I'm trying to get my laptop to hibernate at critical power state. So far I've made a few test scripts to test how to do this, with one of these scripts I'm stuck. My scripting skills are not that good to solve it.
    This is the script:
    if [ `awk '{print $3}' /proc/acpi/battery/C1E9/state` == "ok" ]
    then
    logger "battery is ok"
    else
    logger "battery is not ok"
    fi
    If I run the script I get an error (while "battery is not ok" is logged):
    ┌─[~]
    └─> ./test2
    ./test2: line 1: [: too many arguments
    ┌─[~]
    └─>
    When I run the awk-command from the script, I get the following output:
    ┌─[~]
    └─> awk '{print $3}' /proc/acpi/battery/C1E9/state
    ok
    discharging
    2341
    1824
    10969
    ┌─[~]
    └─>
    I think the problem lies in the multiple output of the awk-command, but I'm stuck in solving it.
    Any help would be great.
    Last edited by NeoXP (2009-11-16 22:40:45)

    @ skanky
    Thanks for the suggestion, but you're right I'm not gonna change a working script. It is working exactly as expected.
    @ all
    When interested this is my current handler.sh
    #!/bin/sh
    # Default acpi script that takes an entry for all actions
    # NOTE: This is a 2.6-centric script. If you use 2.4.x, you'll have to
    # modify it to not use /sys
    minspeed=`cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_min_freq`
    maxspeed=`cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq`
    setspeed="/sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed"
    set $*
    case "$1" in
    button/power)
    echo "PowerButton pressed!">/dev/tty5
    case "$2" in
    PWRF) logger "PowerButton pressed: $2" ;;
    *) logger "ACPI action undefined: $2" ;;
    esac
    button/sleep)
    case "$2" in
    SLPB) echo -n mem >/sys/power/state ;;
    *) logger "ACPI action undefined: $2" ;;
    esac
    ac_adapter)
    case "$2" in
    AC)
    case "$4" in
    00000000)
    echo -n $minspeed >$setspeed
    #/etc/laptop-mode/laptop-mode start
    00000001)
    echo -n $maxspeed >$setspeed
    #/etc/laptop-mode/laptop-mode stop
    esac
    *) logger "ACPI action undefined: $2" ;;
    esac
    battery)
    if [ `awk '{print $2}' /proc/acpi/ac_adapter/C1E8/state` == "off-line" ];
    then
    logger "battery discharging"
    if (( `awk '{if (NR==5) {print $3}}' /proc/acpi/battery/C1E9/state` >= "250" ))
    then
    logger "battery ok"
    else
    logger "battery not ok"
    /usr/sbin/pm-hibernate;
    fi
    else logger "battery charging"
    fi
    button/lid)
    if [ `awk '{print $2}' /proc/acpi/button/lid/C1ED/state` == "closed" ];
    then
    logger "ACPI lid closed"
    /usr/sbin/pm-suspend
    fi
    logger "ACPI group/action undefined: $1 / $2"
    esac
    Still working on it though

  • Need help with Printer Setup conventions

    I can't get my Brother printer to print from one computer--but it prints okay from the other computer on my network. I need to know the conventions for the Printer Setup Utility.
    There's a checkbox by every printer on the list. What does it mean when the checkbox is grayed out?
    Some printer names appear in bold. What does that mean?
    Thanx.

    Thank you for your reply. I appreciate your help in this and just want to understand what you're saying.
    As I say, the printer is displayed in the print dialog box but the checkbox is grayed out. I'm assuming that when you say "...it can't find/see them now," you mean the print dialogue can't see them (the drivers). Your last sentence confuses me. You say, "Do you maybe have Printer Sharing enabled & they aren't actually directly connected? If so you have to reboot after turning it off." A little confusion about your antecedents here. What isn't actually connected? The printer? So I have to reboot after turning it off, "it" I suppose is the printer, is that right? I will try that. So turn printer off, reboot, turn printer on. Right?
    I will describe my problem. l thought that if I understood why the checkbox was grayed out I might see what my problem was. If you want me to start another topic I can do that.
    Problem: I have a network with 2 computers and the Brother
    multifunction fax/printer. I'm using an Apple airport hub. The printer
    and one computer (Mac tower) are connected to the airport base via
    ethernet. The 2nd computer (Apple laptop) is on the wireless network.
    Until recently i could print from both computers. Now I can't print from
    the tower. But I can still print from the laptop.
    When I try to print from the tower I get an error message that says, "Cannot print from current printer." I have rebooted, reinstalled printer drivers, checked cables, deleted printer from printer list and re-added printer all to no avail. But as I say, I can still print from the laptop which is using Airport. So the printer prints, the hub connects to the printer okay (ethernet) and I know the tower connects to the hub (I can ping the printer okay from the tower.)
    I am conversing to Brother support via email and their first suggestions I have already tried. Perhaps there's some problem in the network, but I can't figure it out. Worse yet, now when I go to the Network preferences I get an error message which says, "Your network settings have been changed by another application." THIS ERROR MESSAGE WON'T GO AWAY! I can click 'okay' but it reappears. I have to force quit the System Preferences to get out. If you can help with any of these problems I surely appreciate it.

  • Adober reader problem with printing a PDF

    I instaleed Adobe reader on a new computer w/o problem. I could open a view documents. When I go to print I get a message that says: "Adober Reader has stopped working" I can then check one of two boxes: 1. Checkonline for a solution later and close program or 2. "Close program"
    I'm baffeled - all i want to do is print a PDF doc??

    Hi,
    We have provided the permanent fix for this issue. please refer http://kb2.adobe.com/cps/928/cpsid_92870.html.
    Thanks,
    Atul Agarwal
    Adobe Systems

  • Problem with printing to PDF from ID

    I am having trouble printing my ID document as a PDF using "export" or print options. See screen shots for error messages.

    First off, you are not PRINTING to PDF, you are EXPORTING to PDF, which is the preferred method here. You can try export to .idml (see Remove minor corruption by exporting), but most likely there's a problem on one of the pages that won't get fixed that way. For troubleshooting tips, see Adobe Community: File Crashing on Output - printing/PDF/other

  • Need help with printing black and white pdf print at higher quality.

    We are a machine shop and many of our customers supply their prints for the tooling we need to make in .PDF file formats.  The problem is that some of the files are NOT of great quality.   They seem very faint.  I can view them on my computer no problem and when I zoom in, the quality is good, but whey they print, the dimensions and lines are very faint.   I have been pounding my head to come up with a way to improbe the quality in the following characteristics:  contrast, line quality, darker dimensions and lines, etc.   But I just cannot get anywhere.  Is there anyone that could give me some insight into how to do this.   If so, he or she would have my undying gratitude (which probably is not worth much, but sounds good!)
    The other thing is that some of our customers send their prints in .TIF or .TIFF file formats.  Is there any way to convert them to PDF and get good quality?  These .TIF and .TIFF files are a little worse than others. 
    Thanks ahead of time!
    Yok33

    I am going to try these suggestions immediately!  Thank you so much for the information. Wish me luck!
    Thank you and have a GREAT day!
    Steve Yokom
    Manager
    Northern Precision Inc.
    Phone:  989-736-6322
    Email:  [email protected]

Maybe you are looking for