Export a PDF file with file name of document

I am new to InDesign scripting and I am trying to change the ExportPDFWithPreset.jsx from Adobe so that it will appoint just PDF export the same as the name of the InDesign file. Currently it just named him ExportPDFWithPreset.pdf. How could I get this?

ExportPDFWithPreset.jsx

A JavaScript InDesign CS6

//

Shows how to export to PDF using a PDF export preset data.

main();

main() {} function

mySnippet();

myTeardown();

app.scriptPreferences.userInteractionLevel = UserInteractionLevels.interactWithAll;

If (app.documents.length! = 0) {}

If (app.activeDocument.stories.length! = 0) {}

}

else {}

Alert ("the document does not contain any text.") Please open a document that contains the text and try again. ») ;

}

}

else {}

Alert ("no document is open. Please open a document and try again. ») ;

}

}

< code > snippet

function mySnippet() {}

fragment of <>

myDocument var = app.documents.item (0);

The document.export parameters are:

Format (use either the ExportFormat.pdfType enumeration)

or the string 'Adobe PDF')

To as a file

ShowingOptions as boolean (if this true option displays the

PDF export dialog box)

Using as a PDF export preset (or a string containing the name of a

Built-in PDF export)

The default export PDF predefined names are surrounded by a square breackets

(for example, "[high quality Print], press [quality], or [smallest file size]").

var myPDFExportPreset = app.pdfExportPresets.item ("[Press Quality]" ");

myDocument.exportFile)

ExportFormat.pdfType,

File (Folder.desktop + "/ ExportPDFWithPreset.pdf").

fake,

myPDFExportPreset

);

< / fragment >

}

< / statement >

Disassembly <>

function myTeardown() {}

}

< / disassembly >

Hello

need to replace this line:

File (Folder.desktop + "/ ExportPDFWithPreset.pdf").

by:

File (Folder.desktop + "/" + myDocument.name.replace ("co-operate", 'pdf')),

Enjoy

Tags: InDesign

Similar Questions

  • How to export a PDF file to a word document? at this time he came with "specified by a policy (CMap) encoding is missing? What can I do?  Thank you

    How to export a PDF file to a word document? at this time he came with "specified by a policy (CMap) encoding is missing? What can I do?  Thank you

    Hi frenchiem,

    This is due to the PDF file cannot display the original fonts. To fix it, creator must create the PDF file with the police embed option enabled. Thus, the user can open the file on any platform with the same layout. Or the product Acrobat can display them after installing the media kit for police on the client side.

    Kind regards

    Rave

  • Problem of color with pdf from Indesign. I have a special mix CMYK for a bcard in Indesign. When I export the pdf file that the CMYK mix has changed just started today 1.13.15 Running Yosemite 10.10.1 all help to what to look for would be greatly apprecia

    I have a special mix CMYK for a bcard in Indesign. When I export the pdf file that the CMYK mix has changed just started today 1.13.15 Running Yosemite 10.10.1 all help to what to look for would be greatly appreciated.

    You are mixing color profiles a-place, or document workspace does not match the destination to export space is incompatible.

  • Cannot export the PDF file into WORD Doc (that I just bought) system allows me to choose which PDF file but is grayed out in the area where is located the "Convert" button - so no activity.  I want to be sure that my order was confirmed the e-mail address

    RE: ORDER NUMBER: ADO18068065

    I just bought your program Adobe Export PDF but does not - Adobe allows me to capture what PDF I want to export - but won't let me DO NOT convert the file (the window to see where the PDF export is grayed out and I can't enter anything).  Can I entered an incorrect email when I signed firstly for the export of Adobe program ([email protected] INSTEAD of Correct e-mail address: [email protected] could you go to see if the order went through because your window opens each time I try to export a PDF file to WORD asking me to buy the program Adobe export again. )

    Thanks - Pls email me at: [email protected] with your answer.  

    Hi constancew92438621,

    Make sure that you have installed the last DC of Adobe Acrobat Reader Acrobat Reader DC Learn & Support to use the service to export it to PDF help of Acrobat Reader | Export PDF to Acrobat Reader DC.

    You can also use this service online at https://cloud.acrobat.com/exportpdf

    Let me know if you have still any problem?

    Kind regards

    Nicos

  • Is it possible to export a pdf file, so it conceives as extends on a computer desktop, but as unique pages on a mobile/tablet device?

    Is it possible to export a pdf file, so it conceives as extends on a computer desktop, but as unique pages on a mobile/tablet device?

    Hey chrisr60180361,

    I'm sorry this is not possible.

    You will need to save another copy of the PDF file with the unique page for mobile devices.

    Kind regards

    Nicos

  • Define the quality of compression for individual images to export a PDF file?

    When is export a PDF in the ID file, you are given an option to downsample and compress images. My problem is, I want to compress images more than others. For example, a photo in the paper could be much more than a sous-echantillonnees png logo. Of course, I could go and pre-sous - sample each image to the right size in photoshop, but it may involve sort of. Is there a way I could exclude at least one particular image of compression?

    Hi Graham,

    If this is all for a PDF file, which should be light for web downloads and not for print jobs we can do the following:

    1. export a PDF file with different settings Downsample

    2 merge PDFs with Acrobat Pro

    Using the functionality of layers:
    A. import as layer
    B. flatten layers

    To get the different resolutions of individual images, configure the images that you do not want to see with a separate export for re - print.

    If this idea will work or not work depends on the structure of your page layout. And it might be a little automated through scripts. The extent of automation can be low or high. If images that shouldn't be downsampled can be identified by certain rules, legal regimes may or other means such as styles of object applied to the container used frames per etc., it could be high. And also individual export can be done by the script.

    Kind regards
    Uwe

  • [LIKE CS5] Export a PDF file in the background

    Then CS5 has background export to PDF files. If I have a script that exports several PDFs or JPGs etc, as each page individually or several parameters in the order (or at the same time now?), how know when it is done? AppleScript normally "expects" that the process is done. But now what happens? How can I know that exporting is done and I can close the file, or PDFs are made successfully?

    In my view, that there is now a "background task" class and a command ' wait for task. Examples on how to work with who? (Sorry I have not had time to work on it right now, working on other things IDCS5/Snow Leopard yet.)

    TIA, Chris

    If your script still uses the document. exportFile(), nothing will change. For example, the following code always works:

    t = app.activeDocument.exportFile(ExportFormat.pdfType, File("~/Desktop/Test.pdf"));
    alert("Task is done")
    

    If you want to use the "background" feature, you will need to use document.asynchronousExportFile ().  AsynchronousExportFile returns a background task, which is the waitForTask() method.  You can use something like this:

    t = app.activeDocument.asynchronousExportFile(ExportFormat.pdfType, File("~/Desktop/Test.pdf"));
    t.waitForTask();
    alert("Task is done")
    

    This export your document to PDF using a background task, wait for export to fill and then displays an alert.  The problem is that you lose the benefits of a background task (that is, you can do other things while the file export in the background).

    The backgroundTask object has a status property, which returns the status of the task, including TaskState.COMPLETED.  You could probably add an event listener to check the change of State of TaskState.RUNNING to TaskState.COMPLETED.  When I get a little more time later, I'll check and try to provide a code example.

    Once again, if your concern is the behavior of scripts you already have, then nothing should change.  If you are looking to take advantage of the new substantive tasks, there is work to do.

    /Dan

  • How to export a PDF file without bleed him feel extra "stuff" on the edges?

    I know that my question wording sucks, but I didn't know how else to put it.

    I created a document ID for printing with a bleeding.  When I export to PDF format, the image is not cropped to the final size of the page, but includes the excess background images that I have extended beyond the limits of the page for a bleeding.  I am now trying to export a PDF file that can be sent by e-mail and will not be printed, and so I would like to export a PDF file that has none of these extra stuff (I disabled the printing marks) on the edges.  But my PDF has the makings of excess and a red outline around the dimensions of the actual page.  How to export a PDF file which is cropped to the correct page size (8.5 "x 11")?

    I have attached the PDF I created with the stuff in excess and the red outline around the size of the page so you can see what I mean.

    Thank you!

    Bryan

    When exporting, make sure that the ' marks and bleeds options looks like don't like this (no boxes checked):

  • does not connect to allow to export a PDF file to a Word document

    does not connect to allow to export a PDF file to a word document

    Try to do it here: https://cloud.acrobat.com/exportpdf

  • How to export a PDF file to make nonprinting objects show but don't print not AND hyperlinks on the top of the page work at the same time?

    Firstly - I work in InDesign CC 2015.

    My problem is, I had this 10 page document, which, on every page, shows an object that must be in PDF format - but do not print. I made this object into a button and unchecked "Printable". On top of this object, I made 10 hyperlinks (separate layer) that point to the page 1-10.

    When you export the document and I use the interactive PDF format , works ' show nonprinting object but do not print ' well, BUT hyperlinks don't. If I uncheck the "layer of nonprinting objects" in the file PDF, then hyperlinks work, but the problem now is that the nonprinting objects are invisible...

    When you export the document and I use a PDF to print the "unprintable object show but do not print" does not work BUT the hyperlinks don't...

    I put hyperlinks to post a link to pages and also tried the link to the anchor text. No difference.

    So my question is: How to export a PDF file to make nonprinting objects show but don't print not AND hyperlinks on the top of the page work at the same time?

    Thank you

    Mette from Denmark

    I swapped my links to the buttons - AND NOW IT WORKS; (o)

  • I can't export a PDF file to Word, there is an error in access to the service

    I can't export a PDF file to Word, there is an error in access to the service

    !

    Hi florac81095806,

    If you use ExportPDF go in drive, please make sure you have Acrobat Reader DC, as you can no longer access the service of earlier versions of the player. You can download the CD from this page: https://get.adobe.com/reader.

    Best,

    Sara

  • When I export my PDF file to Word, I lose the formatting?

    Why am I losing my page/font formats and spacing when I export my PDF file to Word?

    It would be useful to know the operating system and the version of Acrobat. When you export, the registration screen has a settings option that includes retain format (creates a lot of text boxes) or flow. There are also options for OCR and graphics in the settings. If the PDF has strange fonts (or non-system), they will be not recorded and Acrobat will try a better idea on an appropriate policy.

  • get the conversion failed on the export of PDF files.

    get the conversion failed on the export of PDF files.

    Hi jfcobb999,

    I'm sorry that you are having problems, file conversion. You convert the web interface, or through Adobe Reader? You have a large number of files in the folder root of your list of files on Acrobat.com?

    Try to start these things:

    • Empty the cache of the browser, and then try again.
    • Use another browser.
    • Make sure the drive is up-to-date by selecting help > check for updates.
    • If you have a large number of files on Acrobat.com, some of them move in a subfolder.

    Please let us know how it goes.

    Best,

    Sara

  • InDesign CC 2014 "can't export the PDF file.

    I am trying to export a small document to PDF using InDesign CC 2014, something I've done many times before, but it now says "unable to export the PDF file.

    There is no errors in the document (at least according to the preflight Panel) and the error does not say why InDesign doesn't have to export the PDF file.

    Does anyone have suggestions on what to check to find out what it is exactly that InDesign cannot or will not do?

    Thank you!

    Adobe Community: File overwriting on output - print/PDF/other

  • Try to delete a pdf file name

    I'm trying to remove a deleted from my list of files to Adobe Reader pdf file name.

    This can be completely stupid, but can't you open just enough other PDF files to make its name drop down to the bottom of the list?

  • Problem with export to pdf design with transparency and piercing group

    Hello

    My question is simple and complicated. It seems that according to the version of the viewer of pdf with people they see my presentation differently.

    I have a few transparent layers to lapping each other and used the sharp group for not having a mixture.

    When you export the pdf file, I see that my destiny:

    Capture.PNG

    When others open to publish the results vary but even adobe can't do things:

    https://INDD.Adobe.com/view/1675353c-35cf-450A-a4b0-74ad3b5122bd?ref=IDE

    Please help and sorry for my terrible grammar.

    Found a way around the problem. It is not the most amazing, but it's fast and easy. The pdf is also much lighter

    1. Copy industry
    2. Delete all except bottom and blocks
    3. Save as jpeg
    4. Open original
    5. Make the opacity of 0 blocks
    6. Remove the background and replace them with jpeg
    7. Be happy

Maybe you are looking for

  • Portege R500 - CD/DVD drive no longer works

    Does anyone found a resolution to this? Like David, my DVD Multidrive on my R500 abruptly arrested recently - I can open/close the player, but he does not appear in Windows Explorer as a disk is valid. Do not think that I have nothing installed on th

  • Satellite A300 - cannot read the second HARD drive

    Greetings from the Spain, I got 1 month there is a serious problem with my laptop (which is 5 months old), associated with crcdisk.sys. I gave up after several hours studying, and send the computer serving techniques. (Vista was does not load and no

  • Default action on favorite hotline &amp; Widgets

    Does anyone know how to configure the default action on the hotline and the favorite contacts widget? Whenever I hit it I must choose between calls, SMS, email, mapping and choose the number. It really defeats the purpose of having direct access if y

  • RGB to the transfer of the HSI COLOR SPACE

    An organization can help me for example how to change the color space of the image RGB to HSI image and then save and display the new image

  • HP Touchsmart 520 PC video card upgrade?

    Hello!  I just bought my PC through QVC a few months back and I was wondering how I could go about upgrading the hardware. I'm not a real tech-savvy person, so I'm not sure how I'd be able to find out if I could upgrade the video card and the graphic