JavaScript to invite the user to save in PDF format

I make the changes with the code for the file. I want the user to be prompted to save as a file .ai first. I have that down. Now, I'm eager to have the user immediately prompted to save as pdf with only the option optimize for fast web view selected. I think it's an adobe built-in smallest file size.

The reason for wanting the guest is because I want to save the files in 2 different places.

Here is my code so far...

var doc = app.activeDocument;
// Save as .ai file  
var fileName = doc.fullName;  
var thisFile = new File(fileName);
var saveFile = thisFile.saveDlg();
doc.saveAs (saveFile);


// Save as .pdf file
var pdfSaveOptions = new PDFSaveOptions();  
pdfSaveOptions.pDFXStandard=PDFXStandard.PDFXNONE;  
pdfSaveOptions.compatibility = PDFCompatibility.ACROBAT5;  
pdfSaveOptions.preserveEditability = false;  
  
var pdfFile = new File(fileName);  
doc.saveAs(pdfFile, pdfSaveOptions);



HAVE CS4 Windows 7 64 bit

the folder structure is already existing?

If so, things are simple.

If the name and the number are in the file you could draw that from the entry rather then manual doc to guests.

(Note that there is no test to check the folders exist etc...)

var job = prompt("Enter Job Name");
var num = prompt("Enter Job Number");
aiFile = "D:\\"+job+"\\"+num+"\\AI\\Schematic.ai"
pdfFile = "D:\\"+job+"\\"+num+"\\PDF\\Schematic.pdf"

var newaiFile = new File(aiFile);
var doc = app.activeDocument;
doc.saveAs (newaiFile);

var pdfOpts = new PDFSaveOptions();
pdfOpts.pDFXStandard=PDFXStandard.PDFXNONE;
pdfOpts.compatibility = PDFCompatibility.ACROBAT5;
pdfOpts.preserveEditability = false;
var newpdfFile = new File(pdfFile);
doc.saveAs(newpdfFile, pdfOpts);

If you want the script to create the folders so it is a little more difficult.

JavaScript will not do that, and you need another work autour.

something like that...

if (Folder(qfolder).exists){
app.activeDocument.saveAs( saveName, saveOpts );
}else{
           //alert("about to try bat");
           batpath= 'call "C:\\Adobe Scripts\\MakeDirectory.bat"';
            battemp = new File("C:\\Adobe Scripts\\tempBAT.bat");
            battemp.open("w");
            battemp.writeln(batpath + " " + qfolder);
            battemp.close();
            battemp.execute();
         //alert("Had to Create Folder, Please press OK to continue...");
            $.setTimeout = function(func, time) {
                    $.sleep(time);
                    func();
            };
         $.setTimeout(function(){ app.activeDocument.saveAs( saveName, saveOpts )},200);
         }
}

the MakeDirectory.bat is just:

ECHO OFF
CLS

IF %1=="" GOTO BLANK

SET savepath=%*
MKDIR %savepath%
GOTO FINISH

:Blank
ECHO No Folder provided
GOTO FINISH

:FINISH

the tempBat.bat is used to call the MakeDirectory.bat with the name of the file as an argument.

Tags: Illustrator

Similar Questions

  • Using a "button to submit the user entered data in PDF format in mail

    I created a form in which the user fills out the form and click on "Button" to submit data via PDF (attached to an email) to a specific e-mail (mailto:[email protected]). When the blank email to your colleagues, it does not have the function to work. Any help would be greatly appreciated!

    Also if you have the time is there a way to set the order of the data when the user submit via xml?

    Open the PDF in acrobat pro.

    Click Advanced-> Extend features in Reader

    Click Save now

    try that saved form

  • Using Windows XP with an access switched. How can I stop the network Dialer to invite the user connect even if I checked never dial a connection in Control Panel, then apply, then OK?

    Using Windows XP with an access switched. How can I prevent the network Dialer to invite the user connect even if I checked: never establish a connection to the Control Panel, then apply, then OK? She comes right back in a few minutes for: always connect by default. Help! Control panel Connections tab doesn't really seem to apply my change to never establish a connection right back to always make the default connection. What else is there to do?

    Hi Richard,

    You did it all change hardware or software on your computer before this problem?

    You can follow this link & check if the problem persists:

    Network connections and remote access troubleshooting

    Hope the helps of information.

  • How can I keep the "on-screen keyboard" to invite the user every time that I reboot? The system is Windows Vista.

    How can I keep the "on-screen keyboard" to invite the user every time that I reboot? The system is Windows Vista.

    Please explain what you mean... "incentive"?

    The keyboard screen is not supposed to be enabled when the computer is turned on.

    Here's how to turn off on-screen keyboard:

    http://www.Vistax64.com/tutorials/72733-screen-keyboard.html

  • How to use JavaScript to limit the number of boxes to check the user can select a PDF form?

    How to use JavaScript to limit the number of boxes to check the user can select a PDF form?

    Here's the working solution

    Please rename all the boxes like chkBox0, chkBox1... .chkBox30 (must start with 0)

    Value of exports of each checkbox must be "Yes" (default value is Yes)

    Place this Code at the level of the Javascript Document

    -Code JavaScript document-

    var counter = 0;                Checked the meter

    -Count boxes checked again when the document is closed and reopened.

    for (var i = 0; i)<= 30;="">

    If (getField("chkBox"_+_i).value == 'Yes') {}

    Counter += 1;

    }

    }

    -The function of validation-

    function validateCheckBox(name,value) {}

    If (value == 'Yes' & meter)<>

    Counter += 1;

    } else if (value == 'Off') {}

    counter = 1;

    } else {}

    getField ("name") .value = "Off";

    App.Alert ("you can select only four checkboxes");

    }

    }

    -End of Document Javascript-

    Now put this line in the MouseUp event all checkboxes

    Box - Code MouseUp event.

    validateCheckBox (event.target.name, event.target.value);

    //----------------------------------------------------------------------------------

    Hope this will help

    Kind regards

    Post edited by: Mohammad Irfan

  • How can I fix this error msg? your default printer must support a minimum resolution of 300 x 300 to use the shape tool. I am trying to save in PDF format.

    How can I fix this error msg? your default printer must support a minimum resolution of 300 x 300 to use the shape tool. I am trying to save in PDF format.

    When you have what you want to save the selected PDF file, make sure that you press properties, and set the resolution in the settings.  PDF files themselves have quality settings, (print quality, Web quality etc) then make sure that you have the right to a game if you plan to use the "print" function to save in PDF format.

  • Hi, actually I want to save as a PDF labview code to prepare my documentation, it is possible to save in pdf Formate?

    Hi, actually I want to save as a PDF labview code to prepare my documentation, it is possible to save in pdf Formate? Please answer me quickly...

    Thans in advance.

    When you print a VI, you can choose to print documents of the VI and print it to the printer. If you install the PDF printer, it will appear as a selection. PDF Creator is one of the PDF printer free that you could use.

  • On a Mac ios10.10, using the online service export to PDF format, an error message appears, "year error occurred while trying to access services."

    Can you advise steps I might take now?  On a Mac ios10.10, using the online service export to PDF format, an error message appears, "year error occurred while trying to access services."

    Hi Ringdoc,

    Please see this: "Error has occurred when trying to access this service" when you sign in to Acrobat.com

    Let us know how it goes!

    Best,

    Sara

  • 5.5 InCopy user cannot save to PDF low resolution

    The user complains that they can only save as pdf high resolution pdf not low resolution.

    Is there a way to do this in InCopy?

    Harlan

    InCopy users have not 'res pdf' control... it downsize images to 150 dpi, which I think is more a "res intermediary." Images that are less than 150ppi initially are left as is.

    The only way to get the images to a smaller resolution is to open the PDF file in Acrobat Pro and do a Save optimized As it or to reduce file size.

    AM

  • The gray image - save as pdf - CMYK

    Hi all

    I am trying to convert the gray image to grayscale pdf with Save as option. Once done the procedure, the pdf file after CMYK mode (verified in print in Acrobat production method) below.

    Guide to, how to clear this problem.

    Original image:

    Screen shot 2015-04-08 at 10.14.44 AM.png

    Step 1: converted to gray

    Screen shot 2015-04-08 at 10.14.55 AM.png

    Step 2: Save as pdf with few options

    Screen shot 2015-04-08 at 10.15.14 AM.png

    Step 3: setting of pdf

    Screen shot 2015-04-08 at 10.15.33 AM.png

    Step 4: Verify in acrobat, this occurs for the CMYK mode

    Screen shot 2015-04-08 at 10.16.00 AM.png

    But I need grayscale mode (only for black. (Black once only wide, no need to display the image).

    In my test, using shades of gray and high print quality, the PDF file contains a gray scale,

    not a CMYK image, found by PDF analysis, image on the right.

    IMO, your test is bad. Your PDF file is grayscale, but the profile of your simulation is

    a CMYK profile, as in the image on the left.

    In such a case, a conversion is simulated. It would be correct to use a grey profile

    as a simulation profile, but this type of test does not reveal what kind of image the

    PDF file contains.

    Cordially - Gernot Hoffmann

  • Are not sent to the printer by default, asks me to save in PDF format

    Everytime I go to print a Web page, the print menu comes upward and instead list the default printer first, he asks me for sure the Web page in PDF format. How can I get this back to where it displays the default printer as the only option I have?

    SS

    Is your printer but simply not listed first?  If it isn't...

    Most often when a device does not work, it is because the driver is damaged. Re-install a new copy should help

    http://Windows.Microsoft.com/en-us/Windows7/update-a-driver-for-hardware-that-isn ' t-work correctly? SignedIn = 1

  • Cannot send the content of form in PDF format

    Hello!

    I'm just getting started with LiveCycle Designer (and LC as a whole) and feel really lost with the lack of information for absolute beginners.

    For now, I am trying to build a form to be distributed among customers and then sent back with full of information.

    I create the form in the designer, opt for delivery in PDF format, save them as PDF, open in Acrobat to extend the rights of users... but when I test the form... I get the news in XML format.

    I tried again and again and still got the same results. I m reeeeealy get frustrated.

    Please, please, help!

    Thanks a lot for all ideas.

    Marcos

    Change the type of your Email button submit to the 'button' (click the dropdown of the part highlighted in her will keep you attached screenshot).

    Then place the code in the click event of the button below. Set the language "Java script".

    event.target.submitForm ({cURL: "mailto:[email protected]?subject=FORM TEST", cSubmitAs:"PDF"}); "})

    Thank you

    Srini

  • LaserJet M1212nf MFP: laserjet MFP won't allow scans to save in pdf format

    scanner does not provide an option to save as .pdf scans

    You analyze with the help of scanning worms or any other application?

    Try scanning by Windwos scan below, it provides PDF scan capabilities:

    https://www.Microsoft.com/en-us/store/p/Windows-scan/9wzdncrfj3pv

  • All I want to do is save in PDF format!

    Read all your comments. Right, absolutely stupid.

    All I want to do is save in PDF, I don't want to send a cloud or anywhere else outside of my computer. I can convert a PDFno problem but do not get the option to save?

    Cannot find where to cancel the subscription to them.

    Hi debbypq,

    When you convert a file using the ExportPDF online service, it is automatically saved in your online account. You can download it to your computer by clicking on the tabs of files when you are connected to https://cloud.acrobat.com/files, by selecting the file, then click Download.

    If you decide you want to cancel your subscription, please see cancel your subscription or membership. Acrobat, Acrobat.com online services.

    Best,

    Sara

  • Why are misunderstood paragraphs when I do save as PDF format

    I use 12 FrameMaker and Acrobat Pro XI. When I do a 'Save As PDF' of a book and you select the bookmarks that I want and you organize their hierarchy etc. Acrobat includes formats of paragraphs that I chose not. For example, it seems to include a random selection of table of contents entries, I have doesn't have a selection to include.

    I went back and checked that all the paragraphs are the correct formats, but it continues to be.

    In addition, once I generated the PDF file, PDF settings I chose are not registered correctly. In other words, whenever I do a 'Save as PDF' I select paragraphs formats I want to include in the form of bookmarks again; It seems to have saved some of them, but not all of them.


    Any ideas?

    Bookmark information (i.e. PDF configuration information) are stored with each file/book, so if you have saved the file, these parameters must also be registered. Try using the Format > Document > PDF of installation... ability to define things way th in the book and then save the book. The correct settings are currently maintained the next time that you open the book and the need to create a PDF file?

Maybe you are looking for

  • Some errors in the new Swedish translation of 6.9 of Skype for Mac

    I found a few minor errors in the translation, on the view menu, and on the Edit menu. Who should I contact to get fixed? I also made a few screenshots, tell me if you need.

  • Remove drivelock

    I have just purchesed a laptopat an auction, it's an HP pavilion ze4100 s/n {Private Information Removed} CRVSA-0211-75. There drive lock and bios master password how can iremove so I can use the laptop

  • Windows 7 Activation professional failure on new hard drive?

    I perform a clean installation of Windows 7 Professional. During the installation because I'm invited, I enter the key of Windows 7 Professional. The process continues, and Windows 7 Pro is installed. I see the AUTHENTIC logo in system folder as you

  • Printer HP Officejet Pro 6830: print to hp officejet cancelled 6830

    Hello our new printer (office jet pro 6830) wireless works well until we try to print 'best quality' mode or when the file contains many colors (large black or colored surfaces). In these cases it stops just printing in the middle of the page, which

  • Windows is not updated

    Whenever I tried to update the windows during the three or four days, I click search for updates and it's verification of updates of the hours. This isn't the changes and all the time looking for updates as shown in the screenshot... Please help me h