Script for Place PDF file into a InDesign file

Hi everyone, i need to import a PDF file into a InDesign document and in order to do this i used scripts found over  the net (e.g. Zanelli's script ecc.) but i tried this solution:
function(){
    app.scriptPreferences.userInteractionLevel = UserInteractionLevels.interactWithAll;
    var myDocument, myPage;
    if(app.documents.length != 0){
        myDocument = app.activeDocument;
    else{
        alert("No document opened");
        exit();
     if (app.selection[0] == undefined) {
        alert("Select box");
        exit();
     } else {
            var myPDFFile = File.openDialog("Select PDF:");
            if((myPDFFile != "")&&(myPDFFile != null)){
                myDocument.viewPreferences.rulerOrigin = RulerOrigin.PAGE_ORIGIN;
                myDocument.viewPreferences.horizontalMeasurementUnits = MeasurementUnits.MILLIMETERS;
                myDocument.viewPreferences.verticalMeasurementUnits = MeasurementUnits.MILLIMETERS;   
                var myData = new Array;
                myData[0] = app.selection[0].parentPage;
                myData[1] = app.selection[0].geometricBounds;
                myData[2] = app.selection[0];
                myPlacePDF(myDocument, myData, myPDFFile);
    //FUNCTIONS
    function myPlacePDF(myDocument, myData, myPDFFile){
        var myPDFPage;
        var myPage = myData[0];
        var myGeometricBounds = myData[1].toString().split(",");
        app.pdfPlacePreferences.pdfCrop = PDFCrop.cropMedia;
        var myCounter = 1;
        var myBreak = false;
        while(myBreak == false){
            if(myCounter > 1){
                myPage = myDocument.pages.add(LocationOptions.after, myPage);
             app.pdfPlacePreferences.pageNumber = myCounter;
             myRectangle = myPage.rectangles.add(undefined, undefined, undefined, {geometricBounds:[myGeometricBounds[0],myGeometricBounds[1],myGeometricBounds[2],myGeometricBounds[3]]});
             myRectangle.clearFrameFittingOptions();  
             myRectangle.frameFittingOptions.fittingOnEmptyFrame = EmptyFrameFittingOptions.PROPORTIONALLY;
             myRectangle.frameFittingOptions.autoFit = true;
             myRectangle.frameFittingOptions.fittingAlignment = AnchorPoint.CENTER_ANCHOR;
             myPDFPage = myRectangle.place(File(myPDFFile), false)[0];           
             if(myCounter == 1){
                var myFirstPage = myPDFPage.pdfAttributes.pageNumber;
            else{
                if(myPDFPage.pdfAttributes.pageNumber == myFirstPage){
                    myPage.remove();
                    myBreak = true;
            myCounter = myCounter + 1;
         myData[2].remove();  
what i would is, before the script place every single page of PDF file in the document, determine if the same page of the Pdf file is vertical or horizontal, to make the right section for the page.
Is it possible?
Thank you

Moved to scripting forum...

Similar Messages

  • Batch importing Word files into separate InDesign files

    Hi,
    I have what I though would be a fairly common question, but I can't seem to find any information about it in this forum or on the web.
    I have a folder of Word files (over 100, which is why I don't want to do this manually) and one InDesign CS4 file that I'd like to use as a template (basically it's just a couple of pages with some threaded text boxes and a few images). I would like to write a script that will go through the Word files, one by one, and pull each into the text box in the InDesign file before saving it as a new copy (ideally with the same name as the Word file). So, if I have 100 Word files and one InDesign file in a folder, I'd like to be able to run a script and end up with 100 new InDesign files.
    I think I can deal with importing and placing the text, and saving the file again. It's mostly the question of using javascript to go through a folder to find all of the filenames so that I can pass the name to the import file command that is confusing me.
    Oh, I'm on a Mac with OS 10.6 and using InDesign CS4.
    Thanks!

    Before reinstalling (which is most often unneeded) it would be useful to test the way the app behave when it is used in an other User Account.
    If it behave flawlessly, no need to reinstall it.
    If it doesn't, it *_may be useful_* to reinstall it but it's not sure.
    Nothing prove that the problem is really linked to the installed application's files.
    It may be linked to a file built on the fly like preferences or fonts cache…
    Yvan KOENIG (VALLAURIS, France) vendredi 3 décembre 2010 15:55:58

  • How do I import multiple Ai files into one Indesign File - whilst still keeping the Ai Files editable and up dateable for the one Indesign File?

    Hi All,
    Im relatively new to Ai and Indesign, and have been doing Uni work over Christmas, and have a rather urgent question thats stressing me out.
    I originally had many art boards in my ai file, but due to the number, I split these into single files to help my computer run better.
    Now I want to organise them into one document to save. From searching online Indesign can import these and save as one file, yet automatically update if the original ai file is updated. I would like to do this but just don't know how to do this correctly?
    Any help would be greatly appreciated.
    Im using CC Ai and indesign.
    Thanks in advance
    Sam

    Yes, effectively I would like to catalogue the files into one collection so i can save as one PDF and Print as one.:)
    I know I could save each AI as a pdf them then merge the pdf's together in acrobat, but I have nearly 100 files so would feel more comfortable seeing them all together before print / saving.
    My concern is that if I insert them in Ai, will the file resolution reduce? and will the ai still be editable and would it update the indesign file?
    Thanks for the quick reply

  • How to collect InDesign files into one InDesign file

    Hello,
    i need to collect a bunch of pages spread over a dozen of files into one file. The person who worked my source files found it convenient to separate a catalogue into chapters, making an individual file for each one of them. For some reason i need to make one single file of those chapters. How do i do this?
    Thanks in advance!

    You should ask in InDesign
    The Cloud forum is not about using individual programs
    The Cloud forum is about the Cloud as a delivery & install process
    If you will start at the Forums Index https://forums.adobe.com/welcome
    You will be able to select a forum for the specific Adobe product(s) you use
    Click the "down arrow" symbol on the right (where it says All communities) to open the drop down list and scroll

  • Script for Exporting 2 Pgs into 1 PDF???

    Hello, I was wondering if anyone can help me. I know there is a script that can export each page of Indesign file as a separate PDF, but is there a script out there to export every two pages of Indesign file.
    Basically what I need to do is create 300 customized documents (based on personal company information) and Export them to a PDF so that I may e-mail one to each company. The document must be two pages, the first page has the personalized (merged) information, but the second page will be exactly the same on all of them.
    Can you tell me how I can do this in Indesign, or if not Indesign, Acrobat? I ran a test with the Data Merge system in Indesign. (I created a .CSV file with 2 columns; Company Name and Company Product and took 5 five companies from the master list to test.)
    After the merge, all the fields populated correctly but I wound up with a 10 page .INDD document. (the odd number pages are the ones with all the "merged" personal info, while all the even number pages exactly the same) What I need now is every 2 pages to be exported as 1 PDF file.
    Is there is an easier way to do this? And if not in Indesign, is there an easy way to extract 2 pages at a time in Acrobat?
    Thank you very much for any help, much appreciated,
    Kevin

    Hi Kevin,<br />Here is another version.<br />copy/paste into a text editor then save as a .jsx and place it in the script folder.<br />The only thing you have to modify is the name of your pdf preset. I thought about a dialog where tou could have switched frome one preset to another easily. But it may much more efficient to just modify the name of the preset. If you want you an also make a copy with another PDF preset then rename it.<br /><br />ad = app.activeDocument;<br />pg=ad.pages;<br />var docpath = ad.filePath;<br />var docname = ad.name;<br />var nb = (Math.round(Number(pg.length/2)))<br />for(i=0; i<nb;i++)<br /><br />{<br />]var pgrgstart = (pg[(2*i)].name);<br /><br />]if(pg[(2*i+1)]==-1)<br /><br />]{<br /><br />]]var pgrgend = pgrgstart;<br /><br />]}<br /><br />]else<br /><br />]{<br /><br />]]var pgrgend = pg[(2*i+1)].name;<br /><br />]}<br /><br />]app.pdfExportPreferences.pageRange = pgrgstart+"-"+pgrgend; <br /><br />]var myPDFExportPreset = app.pdfExportPresets.item("your PDF preset"); <br /><br />b //enter the name of your PDF preset instead of your PDF preset<br /><br />]ad.exportFile(ExportFormat.pdfType, File(docpath+"/"+docname.split(".indd")[0]+"_"+"pg_"+i+"_to_"+(i+1)+".pdf"), false, myPDFExportPreset); <br /><br />}<br /><br />alert("done");

  • Embedding SWF file into an Indesign document and later export as PDF

    Hi to everybody,
    I am searching now since 3 days for good solution of my problem. First I wanna tell you that the problem is not just to convert a swf-file into a pdf.  I did this many times with all animations, page flip and stuff.My situation is the following:
    I have varios catalogues with  more or less 12 pages each in an indesign format. Now I created an animated scroll down menu, which appears on an "index-page". On the menu I created buttons. One button for each catalogue. So the idea of the whole thing is to open a document and an index page appears where you have the animated menu and you choose the catalogue you wanna see. Until here it is quite easy. I created a swf file of each catalogue with my animations (as the special page turnover e.g.). So that I just need von Object in with I can load the different swf-files of these catalogues. I already did the process. I linked the buttons to the different swf files and so. So the problem is now when it comes to convert the whole thing into a PDF. Of course I convert it first to swf and then to PDF. After converting it to swf it works 100% fine, but in PDF not, suddenly the swf-files of the catalogues disappear.
    So the summary is, that I don't know how to embed swf files into an indesign document, creat buttons and interactions next to swf file, then save it to another swf, and then to a pdf without losing the first swf files within the pdf.
    Hope I made my self clear would be too nice if someone could help me or if someone may have a better idea of realizing the whole project.

    Jeffrey,
    Thank you for the answer. As you have written:
    I will also add that the ID's play mode contol [plays once] [repeat play] does not always control the file once in Acrobat.
    I presume you mean version of ID older than CS4 or version of Acrobat Reader older than 9.1
    It that is the case I will strongly recommend my visitors to upgrade to this version.
    I hope that would work.
    Thanks again.
    Peter

  • Is there a way that you can convert a pdf file into a InDesign 5.5 file

    I want to convert a pdf file into a InDesign CS5.5. Is there anyway you can do this, or is there any software which can be downloaded that achieves good results.

    Recosoft has a converting plugin:
    http://PDF to InDesign, Convert PDF to InDesign, PDF to InDesign converter

  • How to insert a PDF document into a Word file?

    I'm using Acrobat Standard 9 and Microsoft Word 2010 and I'm unable to insert a PDF document into a Word file. Operating system is Windows 7 Enterprize. Can someone help?

    Thanks for the reply, Bill. 
    Yes, let me elaborate further:
    I have a four page document in WORD with instructions. Examples of the instructions are in PDF files. I want to insert each PDF example next to or below each line item in WORD.The PDF will open when clicking on the icon without having a hyperlink attached to it.  

  • How to include several PDF documents into just one file?

    I have a Word document with 6 pages that I saved in PDF.
    I wanted to transform the entire document in JPEG (JPG) immage, so that I could use it in other tools, such as Facebook for example.
    The problem is that using Adobe Photoshop it opens and saves page by page.
    Can you give me s solution or hint?
    Flavio
    [email protected]

    Thank you!
    I already saved all pages as .pdf w/ Acrobat and have all 6 pages saved in
    .jpg, using Photoshop.
    Problem is that I want to post the whole text in my Facebook page, and to
    have it in six pieces is not quite readable...
    Thanks anyway and have a joyful Xmas!
    2011/12/24 try67 <[email protected]>
       Re: How to include several PDF documents into just one file?  created
    by try67 <http://forums.adobe.com/people/try67> in Adobe Reader - View
    the full discussion <http://forums.adobe.com/message/4102594#4102594>

  • Convert a PDF File to an Indesign File

    Can I convert a PDF File to an Indesign file.
    Yvonne

    Another way is to use Acrobat's built in conversion to Word or rtf and import that back into InDesign.
    Either way, remember that PDF is a final form file format in which the original layout program docment's contexts such as what is an article, frame, paragraph, sentence, etc. are not maintained. All PDF maintains is content at a particular position on a particular page. As such all attempts to return such content to an editable format achieves somewhat mixed results.
    - Dov

  • How do I combine several pdf files into a single file (MAC OS)?

    How do I combine several pdf files into a single file ?
    MAC OS 10.6.8
    Adobe Reader 11.0.10
    Signed: Ken, in Utah

    Not possible with Reader. You need Acrobat or a subscription to something like PDF Pack to do it.

  • Move group of pages from one InDesign file to another InDesign File using VB.Script

    Dear team,
    I am trying to move group of InDesign pages from one indesign file to another indesign file using vb.script.
    I have written the code like
    Dim Pages=IndDoc.Pages
    Dim Mytype=TypeName(Pages)
    Pages.Move(InDesign.idLocationOptions.idBefore,IndDoc1.Pages.LastItem)
    but it is giving an error as method Move is not a member of Pages 
    please give mme the solution to move the Multiple pages or a group of page from one Indd to another Indd.

    Hey Peter, if I wan to move several page that part of Auto Flow text, I checked the "delete page after moving" but the content still there, not deleted.
    Is there any way to delete it automatically, just to make sure I have moved that autoflowed page?

  • Why would a commercial printer ask for Illustrator native files instead of InDesign files?

    Why would a commercial printer ask for Illustrator native files instead of InDesign files?
    For example, We create 32 hang tags for the same brand. Each hang tag looks identical except for a color bar calling out the different fits. We set the files up in InDesign with a Master Page congaing all the similar artwork. This process saves us a lot of time when making changes to the entire package of hang tags. So my question is... why can't the printer use InDesign. They are saying they convert our InDesign files to Illustrator before printing.

    A printer who insists on native files but can't take InDesign is not properly equipped. It suggests they haven't updated their capabilities in 15 years.

  • Can I convert a PDF back into a PUB file?

    Can I convert a PDF back into a PUB file?

    Use Acrobat XI (Pro or Standard) to export the PDF to Word.
    Use Calibre to bring the Word file into ePub.
    Be well...

  • Creating an illustrator file from an indesign file

    Is there any way of exporting or turning an indesign file into an illustrator file. Not by exporting as a PDF or an EPS and then opening that in illustrator. I mean that in one step (through a third party plug-in in indesign maybe) an indesign file can become an actual illustrator file, headers and file icon looks like an illustrator file etc?
    Thanks, Tim

    I'll try and clarify as best I can. My hands are a bit tied with confidentiality rules at my company. I guess the best way to put this is we have an automated workflow using indesign server. We want to supply some of our products as actual illustrator files but all our assets are indesign files.

Maybe you are looking for

  • ALV:   how to display only subtotals lines in theoutput

    hi in the alv list output if we display subtotals based on 3 feilds out of 10 we see subtotals (sum) based on the end of each field now i want to display only the lines which are displayed as subtotals in the output we have parameter totals_only(1) t

  • Adobe Acrobat X does not convert pdf to Excel with floating columns!

    I have a Macbook Pro, running 10.6.8, using Acrobat X Pro.  I have tried all Adobe suggestions for converting credit card statement saved as Adobe pdf to Excel.  None of the recommended solutions separate the data into columns.  It places all data, s

  • How can I make NETRIS listings work on Firefox.

    I have always kept NETRIS on Internet E because it will not work on Firefox. Some of the buttons will not work. A tech guys said yesterday that it now works and to ditch internet E because it causes problems. But I still cannot get the search etc. bu

  • Share the SVG pie...

    HTMLDB's charting ability and the ease of it is one of my most favorite. I'd like to be able to display simple 2-D SVG pie chart in my app on 8i so I can get away from the nasty dependency on "M$ Web Component" ... i am wondering if you could be so k

  • Problem Installing Windows 2008 R2 in BladeCenter HS21 in IBM Storage DS3400

    Please someone help me .. Hi I have problems installing Windows Server 2008 R2 on BladeCenter H (HS21) using IBM Storage DS3400 (fiber) I can map the drive to Hojilla HS21, and the installation wizard start Windows Server 2008 can see the mapped achi