Printing a PDF via Air

Hey!
With alivePDF I can create and save from Air a PDF-Document. I can also load this document in a new window in Air. But how can I print it from air?
Printing via htmlLoader-Object raised the same error like in my post about printing a runtime created htmlloader-Object (http://forums.adobe.com/thread/591929?tstart=0).
I like to use the start2() from Air2Beta2 option for printing without dialog. but how can i send this pdf content to the print-object?
Is this possible?

You have to be careful when using the ActiveX control to communicate with system functions like printing.  Because it can be embedded in anything that supports ActiveX, some functionality is limited from being called from JavaScript as it may interfere with the host application.
Check out the IAC API Reference (also included with the SDK) and the methods under AxAcroPDFLib.AxAcroPDF.  There are some print functions in there (like PrintAll) that you can call on the ActiveX control directly, as in from your doPrint() method in your HTML page without using the hostContainer.  You would basically just call:
pdfObject = document.getElementById("PDFObj");
pdfObject.PrintAll();
These methods were designed specifically to work with the ActiveX control when embedded in a host application, and can be used to print a PDF embedded in a web page.

Similar Messages

  • Printing a PDF via Acrobat Javascript

    Hi -
    I have a need to print a PDF programmatically, via Javascript.  The PDF is embedded in a Web page.  I use postMessage to communicate with the PDF.
    I've created a simple HTML page with an embedded PDF, and a Javascript link to call my "Print" function. Here's a code snippet:
    <body>
             <a href="javascript:doPrint();">Print</a>
             <object id="PDFObj" data="testPDF.pdf" type="application/pdf" width="400" height="400" />     
    </body>
    In the HTML document's HEAD, I've added the following Javascript which posts the message to the PDF:
    <script language="JavaScript">
            function doPrint() {
                pdfObject = document.getElementById("PDFObj");
                alert("Hello from Javascript...");
                pdfObject.postMessage(["Print", "Print"]);
    </script>
    Finally, I've added an Acrobat Javascript function in the PDF document to listen for the postMessage event:
    function myOnMessage(aMessage)
        app.alert("Hello from the PDF");
           // print routines here
    var msgHandlerObject = new Object();
    msgHandlerObject.onMessage = myOnMessage;
    msgHandlerObject.onError = myOnError;
    msgHandlerObject.onDisclose = myOnDisclose;
    function myOnDisclose(cURL,cDocumentURL)
    return true;
    function myOnError(error, aMessage)
    app.alert(error);
    this.hostContainer.messageHandler = msgHandlerObject;
    Here's my problem: when I test this code and click the HREF Javascript link, I see "Hello from Javascript..." and "Hello from the PDF," so I know the postMessage event is working.  However, I've tried every print command I know in the myOnMessage function, and nothing seems to work:
    app.execMenuItem("Print"); // doesn't seem to work
    this.print(); // doesn't seem to work, even when I pass in all the params, etc
    I've also tried getting print params and passing those in, nothing seems to work.  Am I missing something?  Environement is Acrobat 9 Pro, browser's tested include Chrome 2.0, IE6.  I've attached two files, the HTML bit and the PDF I'm trying to print.  Any help is greatly appreciated!

    You have to be careful when using the ActiveX control to communicate with system functions like printing.  Because it can be embedded in anything that supports ActiveX, some functionality is limited from being called from JavaScript as it may interfere with the host application.
    Check out the IAC API Reference (also included with the SDK) and the methods under AxAcroPDFLib.AxAcroPDF.  There are some print functions in there (like PrintAll) that you can call on the ActiveX control directly, as in from your doPrint() method in your HTML page without using the hostContainer.  You would basically just call:
    pdfObject = document.getElementById("PDFObj");
    pdfObject.PrintAll();
    These methods were designed specifically to work with the ActiveX control when embedded in a host application, and can be used to print a PDF embedded in a web page.

  • Printing solo PDFs via .BAT file

    Hi all,
    We have a current implementation of Oracle Documaker for our LOB. What we do is run a .BAT file that runs the GEN* brothers (gentnw32, gendaw32, and genptw32). This then uses the XML defined in the DATA segment of the fsisys INI file. This prints out multiple PDFs for us depending on the contents of the XML.
    We have a new requirement that states that we need to be able to print a solo PDF using an XML file that is found in a different directory, with a different file name, say invoice1085.xml. Is there a way to do this? I cannot edit the current setup of the workspace since the batch process needs to stay.
    We are using Documaker Studio Version 12.2.0.21451 Build Aug 8 2013. The workspace however was created with an older version (uses an MRL files rather than an ODBC connection)

    Hi,
    I need to pass the extract file name to the GEN Programs via JAVA. Also, my batch file only has the lines:
    SET BASEDIR=%cd%
    CD %BASEDIR%\DATA
    Echo Y|Del *.* >NUL
    cd..
    gendaw32 /ini=fsiuser.ini
    genptw32 /ini=fsiuser.ini
    pause
    del .\print\_*.pdf
    del .\print\.pdf
    pause
    :Exit
    Or
    echo
    gentnw32
    pause
    gendaw32
    pause
    genptw32
    pause
    I'm sorry. I'm not very familiar with creating .BAT files or executables. Would "set MYEXTRACT=%1" replace the "ExtrFile           = INPUT\extrfile.xml" line in my fsisys.ini file? Or will it only stick for the current run? Thanks a lot. I'll try experimenting with your suggestion.
    EDIT: I got it to work using your suggestion but instead of using "Extract = ~GETENV MYEXTRACT", I used "ExtrFile           = ~GETENV MYEXTRACT". Thanks a bunch!

  • What would cause characters to be replaced by glyphs when printing a PDF via PostScript driver?

    When printing PDFs to our laser printers, occasionally a PDF will degrade, with many characters being replaced by little square glyphs. It never happens on the first page, but usually within the first ten pages if it is going to. The file will cause the same effect on similar printers, and is exclusive to PostScript- the PCL driver will print the file as expected. There is nothing visibly wrong in the PDF, and I am trying to isolate the cause of this problem. Once it starts the problem can get worse, but I've never seen it get better or "work itself out".  The sample above is a scan of the output, and the original PDF was version 1.4, the printer is an HP Laserjet 9050dn
    Thanks for your help!
    David

    That problem appeared different than this.  The symptom there was that the screen looked like an old time tv with Horizontal phase lock missing, as series of lines looking sort of  like this only extending from top to bottom of screen as un broken lines:

  • Opening pdf via air 2.6 on iOS

    Hi,
    Just wondering if anyone can help me work out how to view a PDF document within an Air 2.6 app running on iOS.
    Many thanks!
    Dave.

    Hi,
    By now the only way you can do it is using the stagewebview to load a pdf, it works ( tested ) but I dont know how to control way it is presented.

  • Direct Printing PDF via Acrobat 8.0 under Lion

    Direct printing a PDF via Acrobat 8.0 worked under Snow Leopard but no longer under Lion. I have a relatively old installation of CS3 on my MacBookPro and wanted to print a pages document with 12 x 12 cm size onto an A4 page (with integrated cutting marks) - this is not possible with the integrated PDF printer in Lion an so i decided to use Acrobat 8.0.
    The Console says the following:
    Process:         DistillerIntf [30793]
    Path:            /Applications/Adobe Acrobat 8 Professional/Acrobat Distiller.app/Contents/MacOS/DistillerIntf
    Identifier:      DistillerIntf
    Version:         ??? (???)
    Code Type:       X86 (Native)
    Parent Process:  pdf800 [30788]
    Date/Time:       2011-11-05 13:18:36.563 +0100
    OS Version:      Mac OS X 10.7.2 (11C74)
    Report Version:  9
    Crashed Thread:  7
    Exception Type:  EXC_BAD_ACCESS (SIGBUS)
    Exception Codes: KERN_PROTECTION_FAILURE at 0x0000000000000000
    VM Regions Near 0:
    --> __PAGEZERO             0000000000000000-0000000000001000 [    4K] ---/--- SM=NUL  /Applications/Adobe Acrobat 8 Professional/Acrobat Distiller.app/Contents/MacOS/DistillerIntf
        __TEXT                 0000000000001000-0000000000003000 [    8K] r-x/rwx SM=COW  /Applications/Adobe Acrobat 8 Professional/Acrobat Distiller.app/Contents/MacOS/DistillerIntf
    Has anybody an idea how to solve this problem. Of course i posted this error on the Adobe Help forums but since these guys only want to sell the newest Suites if have no hope, that somebody will respond to my question - and i think it is a Lion issue (CUPS problem).
    http://forums.adobe.com/thread/921666

    This is right, but since the upgrade to Lion was a relatively big one (with many functionalities that i have be missing before) i think i will not go back just to regain a normal-working direct PDF printing. Nevertheless i think, if the very old CS3 worked until Snow Leopard it would be very easy for an Apple Engineer to figure out, which trick would allow Acrobat to direct print again - i don't think the underlying CUPS has changed very much - also i found a lot of similar error reports on the web (mostly Acrobat related after updates from System ) which were solved via correcting some rights in the library (this didn't do the trick for me ...)
    Best problem solving would be, that Adobe Software gets cheaper - i have installed the newest Aperture, iWork, Office, iLife, Mindmanager, ... - if you are not a student but a hobby worker these software packages are quite affordable ...

  • Problem with colors when print to pdf in FM9

    Hi,
    we have some problems with printing colors to pdf with FM9.
    The FM document contains (1) eps file with a green box and (2) a rectangle created with FM graphic tools, filled with the same green color values (91/0/60/44)
    In FrameMaker the two colors really looks different, but so what, in the PDF both colors (eps) and rectangle got the same correct green color.
    Ok, the were different in creation, so they were CMYK and RGB, but your print shop could manage that.
    Now in FM 9:
    (1) If I do a "save as PDF"  and switch OFF "convert CMYK to RGB" the resulting PDF is the same as from FM8 (correct)
    (2) If I print to PDF via distiller and define the job options to "convert all colors to CMYK" the resulting rectangle green is very  different from the eps green.
    I tried different job options, the best result was "convert all colors to CMYK", other options just very more ugly.
    Does someone of you know a solution for your problem? Help is very appreciated. I could send example files if necessary.
    Thanks in advance.
    PK

    PK-ulm wrote:
    But we want to use the print option, using the distiller.
    Pia,
    this last sentence needs some explanation, I think. Why do you want to use the print option?
    Using the print option, you still go the same route as FrameMaker Win always did, which is using the RGB-only Windows postscript driver. Now, with FM9, you have the option to get CMYK colors directly to PDF, as defined, without any color conversion. And it *does* work, as long as you restrict your documents to either CMYK colors or spot colors coming from the FM libraries.
    So, again: why do you want to use the print option?
    On a sidenote: I'm not sure if I interpret your username correctly, but if you are able to understand German, you'll find some in-depth color tests made with FM9 here: http://www.hilfdirselbst.ch/foren/FM_9_und_Farben_in_PDFs____getestet_P387800.html
    Bernd

  • Some characters gain extra lines or are broken when printing to PDF

    I am having a problem with some characters rendering oddly when I print to PDF.
    Examples are an extra vertical line next to an upright character, and extra partial curve to the left of an opening parenthesis, or a slight cut-off of a curve in a character.  All of these seem to be in the vertical plane.  It is not consistently tied to particular character combinations - the same word may render correctly in one instance, but incorrectly in another.
    I am using Microsoft Word 2007, and printing to PDF via Adobe PDF Converter (CS4).  The font is Gill Sans MT Light, and the document is 230 pages.
    Can anyone seen anything similar before, or can someone suggest anything I can look into further?

    You may have to turn on "display large images" in the preferences.

  • I can't always print to PDF but can figure out why...

    For some reason I can't print to PDF in all applications, but I can in some. For instance, I can with Word but not with say Illustrator or Safari or even Preview.
    I've tried deleting and adding the printer, both as Generic Postcript and Adobe PDF 3016.102 (the only option when I choose Adobe). I've also searched for a while thinking it was a driver issue or something.. Maybe that I have Acrobat Pro on my Intel back but I installed Adobe Reader, the Intel version, and that didn't seem to work.
    Does someone know why this is happening and what I can do to fix it? It's not a total pain because mostly I use it when print PDFs with Word, but the fact that others don't seem to work bugs me.
    I thought it might be because Word is still PPC, but so is Illustrator so that didn't make sense to me.

    Hello Doug,
    The ability to print pdf's is not dependent on the installed driver. The OS X printing system converts all print jobs to a pdf spool file with a job ticket. It is also not necessary to have Acrobat Pro or Reader installed to generate a pdf or view it. The Print window provides the option to print to pdf even for non PS devices such as inkjets.
    Can you explain what happens when you do try to print to pdf from Illustrator or Safari. Do you get an error or does the job seem to process without a document being generated? If you are not sure about the error you can open the Console application and have a look at the entry /var/log/cups/error_log.
    Also, have you tried to print to pdf via the Print window or have you always tried to print via Adobe's driver?
    Paul

  • Export pdf vs print to pdf in InDesign???

    For years I've "printed to pdf" via InDesign and had no problems with the quality/accuracy of my output. As I've adopted some of the advanced techniques such as knocking objects out with alpha channels and transparency, I've noticed that more and more, my output is flawed. As a result I've reworked my files in Photoshop so that the knockouts and transparency occurs there and is placed into ID as bitmapped artwork.
    Recently I was having a problem outputting a file and sort of stumbled upon Export as PDF. When I tried it, my file output perfectly! I'm thrilled to say the least.
    What I'm wondering is what's the difference between the two? I'm wondering now why there's even a print to PDF option? If I were Adobe I'd make a clearer distinction between the two and the benefits of both.

    Print to PDF is a shortcut for printing to a postcsript file and distilling. Export does not use postscript at all, but instead uses an internal PDF library. Exported PDF supports color management, interactivity, layering, transparency and other advanced features not avaialble in distilled PDF, and is the recommended method for producing PDF from ID.

  • I am using Numbers app for the ipad and it has been working absolutely fine but now, when I want to email a spreadsheet as a PDF via the 'share and print' option, the file now doesn't appear as an attachment to the recipient. Any ideas please?

    I am using Numbers app for the ipad and it has been working absolutely fine but now, when I want to email a spreadsheet as a PDF via the 'share and print' option, the file now doesn't appear as an attachment to the recipient. Any ideas please?

    Hi mafiose15,
    Thanks for visiting Apple Support Communities.
    Restoring your iPod to factory settings is the best way to try and get it back to working order. You can use the instructions below to restore it:
    How to restore iPod
    Verify that you have an active Internet connection, because you may need to download new versions of the iTunes and iPod Software.
    Download and install the latest version of iTunes if necessary.
    Open iTunes. Connect your iPod to your computer using the USB or FireWire cable that came with your iPod.
    After a few moments, your iPod will appear in the Source panel in iTunes.
    Select your iPod in the Source panel. You will see information about your iPod appear in the Summary tab of the main iTunes window.
    Click Restore.
    If you are using a Mac, you will be asked to enter an administrator’s name and password.
    A progress bar will appear on the computer screen, indicating that stage one of the restore process has begun. When this stage is done, iTunes will present one of two messages with instructions specific to the iPod model you are restoring.
    Disconnect iPod and connect it to iPod Power Adapter (typically applies to older iPod models).
    Leave iPod connected to computer to complete restore (typically applies newer iPod models).
    During stage two of the restore process, the iPod displays an Apple logo as well as a progress bar at the bottom of the display. It is critical that the iPod remain connected to the computer or iPod power adapter during this stage.
    Note: The progress bar may be difficult to see, because the backlight on the iPod display may be off.
    After stage two of the restore process is complete, the iTunes Setup Assistant window will appear. It will ask you to name your iPod and choose your syncing preferences, as it did when you connected your iPod for the first time.
    You can find the instructions in this article:
    Restoring iPod to factory settings
    http://support.apple.com/kb/ht1339
    All the best,
    Jeremy

  • How can I retain hyperlinks while saving a webpage as PDF via Print?

    How can I retain hyperlinks while saving a webpage as PDF via Print?
    This is the title of an apple forum question, and it is a bug in both Safari 5.1.3 and under, and I find it to also occur in Firefox browser (at least 9.* 10.*, 11.0), running on Lion OS (10.7.2, 10.7.3). See:
    https://discussions.apple.com/thread/3212301?start=0&tstart=0
    Under the newer Mac OS mentioned, and Firefox 10.2, 11.0, 9.*, if I select:
    File -> Print -> PDF -> Open PDF in Preview"
    (and view / save the PDF in Preview, you will see none of the links in the original web page are active
    or using
    File -> Print -> PDF -> Save as PDF...
    same problem. Try this using any Wikipedia page, for example.
    When this problem was posed in Apple forums, by a user of the Safari browser, it was found to be a bug (since Aug 2011) fixed in a Safari browser build 5.1.4 circa Jan 2012. I tried the newer Safari browser and sure enough the problem went away (except that links embedded in the PDF no longer appeared as blue text - ARGH - but "hover over" with the cursor showed the link and clicking the link in Preview viewer activated the link in a browser window).
    So I post this to the Mozilla community, please fix this 'cause I don't want to have to switch over to Safari browser every time I want to archive a PDF with active links!!!!
    P.S. I did a spot-check and with the newer add-on Enjoy Reading 1.0.1 and FF11.0. When the Enjoy reading formatted version appears in the browser window, all URLs/links are preserved and highlighted in blue, but when I print that browser window as PDF, the links are dead (don't work) even though they appear in blue in the PDF.
    So, what's going on, can the Safari fix be researched and applied to FF?
    Also, on some forums, people are responding, Well, try installing Acrobat reader. Well, I don't want to, Preview reader has worked fine for me for years.

    Thanks jscher2000.
    RE: -- '''Generally speaking, PDF converters that work by intercepting a print job do not have access to the URLs behind links in the page.''' --
    I cannot say I agree. I could email you a PDF clipping or two (generated from Safari on Mac OS, in its native capability with no add-ons) that shows you otherwise. When I used PC platforms I did have to install PDF converters (tried both free and expensive ones) that did what I describe.
    I cannot try the add-on you mention, '''Print Pages to Pdf.''' in Firefox. It shows in my browser and Mac OS platform "Not available for your platform." So I am guessing it was written for the PC version of Firefox.
    The Mac OS has had a native PDF-creation functionality for as many years as I have been using it; I used PC prior to that, Win3.1 through XP and NT. And on my PC, I bought (and at work, my employer bought $$$, I had to justify three levels up to management the ability to create PDFs on my work PC) some Adobe functionality to CREATE pdf's (readin's free and easy, makin' em's costly on the PC).
    I've gone and dug through some of my (Mac) doc and clipping archives, and I find that stuff I created after about Dec 2008 or so seems to eliminate all link functionality. When viewed in the Apple native "Preview" application (sort of Apple's equivalent to Adobe Acrobat reader, ships with the OS): link tags are highlighted/tinted, clicking a link opens a (default) browser and takes you there; hover-over the tag text shows the actual link. (Of course, not all old links are still VALID or point to the desired source.)
    I could, in Safari or FF browser window and with no add-ons or Adobe paid products whatsoever, use the native OS method to create PDF's from any application (word processor, spreadsheet, browser, etc) via the menu File -> Print -> Save as PDF menu and create a PDF that had active hyperlinks. In Apple OS Lion 10.7.3, I still can't when it uses this broken WebKit interface, links are "dead" as a doornail until a fix is distributed in WebKit for a future Lion release. It seems this functionality died at least as far back as Leopard OS 10.6.8, but don't quote me on that. Also, my version of Pages 2009 version 4.1(923) (sorta like Word) STILL creates a PDF document that preserves (1) text hyper-links within the document, and (2) web links (in the PDF) that open the browser. I just made a test document.
    When all you can see in the PDF is the tag text, there is nothing to copy-paste to follow any link. Also, hypertext links are often used by authors to create links to other points in a document: now even *that* is broken in the PDF version of the documents I retrieve from the web and print from FireFox (Broken in Safari 5.1.3 and earlier but fixed in 5.1.4).
    Try this on the PC, in your browser and print a news clipping as PDF, do the links in the PDF work? What products do this, and what don't? I would bet the machine with a full Adobe suite this will work flawlessly. (Why should a PC user have to pay hundreds of $ to create this functionality in what I thought was an open standard (PDF)? But that's talkin' religion, let's not start that.)
    Some folks might say,
    go online and find the original source doc in your browser. Or,
    go and add those links manually using the Preview edit add-link capability (hunh? no thanks) , or
    save each item worth saving as an HTML archive instead of a PDF (argh, creating a whole directory in the process, I might add, including ads). Or,
    who needs PDFs, everything is online.
    Or, buy some Adobe product.
    I think they miss my point. This is a real strange dumbing-down of archival PDF documents, or at least a destruction of the ability to use PDF as an archive that retains its links and references.
    C.F. the guy who has archives of scientific papers, and the old material all cross-references nicely but after date X there are no working links.

  • Printing PDF via Adobe livecycle from R/3 ECC to local printer

    Hi,
    I am working on an Adobe Form via SFP transaction on ECC 5.0 and an Adobe Livecycle 7.1. I can create PDFs, and send them to spool through a LPDF printer defined in SPAD as a PDF1 type. This is ok to get PDF in spool but I want to send these PDF to my local windows printer through SAPLPD.
    I get an error message in SAPLPD :
    Job 0009Jjkn.TD1 (raw) started on printer SKDFMLDSF
    (11:06:48) Error: The printer SKDFMLDSF is unknown to Windows Print Manager.
    (11:06:48) The following printers are currently defined:
    (11:07:18) Printer = MICROSOFT OFFICE DOCUMENT IMAGE WRITER
    (11:07:18) Warning: Printer name contains spaces.
    (11:07:18) Please rename printer, before using it from R/3 or UNIX!
    (11:07:18) Cannot do OpenPrinter SKDFMLDSF. Text = Overlapped I/O operation is in progress.
    (11:07:18) Error: BG: printfile failed, msg = 808 SAPLPD:Windows Problem, siehe SAPLPD Protokoll
    Does anyone know how I can send a spool containing the generated PDFs to my local printer ???
    Thanks,
    Nicolas

    Hi Nicolas,
    To avoid problems with SAPLPD you can print the PDF using the control technology.
    Please read the SAP note
    821519 Front-end printing with control technology for details. 
    Regards,
    Víctor.

  • Printing a pdf file via OLE

    Hi,
    Is it possible to print a pdf file i.e. test.pdf via VB using the properties/methods held within theACRORD32.DLL? or is this only possible if you have the full adobe Acrobat product installed?
    If possibe any example code would be helpful.
    Thanks in advance

    Thanks for this, having a look through at the moment, just one question do I have to install this SDK just to automatically print an existing PDF document from a 3rd party application when I have only the Reader installed?
    Thanks

  • Set filename of printed PDF via script

    Hi folks!
    I have a little problem with generating a PDF. First my Workflow:
    I have a InDesign document with 6 pages. This document is merged with a databasefile containing 100 records. After merging it, we have to generate a PDF file. This PDF file is opened within acrobat. Within the document, I'm searching for an ID each record has so I can split the document to 100 files (each with 6 pages) and name it by the ID I found.
    The script within Acrobat is finished and working. I thought, the InDesign script is finished ,too. But I was wrong -.-
    I merged the databasefile with the document and exported it as PDF. But after exporting, we noticed that the script within Acrobat isn't finding the adressheader where the ID is in. The script only noticed the text after that header. The result is, that Acrobat get's always "null" as ID
    If we print the PDF with our PDFprinter, the header could be read by our Acrobat script. I don't know why this is... But now I changed the script to print the files via our PDF printer. Unfortunately I can't set a name for my exported file - do you know if there is a possibility to print PDF's without prompting after each one and with a via script given name?
    Here you can see the old script for InDesign and right after it, the Acrobat sript. Maybe I made some mistake by generating my PDFexport and don't need to use the printer?
    INDESIGN SCRIPT:
      * prompts filebrowser and stores name and path of file in variable
    var sourceDocument = File.openDialog("Bitte Indesign-Dokument auswählen", "*.indd", false);
      * stores only prefix of filename for use as new filename
    var newName = sourceDocument.name.substr(0,  sourceDocument.name.length-5);
      * stores folder where file is stored
    var dbSourceFolder = sourceDocument.parent+"/";
      * prompts for databasefile where generating should begin
    var dbstartfile = File.openDialog("Bitte Start-Datenbankdatei auswählen", "*.txt", false);
      * gets basename of databasefile
    var dbstartfilename = dbstartfile.name.slice(0, dbstartfile.name.search(/_Teil+/));
      * gets number of first databasefile
    var i = dbstartfile.name.slice(dbstartfile.name.search(/_Teil+/)+5).slice(0, -4);
      * generates path name and name of first databasefile to use
    var dbSource = dbstartfile;
       *set PDF preset for generating PDF
    var PDFPreset= app.pdfExportPresets.item("GAG-PDF");
       * stops throwing of alerts
    app.scriptPreferences.userInteractionLevel = UserInteractionLevels.NEVER_INTERACT;
    // if databasefile isn't existing message will be thrown
    if( dbSource.exists == false ) {
        // restart of alert throwing
        app.scriptPreferences.userInteractionLevel = UserInteractionLevels.INTERACT_WITH_ALL;
        alert("Datei " + dbSourceFolder+dbprefix+"_Teil"+i+".txt konnte nicht gefunden werden! \n\rBitte starten Sie den Vorgang erneut und geben Sie die richtige Datenbankdatei an." );
    // else process starts
    else {
        while(  dbSource.exists == true ) {
            // opens source indesign document without showing it
            mergeDocument = app.open(File(sourceDocument), false);
            // sets which databasefile should be used for data merge
            mergeDocument.dataMergeProperties.selectDataSource(File(dbSource));
            // starts merging of indesign document and database file
            mergeDocument.dataMergeProperties.mergeRecords();
            // exports generated document as PDF file
            app.activeDocument.exportFile(ExportFormat.pdfType, File(sourceDocument.parent+"/"+newName+"_Teil"+i+".pdf"), false, PDFPreset);
            // closes opened indesign document
            mergeDocument.close(SaveOptions.no);
            i++;
            // change filename of database file to get next file
            dbSource = File(dbSource.parent+"/"+dbstartfilename+"_Teil"+i+".txt");
    // restart of alert throwing
    app.scriptPreferences.userInteractionLevel = UserInteractionLevels.INTERACT_WITH_ALL;
    alert("PDF-Generierung abgeschlossen!");
    ACROBAT SCRIPT:
    * Path where files should be saved
    * Special Characters like spaces should be escaped with \
    * If you want to modify the folder, use following form:
    * "/Driveletter/Foldername/../LastFolderName/"
    * Make sure not to forget the / before and after the location
    var filepath = "/c/pdf_split_test/";
    * Number of expose pages - feel free to change
    var pageType = app.prompt("Bitte geben Sie die gewünschte Seitenzahl der Exposés an.", "");
    alert(pageType);
    * regular expression for search
    var idNumber = /08\d\d\d\d\-\d\d\d\-\d\d\d\d\d-\d\d\d-\d\d/g;
    * if possible this function extracts the searched number as string
    * @param rematch string which should be searched in document
    * @return null if rematch is not found or string if rematch is found
    function ExtractFromDocument(reMatch) {
      try {
             var Out = new Object();
             for (var i = 0; i < 1; i++)
              numWords = this.getPageNumWords(i);
              var PageText = "";
              for (var j = 0; j < 30;j++) {
                  var word = this.getPageNthWord(i,j,false);
                  PageText += word;
              var strMatches = PageText.match(reMatch);
              if (strMatches == null) continue;
          return strMatches;
      } catch(e)
          app.alert("Processing error: "+e)
    * tries to load given filename (extracted number)
    * @param filename string of file which should be checked
    * @param n number to iterate while checking for files
    * @return true if file exists or false if not
    function checkIfFileExists(filename, n) {
        var existingDoc = false;
        try {
            if( n == 0) {
                var checkDoc = app.openDoc(filepath+filename+"-000.pdf");
            } else {
                var checkDoc = app.openDoc(filepath+filename+"-000_"+n+".pdf");
            checkDoc.closeDoc();
            existingDoc = true;
        } catch (e) {
        if( existingDoc == true ) {
            n = n+1;
            n = checkIfFileExists(filename, n);
        return n;
    var pageAmount = this.numPages;
    for( i=0; i<pageAmount; i+pageType ) {
        var filename = ExtractFromDocument(idNumber);
        fileExistence = checkIfFileExists(filename, 0);
        if(fileExistence != 0) {
            this.extractPages({nEnd:(pageType-1), cPath : filepath+filename+"-000_"+fileExistence+".pdf"}); 
        } else {
            this.extractPages({nEnd:(pageType-1), cPath : filepath+filename+"-000.pdf"});
        this.deletePages({nStart:0, nEnd: pageType-1});

    Hi,
    I have a little problem with generating a PDF. First my Workflow:
    I have a InDesign document with 6 pages. This document is merged with a databasefile containing 100 records. After merging it, we have to generate a PDF file. This PDF file is opened within acrobat. Within the document, I'm searching for an ID each record has so I can split the document to 100 files (each with 6 pages) and name it by the ID I found.
    Why you don't export 6-page PDFs directly from InDesign?
    robin
    www.adobescripts.co.uk

Maybe you are looking for