Place pdf into InDesign CS4 js

Hi, I have those lines of script that place the pdf into InDesign, but in the process new frame gets created in which the pdf is placed, and I need it to be placed into my existing frame. How could I do it:
    var myRectangle = myDoc.pages[0].rectangles[0];   
    myPage = myDoc.pages[0];
    myPDFPage = myPage.place(File(myFile), [0,0])[0];
Thank you very much for your help.
Yulia

Yes, you are right, I am stuck for a different reason, it does places the second page.
What I think is going on,  and maybe there is a better approach to it than the one I am going about it: when I have single page pdf for the 1st page and single page pdf for the 2nd page, my script first tries to upload 1st pdf as multi-page just in case there is only one pdf with both files. And for some reason it uploads single page pdf twice (into the second InDesign page as well when there is no second page in the 1st pdf [If I could avoid that all together would be great]). So my script verifies if the pdf uploaded into the 2nd page is 1st page of 1st pdf then it deletes it. And then it looks if there is a file for the second page, and uploads it. So my new challenge is that when it verifies what page of the pdf is uploaded into the 2nd page of InDesign after the 1st pdf upload, it just crashes, and it worked with the previous way of placing pdfs (the green line of the script).
The second my issue is that, as it places the files, it dis-attaches the frames from the master page, and I need them to be still half attached. For the same reason new frames created by place command - is a problem for me. Maybe easier way, if it's possible at all, half-attach those new frames to the Master page afterwords. (This is the main goal for me).
Here are both functions: to upload first pdf and second pdf:
function myPlacePDF(myDoc, myFile){
    app.pdfPlacePreferences.pdfCrop = PDFCrop.cropMedia;
    // page 1
    myPage = myDoc.pages[0];
    var myRectangle = myDoc.pages[0].rectangles[0];   
    app.pdfPlacePreferences.pageNumber = 1;
    myRectangle.place(myFile);
    //PDF.place (myFile);
    //myPDFPage = myPage.place(File(myFile), [0,0])[0];
    myRectangle.geometricBounds = [0, 0, myGB_Y2, myGB_X2];
    // page 2
    myPage = myDoc.pages[1];
    var myRectangle = myDoc.pages[1].rectangles[0];
    app.pdfPlacePreferences.pageNumber = 2;
    myPDFPage = myRectangle.place(myFile);
    //PDF.place (myFile);
    //myPDFPage = myPage.place(File(myFile), [0,0])[0];
    myRectangle.geometricBounds = [0, 0, myGB_Y2, myGB_X2];
    if (myPDFPage.pdfAttributes.pageNumber != 2){
        myPDFPage.parent.remove();
    try{
        var myFrame = myDoc.pages[0].rectangles[1];
        if (myFrame.isValid == true){
            myFrame.remove();
    catch (e){}
    try{
        var myFrame = myDoc.pages[1].rectangles[1];
        if (myFrame.isValid == true){
            myFrame.remove();
    catch (e){}
    app.pdfPlacePreferences.pageNumber = 1;
function myPlacePDFback(myDoc, myFile){
    var myFrame= myDoc.pages[1].rectangles.[0];
    if (myFrame.isValid == false){
        myDoc.pages[1].rectangles.add();
        myFrame.strokeWeight = 0;
        myFrame.geometricBounds = [0, 0, myGB_Y2, myGB_X2];
    app.pdfPlacePreferences.pdfCrop = PDFCrop.cropMedia;
    myPage = myDoc.pages[1];
    var myRectangle = myDoc.pages[1].rectangles[0];
    app.pdfPlacePreferences.pageNumber = 2;
    myRectangle.place(myFile);
    //myPDFPage = myPage.place(File(myFile), [0,0])[0];
    app.pdfPlacePreferences.pageNumber = 1;
Kasyan, your script might be helpful, and I would like to look into it.
Thank you very much for your help.
Yulia

Similar Messages

  • CS3 and Delphi: Place pdf into indesign

    Hello,
    I am developing a script with Deplhi  that automates the creation of documents.
    I would like to be able to place pdf documents in an InDesign document. I adapted a script that I found in this thread: http://forums.adobe.com/message/3013174
    I only had to define the proper types for the variables, cause Delphi doesn't allow untyped variables. There was one line in particular that I had to modify thoroughly:
    myPDFPage = myPage.place(File(myPDFFile), [0,0])[0];
    The PlacePoint parameter had to be an array of double, and the missing parameters had to be set. Eventually, the following code worked:
    var
      APoint:      array of double;
    begin
      SetLength(APoint, 2);
      APoint[0] := 0;
      APoint[1] := 0;
      myPage.place(Filename, APoint, ActiveDocument.Layers[1], false, false);
    In the original script, the result of the place function is assigned to the variable myPDFPage, and I am having troubles to get this assigment working. Often the TypeLib uses OleVariants and you have to figure out by ourself which type(s) are allowed and have to be used, and which type cast(s).
    In the original script this code follows:
    myFirstPage = myPDFPage.pdfAttributes.pageNumber;
    The only interfaces in the TypeLib that have a property called pdfAttributes are PDF and ImportedPage. But neither of those types work if I define pdfAttributes to be of that type. I am not sure whether the fact that place seems to return an array adds additional problems. Most of the times, arrays from in TypeLib are based in the index 1, not zero.
    But I tried
    var
      APoint:      array of double;
      myPDFPage:   PDF;
    begin
      myPDFPage := PDF(myPage.place(Filename, APoint, ActiveDocument.Layers[1], false, false)[0]);
    and
    var
      APoint:      array of double;
      myPDFPage:   ImportedPage;
    begin
      myPDFPage := ImportedPage(myPage.place(Filename, APoint, ActiveDocument.Layers[1], false, false)[0]);
    and the same with and array index of 1 instead of 0, and without any index. But none of it would be compiled without an error.
    Doies anybody know how that command line has to be or which type myPDFPage has to have?
    And more generally: How could I determine the possibla types of a parameter, variable or return type that is an OleVariant in the TypeLib?
    I found some InDesign CS3 scripting specific pdfs here: http://www.adobe.com/products/indesign/scripting/, but no complete reference of all functions and types.
    Best regards,
    Christian Kirchhoff

    In order to make the code compilable, I had to do a double typecast. The result of the place function - in the Typelib - is OleVariant, and I couldn't use the snytax place(...)[0]; directly.
    So I declared a variable myPDFPages as an array of PDF, and assigned the entiry result of the place function to that.
    The new code is:
    var
      APoint:      array of double;
      myPDFPages:  array of PDF;
      myPDFPage:   PDF;
    begin
      myPDFPages := myPage.place(Filename, APoint, ActiveDocument.Layers[1], false, false);
      myPDFPage := PDF(myPDFPages[0]);
    But: allthough the code compiles, the line myPDFPages :=... throws an error (after the pdf is inserted in InDesign).
    If I just use execute the place command without assingning the result to anything, it works without an error. But the code I copied from the aforementioned forum thread uses the result, and so want I.
    I'll do some further testing on this.
    Best regards
    Christian

  • Can't Place a specific Word 2010 docx into InDesign CS4

    I'm trying to use the Place command to bring the text from a specific Word 2010 docx into InDesign CS4.
    I've successfully brought in several Word 2010 documents (docx extention) to InDesign CS4 documents using the place command.
    I have one specific 30 page document (which is no loarger than others which have been successful), and when I use the place command with this file, nothing happens (and no text gets loaded onto the cursor for placement.
    I've tried re-saving the word doc, even pasted its contents into a new Word doc and still can't get the Place command to work.
    THere's nothing particularly unique about the file - doesn't have any odd embedded content, just a 30 page text document writtin in word.
    Any ideas what could be going wrong or how to fix it?
    I've tried restarting both Word and InDesign without any change (and the rest of my word files can be Placed without problem, so I imagine it's something specific to that file.
    NOTE - re-saving in RTF format lets the Place command work but leaves a bunch of empty squares/boxes (not sure if these were for tabs or empty spaces or what really??)
    Can work around this for now, but would like to know how to get the place command working with decent size Word Docs( docx for word 2010 if that matters).
    Thanks for any help.

    It turned out that for at least one particular document the OP had used some blank paragraphs as spacers at the start of the text, and that the style assigned to the second paragraph used a combination of left and right paragraph indents that was more than the width of the document page, sending the entire document (except for the empty first paragraph) into overset. I can't say for sure, but I think the Word styles might have been mapped to ID styles because I found no trace of the indents in the Word file itself, only in the ID document, and I had no trouble placing that Word file in my own ID test document. I did have some trouble placing another .docx file supplied by the OP in CS4, but not in later versions, and conversion to .doc solved that problem.

  • How do I import a .PDF into inDesign?

    How do I import a .PDF into inDesign? Does anybody know how? I need to edit a book in inDesign that is a .PDF. So if anyone know how to do that please tell me.

    Bob, Peter, grmg, many thanks for your very helpful comments.  Delighted mac/pc not relevant.  Will scratch that from list of herrings to chase.
    Re PDFs - actually, I'm working in Acrobat (not just a finalized PDF), and Acrobat does of course allow editing of a sort; I'd concluded that since Adobe is willing to tolerate that degree of editing with its product, it should therefore tolerate moving its native format (*.pdf) into another of its own native formats (*.indd). I see that's a misconception.
    This morning I tried all flavors I could find of getting my Acrobatted content into ID3, including copy/paste, place, and import (from the ID side); none was satisfactory.  Output from Acrobat to Word and then placing Word was fine for English but destroyed the Greek - not just wrong font, but complete gobbledygook and loss of all diacriticals.  Names of fonts don't matter for my purposes; the legibility of the English, and the legibility and tonic accuracy of the Greek do matter. Author of this project is not tech-savvy and is using old Greek system as well; nothing he or i can do to fix that.
    Current plan is to request author to provide me his native files, which will be Mac files.  Am I understanding the Import dialog and your collecitve comments to suggest that with that file resident on my PC (and unopened), I can use the Place dialog, with "Show Options" selected, to get the Mac file into ID?
    Chapeaux to those of you with constructive comments - hugely appreciated.
    YC

  • 3D PDF into InDesign

    I am trying to place a 3D PDF into Indesign but it just comes up as "Enable 3D view" What does that mean and what do I need to do differently?

    InDesign's implementation of the PDFLib engine doesn't support 3D annotations or scripting.

  • Export interactive pdf with InDesign CS4 (linked avi)

    Hello
    I've exported an avi linked video to pdf from InDesign CS4. Video is playing but I have a few questions.
    1. Any way to get around the security stuff in Acrobat? Allow blocked content blocked, etc. without user needing to allow.
    2. Does the export degrade (lower) video quality if the video is linked? End user said video quality was poor.
    Thanks.
    Dave

    Current Acrobat versions will have security issues. The only way I know is to go into Acrobat's preferences for Multimedia, Trust Manager and Security to allow from certain sources. I haven't done that, so you should probably ask advice on the Acrobat forum.
    Linking video should have no effect on quality. It's all in how you've encoded the video.

  • Using CC2014, I have a psd with smart objects. I would like to place it into indesign along with type

    Using CC2014, I have a psd with smart objects. I would like to place it into indesign along with type & logos. I would like to then export a pdf from indesign hoping that the smart objects stay as vector. Exported a pdf 1.7, but everything rasters. Writing a postscript gives the same results. Any help?

    Using CC2014, I have a psd with smart objects. I would like to place it into indesign along with type & logos. I would like to then export a pdf from indesign hoping that the smart objects stay as vector. Exported a pdf 1.7, but everything rasters. Writing a postscript gives the same results. Any help?

  • Can't place pdfs in InDesign CC

    Can't place pdfs in InDesign CC as before - message comes up "Cannot crop to bleed box is not defined, or is empty." What happened?

    That's a new improved error message apparently. The old one just said
    Can't Place PDF (not very helpful, either).
    The options are sticky so the prior PDFs must have had bleed.
    In any event, I'm glad you got it sorted.

  • Export a pdf in Indesign CS4 grayscale cropmarks not register

    I export a high quality pdf from indesign CS4 and I noticed that my crop marks are coming out in grayscale not register.
    Any Ideas

    Yes I have pro. When I look at preview I see what you are talking about. Its weird. When I have acrobat open and click the crop mark pitstop tells me the crop is grayscale but when I go to the preview window the crops are there in each color

  • Acrobat 5 - Placing PDF into inDesign and Output to Colour Separations are Wrong

    Acrobat 5 - Placing PDF into inDesign and Output to Colour Separations are Wrong
    I have a 2 Page PDF file from my client which I have to have setup 2UP on 450x320 for Metal Plates for the Press.
    I setup my page size in inDesign and Placed each page from the PDF file into the inDesign Document.
    Because I need 4 Metal plates (CMYK) I had to check the Colour Seperations for the file by outputting it to a Postscript file with CMYK SEPS and then using Adobe Distiller to turn it into a PDF file for me to view the Seperations.
    As I've shown in the screen shot below. The CYAN plate has boxes all around the images in the PDF file which will come out on a Metal Plate.
    Compared to the Colour version of the Client's PDF they supplied me, there is no boxes around the images.
    I know this is a error with dropping a PDF file into inDesign, outputting to a PS file and then Distilling it to the SEPS. I've had the same problem when I've opened a PDF file that has been distilled in Illustrator and the Artwork is sliced into pieces and uneditable.
    Has anyone else found this problem and if so is there a workaround?
    I'm using Adobe inDesign CS and Adobe Acrobat Professional Version 5.

    Im facing a similar kind of problem. I want to store and retrieve Office files, PDF and Jpegs into/from the database to view them on web in disconnected mode. Please reply as I cant find any help/documentation regarding saving BLOB data into files. I was able to store file data into BLOB, using DBMS_LOB package.
    Shahzad

  • Place all pages in pdf into indesign

    I want to place all pages in a pdf file into indesign, I mean need to load all pages in a pdf in single place method and place every pages individually on iterating through pages in indesign.
    Note: Manually this can be done by enable "Show import option",which opens preference window in which we can prefer to ALL option under PAGES menu under GENERAL tab while preforming Place pdf.

    You are finding PlaceMultipagePDF.jsx script and here is it for you
    //PlaceMultipagePDF.jsx
    //An InDesign CS3 JavaScript
    //Places all of the pages of a multi-page PDF.
    //For more on InDesign scripting, go to http://www.adobe.com/products/indesign/xml_scripting.html
    //or visit the InDesign Scripting User to User forum at http://www.adobeforums.com
    //Display a standard Open File dialog box.
    var myPDFFile = File.openDialog("Choose a PDF File");
    if((myPDFFile != "")&&(myPDFFile != null)){
         var myDocument, myPage;
        if(app.documents.length != 0){
            myDocument, myNewDocument = myChooseDocument();
        else{
              myDocument = app.documents.add();
              myNewDocument = false;
        if(myNewDocument == false){
             myPage = myChoosePage(myDocument);
        else{
            myPage = myDocument.pages.item(0);
        myPlacePDF(myDocument, myPage, myPDFFile);
    function myChooseDocument(){
        var myDocumentNames = new Array;
        myDocumentNames.push("New Document");
        //Get the names of the documents
        for(var myDocumentCounter = 0;myDocumentCounter < app.documents.length; myDocumentCounter++){
            myDocumentNames.push(app.documents.item(myDocumentCounter).name);
        var myChooseDocumentDialog = app.dialogs.add({name:"Choose a Document", canCancel:false});
        with(myChooseDocumentDialog.dialogColumns.add()){
            with(dialogRows.add()){
                with(dialogColumns.add()){
                    staticTexts.add({staticLabel:"Place PDF in:"});
                with(dialogColumns.add()){
                    var myChooseDocumentDropdown = dropdowns.add({stringList:myDocumentNames, selectedIndex:0});
         myChooseDocumentDialog.show();
        if(myChooseDocumentDropdown.selectedIndex == 0){
            myDocument = app.documents.add();
            myNewDocument = true;
        else{
             myDocument = app.documents.item(myChooseDocumentDropdown.selectedIndex-1);
            myNewDocument = false;
        myChooseDocumentDialog.destroy();
        return myDocument, myNewDocument;
    function myChoosePage(myDocument){
        var myPageNames = new Array;
        //Get the names of the pages in the document
        for(var myCounter = 0; myCounter < myDocument.pages.length;myCounter++){
            myPageNames.push(myDocument.pages.item(myCounter).name);
        var myChoosePageDialog = app.dialogs.add({name:"Choose a Page", canCancel:false});
        with(myChoosePageDialog.dialogColumns.add()){
            with(dialogRows.add()){
                with(dialogColumns.add()){
                    staticTexts.add({staticLabel:"Place PDF on:"});
                with(dialogColumns.add()){
                    var myChoosePageDropdown = dropdowns.add({stringList:myPageNames, selectedIndex:0});
        myChoosePageDialog.show();
        var myPage = myDocument.pages.item(myChoosePageDropdown.selectedIndex);
        myChoosePageDialog.destroy();
        return myPage;
    function myPlacePDF(myDocument, myPage, myPDFFile){
         var myPDFPage;
         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;
              myPDFPage = myPage.place(File(myPDFFile), [0,0])[0];
              if(myCounter == 1){
                   var myFirstPage = myPDFPage.pdfAttributes.pageNumber;
              else{
                   if(myPDFPage.pdfAttributes.pageNumber == myFirstPage){
                        myPage.remove();
                        myBreak = true;
              myCounter = myCounter + 1;
    Shonky

  • Cannot print to Adobe PDF from InDesign CS4 under Snow Leopard (10.6.2)

    Hello All,
    Hopefully the subject line says all. Running SL and CS4, and after manually deleting the "old" Adobe PDF 9.0 driver, I am unable to print to PDF — or select "Save As Adobe PDF" under the Mac OS print dialog. This is insanely frustrating on may levels, as this was once a 3-minute operation and now has stretched into two days of futile searching for a solution.
    There is a "tech doc" somewhere out there that offers a "solution". But beware, as it has not worked for me. Once you manually search for and remove the Adobe PDF 9.0 driver, you are supposed to magically be able to select the "Save As Adobe PDF" option. This is not the case for me.
    Am trying to print, once again, from InDesign CS4 (NOT via the Export command as that will not allow me to set page size, or print separations). There is no Adobe PDF driver there anymore and there is no option to print PDFs. Of course, I can rest easier with the knowledge that everything is easier now in SL.

    For a long time I was printing out of InDesign CS4 to a PS file and Distilling to a PDF, either composite or separated. Then Snow Leopard came along and that workflow seemed no longer available. It seems some well meaning people didn't understand a professional DTP workflow.
    I had to work between two Macs to create a project and then make separations.
    Eventually I went back to the Adobe InDesign forums and folks insisted that a Adobe PDF 9 printer should be available in my print drivers.
    On that suggestion I completely uninstalled Adobe Acrobat Pro 9 and then reinstalled it.
    It worked, I had the PDF printer back and can now print to a postscript file and do separations as I always have.
    (Another story is that Snow Leopard killed my Epson 2200 printer)
    At one stage I did an update of Acrobat 9 and it caused me to lose the Adobe printer again. Going through the procedure again brought it back and this time after a Acrobat 9 update it stuck.
    In my opinion somebody screwed up. It's not enough to be able to create PDFs out of Microsoft Word. There are people out here trying to make a living and need to be able to create print separations for some offset printers.

  • Special letters do not export to PDF from InDesign CS4

    I have just installed Indesign CS4 and gathered all the fonts I needed from my old computer. Everything has gone well until I tried to export my document to PDF. The PDF showed the Icelandic special "Ð" and "Þ" letters as a missing letter, a white space or a simple box. This only happens in several typefaces, namely Helvetica Neue, Cohin and Times. (and maybe some others). Note that the special letters are shown in InDesign. I reckon that there is some problem whit the export… Can anybody help me?

    You can check the "Advanced" section when you export the PDF to make sure that fonts are being embedded. Both d-with-bar and thorn are part of the glyph complement of Helvetica Neue, so either the font is not being embedded, or something is wrong in ID. You can also go to the "Composition" section of the Preferences and put a check into the "Substituted Glyphs" box to make sure that the d-with-bar and thorn that are appearing in your ID doc are actually part of the font (which they should be).

  • Problem Importing a PDF into Indesign CC

    We don't usually have this problem with InDesign CC, but this came at a very bad time and I'm not sure if it is a bug in InDesign CC or not. We were given a PDF from an auditor of a client to bring into their financial report. The strange thing is that we were only able to bring in pages on left pages, any page that was brought in on the right hand page did not show. In fact, if we copied a page that showed up on the left page and moved it to the right page, it would not show it.
    Fortunately we still have CS6 and we were able to place the same PDF with no problem. So we had to save the document into a CS6 format and then insert the PDF.
    I don't know what would have caused this, but we haven't had problems with other PDFs. It seems that there was something about that PDF that InDesign CC didn't like (but that CS6 was able to handle).
    Any ideas?

    I think we'd need to see samples from the actual .indd and PDF files to give you any real answers.

  • How do you make the smallest pdf from InDesign CS4 but retain some sharpness?

    I have a 2 page brochure, front and back with layered photoshop files and when I make the small pdf I need to make a 100kb file like a client has done in the past. The smallest I can make the pdf file is 460kb.  It will not go smaller no matter what I do. Of course I can enter final resolution as 72 dpi but the photos become very fuzzy. I have even reduced the file sizes of the photos and replaced them in the document. The file size remains the same.  My client said that Illustrator reduced the size for him smaller in the past but I don't think that is the solution.  How do you retain some sharpness in a pdf but keep the file size at a very minimum?

    But InDesign CS4 outputs the file no matter what at 460 kb for me. 
    Still don't know why they got 100 kb.
    By not using InDesign. Scott is on the right track by mentioning Distiller - which makes PDFs that are smaller than what InDesign can export. Illustrator can be used (improperly*) in the same way. Both methods can strip out stuff that you don't need if you don't care about printing quality, don't care about reliable display across multiple platforms, don't care about precisely how your fonts are embedded, don't care about the lawsuit that the blind people using screenreaders are going to bring against you, and so on. I don't know which of the above is not in your client's 100k file, or which of the things in my above list will be stripped out by using Distiller or Illustrator, but I bet that one of the people who has already posted in your thread does know, and might be talked into telling us.
    But, if you're trying to make your client happy and aren't actually personally invested in making the smallest PDFs known to man, and if you're located in the US, then perhaps the phrases "screenreaders... blind... accessibilty... lawsuit" spoken together might induce your client to rethink this arbitrary desire for miniscule file size of PDFs.
    Alternately, you could just save postscript out of both PDFs and just look at the .ps files in your favorite raw-text viewer.
    * I'm surprised that Adobe Employee Dov Isaacs hasn't come along to tell us what a bad idea this is.

Maybe you are looking for

  • Crystal Reports for Eclipse 2.0 - Service Pack 1 - is Now Available!

    Service Pack 1 for Crystal Reports for Eclipse 2.0 is now available! Readme file listing the fixes is here: [http://downloads.businessobjects.com/akdlm/crystalreportsforeclipse/2_0/cr4ev2_readme.pdf] Kirby Leong in another post listed the download UR

  • Disable Sales Group in Sales tab in Header of Sales order

    Dear Frineds, My Requirement:          1. Display the Sales Group in Initial Screen of Sales Creation VA01          2. Display Mode of Sales Group in Header > Sales Tab. I have used SHD0 for screen variant. and able fulfill the first point but in cas

  • Dynamic Configuration for IDOC

    Hi, Whenever an IDOC is send from SAP R3 system to PI (SAP R3 -> SAP PI -> Target), we get an additional node of Dynamic Configuration under the SOAP Header in SXMB_MONI. Why is this happening? Does this happen for all the versions of SAP XI (PI)? Th

  • Account inaccessible .. operation does not support device

    iMac, Core Duo 20" 2Gig RAM Since update to 10.4.10 using combo update... trying to log on to a guest account crashes the system to black screen with white system prompt: '...operation not supported by device.' I hold the power button for 5 seconds t

  • Nokia N8 gallery and video doesn't work :(

    Hello, Just today bought Nokia N8, updated to Symbian Belle and tried to open gallery but it only shows black screen and nothing works, i tried open pictures by file manager but it won't open... PLEASE help!