[AS] Get bounds of PDF before it is placed

Hi
I have a PDF which is chosen via a list, from this list I place the PDF into my ID document.
My question is, how can I/do I  get the geometric bounds of the PDF before it is placed?
    tell application "Finder"
                set _list to name of items of folder _path whose name ends with ".pdf"
                activate
                choose from list _list with prompt "Select PDF" default items item 1 of _list
                set userchoice to item 1 of the result
                set _itempath to _path & userchoice
                set _itemalias to alias _itempath
                set PicList to _itemalias
            end tell
tell application "Adobe InDesign CS4"
    activate
    set x to (display dialog "How many pages to place:" with icon caution buttons {"1", "2", "Cancel"} default button 1)
    if button returned of x is "1" then
        set page number of PDF place preferences to 1
        set PDF crop of PDF place preferences to crop bleed -- content, art, PDF, trim, bleed, media
        set transparent background of PDF place preferences to true
        tell document 1
            place PicList as alias on page 1
            fit rectangle 1 given center content
        end tell
    end if
end tell
Cheers
Kev

what I am trying to do is get the geometric bounds before placing the PDF so I can use the "place point" command to place the image in a certain area, rather than placing the image, then getting the bounds, then moving my item to it's location.
Yes you are right, none of my pages will be the same size, so using place point without knowing the bounds is a bit tricky.

Similar Messages

  • How can I get a total page count of a PDF before placing every page in the PDF?

    Before the [long] spiel, I'm using javascript in InDesign CS3.
    I'd like to create a script that places a multiPage PDF in any number of different impositions. (saddle stitch, 4up signatures, 16up signatures etc.)
    I've easily created a script that iterates through a PDF and places it into a new document as (4,1|2,3), (8,5|6,7) etc, which works for printing in duplex, folding each page in half, and gluing the resulting spines to make a simple thick book (for PDFs with more than, say, 64 pages).
    However, the next step is to re-write the script to create a saddle stitch document (16,1|2,15), (14,3|4,13) ... (10,7|8,9). For this I need to know how many pages there are in the PDF before I start placing the PDF pages, and then making the new document [int((PDFpages+3)/4)] pages long.
    Is there a simple way to get the count of PDFpages without going through a loop and placing the next page from the PDF until the placed page number equals the first page number?
    This way seems wasteful:
    var totPDFPages = 1;
    app.pdfPlacePreferences.pageNumber = totPDFPages;
    myPDFPage = sheetFront.place(File(srcPDF), [0,0])[0];
    var pdfFirstPage = myPDFPage.pdfAttributes.pageNumber;
    while (doneCounting == false) {
    totPDFPages += 1;app.pdfPlacePreferences.pageNumber = totPDFPages;
    myPDFPage = sheetFront.place(File(srcPDF), [0,0])[0];
    if (myPDFPage.pdfAttributes.pageNumber == pdfFirstPage) {
    totPDFPages -=1;
    doneCounting = true;
    alert("PDF has " + totPDFPages + " pages!");exit();
    myPDFPage.remove();
    NB. Javascript above *hasn't* been run, but should look similar once debugged.
    The only thing I've though of to relieve the sheer duplication of placing the PDF twice (once for the count, and once for the imposition), is to create an array of impoPages[counter]=myPDFPage, and then shuffle the pages referenced by the array to the correct sheet and position.
    It'd be much easier to be able to assign pageCount = File(srcPDF).pageCount !!!
    Thanks for any help/tips or even a simple "What are you smoking, man!?"
    Cheers,
    Jezz

    this will get almost all pdf pages count.
    jxswm
    function getPDFPageCount(f){
      if(f.alias){f = f.resolve();}
      if(f == null){return -1;}
      if(f.hidden){f.hidden = false;}
      if(f.readonly){f.readonly = false;}
      f = new File(f.fsName);
      f.encoding = "Binary";
      if(!f.open("r","TEXT","R*ch")){return -1;}
      f.seek(0, 0); var str = f.read(); f.close();
      if(!str){return -1;}
      //f = new File(Folder.temp+"/123.TXT");
      //writeFile(f, str.toSource()); f.execute();
      var ix, _ix, lim, ps;
      ix = str.indexOf("/N ");
      if(ix == -1){
        var src = str.toSource();
        _ix = src.indexOf("<< /Type /Pages /Kids [");
        if(_ix == -1){
          ps = src.match(/<<\/Count (\d+)\/Type\/Pages\/Kids\[/);
          if(ps == null){
            ps = src.match(/obj <<\\n\/Type \/Pages\\n\/Count (\d+)\\n\/Kids \[/);
            if(ps == null){
              ps = src.match(/obj\\n<<\\n\/Type \/Pages\\n\/Kids \[.+\]\\n\/Count (\d+)\\n\//);
              if(ps == null){return -1;}
              lim = parseInt(ps[1]);
              if(isNaN(lim)){return -1;}
              return lim;
            lim = parseInt(ps[1]);
            if(isNaN(lim)){return -1;}
            return lim;
          lim = parseInt(ps[1]);
          if(isNaN(lim)){return -1;}
          return lim;
        ix = src.indexOf("] /Count ", _ix);
        if(ix == -1){return -1;}
        _ix = src.indexOf(">>", ix);
        if(_ix == -1){return -1;}
        lim = parseInt(src.substring(ix+9, _ix));
        if(isNaN(lim)){return -1;}
        return lim;
      _ix = str.indexOf("/T", ix);
      if(_ix == -1){
        ps = str.match(/<<\/Count (\d+)\/Type\/Pages\/Kids\[/);
        if(ps == null){return -1;}
        lim = parseInt(ps[1]);
        if(isNaN(lim)){return -1;}
        return lim;
      lim = parseInt(str.substring(ix+3, _ix));
      if(isNaN(lim)){return -1;}
      return lim;

  • How to remove the warning "do you want to save changes to investigation.pdf before closing"

    Issue: To remove the warning "do you want to save changes to investigation.pdf before closing"
    I have created a XFA pdf file(using LC Designer 8.2) to display this issue
    I am not able to attached the PDF. Without attaching the pdf it would be difficult to explain.
    click event js:
    function activateUser() {
      var PDFVersion=xfa.host.variation+xfa.host.version;
      xfa.host.messageBox("button click event registered");
      xfa.form.form1.sendForm.welcomeMsg.presence = "invisible";
      xfa.form.form1.sendForm.successMsg.presence = "visible";
      event.target.dirty=false;
    docReady event js:
    function displayInfo(){
    var res =xfa.host.variation;//Added this line to display the successMsg
    //xfa.host.messageBox("docReady event registered");
    xfa.form.form1.sendForm.welcomeMsg.presence = "visible";
    xfa.form.form1.sendForm.successMsg.presence = "invisible";
    docClose event js:
    xfa.host.messageBox("docClose event registered");
    event.target.dirty=false; 
    Steps to get the warning:
    1) Open the attached pdf using Acrobat Professional.
    2) Click the Confirm Enrollment" button
    3) Now close the document & the acrobat gives a warning "do you want to save changes to investigation.pdf before closing"
    Summary of the XFA pdf:
    It has two text fileds. On docReady event field A is made visisble & field B is made invisible.
    On button click event the field A is made invisisble & field B is made visible.
    On closing the pdf it should not throw this warning message.
    My Efforts:
    1) Found a property in adobe js docs.
           event.target.dirty=false;
    It doesn't solve the problem.
    2) I tried to put this logic in almost all the events listed in designer but I am not able to resolve the issue.
    Please help me resolve this issue.

    I tried putting the below 2 lines of code at the end of button click event & docClose event.
          event.target.dirty=false;
          event.target.requiresFullSave=false;
    It still gives the warning.
    Also I tried to found out the line of code which is making the pdf dirty.
      xfa.host.messageBox("is doc dirty (before displayInfo's visible-invisible work): " + event.target.dirty);
      xfa.form.form1.sendForm.welcomeMsg.presence = "visible";
      xfa.form.form1.sendForm.successMsg.presence = "invisible";
      xfa.host.messageBox("is doc dirty (after displayInfo's visible-invisible work): " + event.target.dirty);
    The doc got dirty when the successMsg field is made invisible.
    Problem I am trying to solve is:
         To display a welcome message before user action and after user action wants to display a success message.
         I follwed the visible & invisible approach & it wokred but gives me a warning on doc close.(Highly imp to avoid it)
    Is there any other approach I could follow here.

  • Safari won't allow me to see PDF's. I trashed Adobe Reader and bought PDFpen6 but I still get a black PDF in Safari. Please help?

    Thanks for reading this far... I get a black PDF in Safari and sometimes a reinstall Adobe message. I trashed Adobe Reader and got PDFpen 6. However, I still get the black PDF's What do I do? Please help?
    Bill

    Back up all data.
    Triple-click the line of text below to select it, the copy the selected text to the Clipboard (command-C):
    /Library/Internet Plug-ins
    In the Finder, select
    Go ▹ Go to Folder
    from the menu bar, or press the key combination shift-command-G. Paste into the text box that opens (command-V), then press return.
    From the folder that opens, remove any items that have the letters “PDF” in the name. You may be prompted for your login password. Then quit and relaunch Safari, and test.
    The "Silverlight" web plugin distributed by Microsoft can also interfere with PDF display in Safari, so you may need to remove it as well, if it's present.
    If you still have the issue, repeat with this line:
    ~/Library/Internet Plug-ins
    If you don’t like the results of this procedure, restore the items from the backup you made before you started. Relaunch Safari again.

  • I can't get my Dynamic PDF Widget to work in Captivate 7

    Hello all,
    I've been trying to get my Dynamic PDF to work in my Captivate 7 project. I have created a button on the final slide where I want the user to open the PDF, I have named it correctly to correspond with the Dynamic PDF. I have also updated everything within the editor to appear how I would like it to appear. I have also tried viewing it in various formats such as Published, In a Browser etc. and nothing appears to work for me.
    What am I doing wrong?
    Thanks in advance!
    Peter

    Hi Peter,
    Please make sure that the pdf is also saved in the same published folder .
    Also test the behavior in other browsers as well like Chrome and Firefox .
    If you still face this issue then try to add the published output in trusted location of Flash.
    http://helpx.adobe.com/captivate/kb/hyperlinks-do-captivate-6.html
    Thanks

  • HT204053 How to I get music I purchased before the iCloud was created to show up on my new authorized iPhone?  Right now I can only see the Apps I recently purchased on the actual phone but older music I purchased on my CPU using the same Apple ID doesn't

    How to I get music I purchased before the iCloud was created to show up on my new authorized iPhone?  Right now I can only see the Apps I recently purchased on the actual phone but older music I purchased on my CPU using the same Apple ID doesn't appear.

    Does any music show in the Purchased tab on the iTunes store app on your phone ? Music can't be re-downloaded in all countries, and even where it can be it will only appear whilst it remains in the store. Do you have your purchases on your computer and/or on a backup of your puchases so that you can sync them to your phone ?

  • How to get bounds of a component in FreeDesign layout

    When I try to get bounds of a component that is inside JPanel with FreeDesign layout, I get (0,0,0,0)!
    How can I find out current bounds of those components?

    When I add a component on JPanel with FreeDesign layout (I use NetBeans GUI editor to do it), in generated code I find org.jdesktop.layout.GroupLayout with some HorizontalGroup and VerticalGroup components, and no bounds are ever set!!! When I start the application, a component is shown on JPanel, and definitely bounds are not 0,0,0,0! The components are stretched over window, and everything looks just as I set in GUI editor. A problem is that in runtime I need to know bounds of a component that is showed on screen. A method getBounds() returns (0,0,0,0), so I think that it is not appropriate for this layout.
    So, my question remains: How to find out bounds of a component in FreeDesign layout!
    Thanks!
    Message was edited by:
    mmilic

  • While installing OD XE 11 g, I get error message just before finish

    the message is like couln't get data local {7e-ie-....) XE registration.
    I have downlaoded the zip file for win 32.
    i was told that this prg will install in my 64 bit OS (Windows 7).

A: While installing OD XE 11 g, I get error message just before finish

Hello, and welcome to the OTN forums!
i was told that this prg will install in my 64 bit OS (Windows 7).Who told you that, and why don't you ask him/her why it didn't work? (just kidding...)
In fact, XE 11.2 is currently not supported on 64 bit Windows machines. See the [url http://docs.oracle.com/cd/E17781_01/install.112/e18803/toc.htm#BABHICJH]System Requirements documented in the Installation Guide for XE 11.2.
The error you receive has been reported often when people tried to install on 64 bit anyway. There are workarounds for that issue, e. g. described in this thread: {thread:id=2289186}
-Udo

Hello, and welcome to the OTN forums!
i was told that this prg will install in my 64 bit OS (Windows 7).Who told you that, and why don't you ask him/her why it didn't work? (just kidding...)
In fact, XE 11.2 is currently not supported on 64 bit Windows machines. See the [url http://docs.oracle.com/cd/E17781_01/install.112/e18803/toc.htm#BABHICJH]System Requirements documented in the Installation Guide for XE 11.2.
The error you receive has been reported often when people tried to install on 64 bit anyway. There are workarounds for that issue, e. g. described in this thread: {thread:id=2289186}
-Udo

  • In iOS 7, how do you get your Recent PDFs to show up by default?

    In iOS 6, my Recent PDFs would show up by default whenever I opened Adobe. That is not the case with iOS 7. Is there a way to get your Recent PDFs to show up by default in iOS 7?

    Not possible with the actual version of Adobe Reader.

  • I need a help !!! Please  ,I dropped my iPhone 5 in toilet and I didn't get fast  maybe 5mins before I get it because I didn't notice drop it and it won't work now  it's almost 1week I'm waiting it  still  it don't work ...

    I need a help !!! Please  ,I dropped my iPhone 5 in toilet and I didn't get fast  maybe 5mins before I get it because I didn't notice drop it and it won't work now  it's almost 1week I'm waiting it  still  it don't work ... But when I plug my charger it goes light and show up apple logo and die again I don't know what to do and it's so expensive here at Japan pls.. Help maybe there still way to get it work again
    Thank you ,Rean

    At this point it's clear that it's been damaged and will need to be take or sent to Apple for replacement.
    Regards.

  • Mangal Fonts and Tunga Fonts in (MS Home and Student 2010) Word 2010 not getting converted into PDF

    Why do I get a totally blank PDF file whenever I try to convert any (Microsoft Office Home and Student 2010, Version: 14.0.6029.1000) Word document file containing either Mangal Fonts (Hindi) and Tunga Fonts (Kannada) into a PDF file (by using Adobe Acrobat X Standard - English, Version: 10.1.4, Program File Size: 1790 MB, Complete/Full Version) after formatting and reinstalling all the necessary software / softwares (Microsoft Windows XP, Home Edition, Version 2002, Service Pack 3 and Windows XP Service Pack 3, Version: 20080414-031525, Program File Size: 9.08 MB)?
    I'm using
    01) Microsoft Windows XP, Home Edition, Version 2002, Service Pack 3
    02) Computer: Intel(R) Pentium(R) 4 CPU 3.00 GHz 3.00 GHz, 504 MB of RAM
    03) Windows XP Service Pack 3, Version: 20080414-031525, Program File Size: 9.08 MB
    04) Microsoft Office Home and Student 2010, Version: 14.0.6029.1000, Product ID: 82503-388-0792296-26607, Program File Size: 490 MB
    05) Adobe Acrobat X Standard - English, Version: 10.1.4, Program File Size: 1790.00 MB, Complete/Full/All Version/Features has/have been installed
    06) Windows Internet Explorer 8, Version: 20090308.140743, Program File Size: 4.20 MB
    Any Word 2010 document file that has been converted into any PDF File unfortunately does not show either the Mangal (Hindi) Fonts or the Tunga (Kannada) Fonts.
    The PDF file will unfortunately become/remain totally/fully/completely blank.
    When I convert an Excel Workbook having the Tunga Fonts (Kannada) to/into a PDF File, some of the Tunga fonts in the PDF file are legible and some are unfortunately illegible (get superimposed / overwritten on each other).
    Perhaps I may get the same result if I try to convert an Excel Workbook having the Mangal Fonts (Hindi) to/into a PDF File with some Mangal fonts being/becoming legible and the rest being/becoming illegible (getting superimposed / overwritten on each other).
    Tanveer
    Syed Tanveeruddin, Karnataka, India
    Message was edited by: tanveerindian
    Message was edited by: tanveerindian
    Message was edited by: tanveerindian

    My chronological sequence of steps to create a Word 2010 Document or an Excel 2010 Workbook:
    I first create a Word Document File or an Excel Workbook File and save it by giving an appropriate file name.
    Then I right click on the closed Word Document File or the Excel Workbook File in the file folder and convert it into a PDF by retaining the same/original file name.
    The font list of Microsoft Word 2010 claims/says/states that both Mangal and Tunga are True Type fonts and also that these fonts will/would be used on both printer and screen.
    In case if there is any text content in English in the beginning it will get converted into PDF only till/until either a Mangal(Hindi)/Tunga(Kannada) Font starts.
    The remaining English text content does not get converted into/to PDF the moment a Mangal(Hindi)/Tunga(Kannada) Font starts. If the entire matter is purely (100 per cent) in English text it will fully / completely / totally get converted into a PDF file without any problem.
    Message was edited by: tanveerindian

  • Where can I get a sample pdf to test digital signature?

    I am trying to test my digital signatures in Adobe Reader X on Windows. However, I can't find a PDF file that has the correct "rights" to allow me to sign it.
    Is there somewhere I can get a sample PDF that will allow me to try my digital signature?

    Here's one: https://workspaces.acrobat.com/?d=wdmk-UM-PE35I3UdLukz9g

  • How to get data from PDF form?

    PDF forms can send data in url like GET or POST method. Is it possible to get data from url, like in PHP http://sever/file.php?item1=value1&item2=value2&item3=value3
    In APEX url have specific construction and I don't know how to get value of items (1...3)
    Please let me help to find simple method of geting data from URL.
    Best Regards,
    Mark

    The APEX URL syntax is detailed here
    http://download.oracle.com/docs/cd/E14373_01/appdev.32/e11838/concept.htm#BCEDJBEH
    How to get it from PDF is another matter...
    I'm working on an app that downloads PDFs with a Large amount of data as a blob, takes that blob and changes it to XML, then goes through the xml to validate each section of data and then add it into the schema that my apex app is referencing....
    I didn't write the original code but I do know that it isn't a quick thing to implement and includes using some uploading some java jar files to your schema and writing some custom java code.
    Someone else may be able to help with grabbing PDF data into the URL for the amounts of data you want to pass to apex.
    Gus..
    REWARDS: Please remember to mark helpful or correct posts on the forum, not just for my answers but for everyone!
    Edited by: Gussay on Sep 21, 2009 5:52 PM

  • How to get the output .pdf file of a quiz to report to the quiz results analyzer on my internal server (mamp)

    I created a quiz.
    Created an internal server on my compute rising a MAMP.
    When I publish my quiz using the multi-file publishing options...
    I am able to use both the "HTML" and the "swf" output files to complete a quiz and reporting the results to the quiz results analyzer.
    However, I am unable to get the output .pdf field to reporting to the quiz results analyzer.
    Any help? Would this issue have to do with the Acrobat Professional setting? Captivate setting? My internal server setting? or output fuel placement?
    I tired to put the .pdf file in the same MAMP root folder location as my "internalserverreporting.php and internalserverread.php files.
    Thanks for the help.

    Hello Varun,
    You cqan submit the report as a JOB and export the out put to memory, once the job is complete you can read the list to display the output.
    Cheers,
    Mano
    Cut & Paste form SAP help.
    Submit report ....
    EXPORTING LIST TO MEMORY
    Does not display the output list of the called report, but saves it in ABAP memory and leaves the called report immediately. Since the calling program can read the list from memory and process it further, you need to use the addition ... AND RETURN . Also, since the called report cannot be requested for printing, the addition ... TO SAP-SPOOL is not allowed here. In addition, you must not assign a function code to the ENTER key in the current GUI status. The saved list is read from the SAP memory using the function module 'LIST_FROM_MEMORY' and can then be saved to the database using EXPORT, for example. You can process this list further with the function modules 'WRITE_LIST', 'DISPLAY_LIST' ... of the function group "SLST".

  • How do I get books in .pdf format from my computer to ibooks?

    I have some large study guides on my computer that I'd like to add to ibooks to take with me on my iPad. How can I get them there? I can't seem to convince the sync program to find them.

    Ok, how do I get them to show up in my iTunes library to do that? It shows music, movies, tv shows, podcasts, apps and radio at present. I'm not sure how to get garden variety .pdfs  to show up in my library, to be able to drag them.
    the iPad device does show ibooks, along with the books that I downloaded from the ibooks/app store, but these that I want to add came from an educational website. A friend of mine told me he puts work articles and books into ibooks, and I'd like to do it, I'm just having trouble getting them there.  Thanks for your assistance, by the way.

  • Maybe you are looking for

    • Errors in R3AM1 / Block size is not increasing / Status wait (data from ECC TO CRM)

      I got above error in R3AM1, How to fix this????? Please any body tell me clearly step by step 

    • Clearing Thru F.13

      Hi Gurus, While clearing through F.13, we use a variant which automatically takes current date as clearing date. So For eg. when we do clearing on 3rd March, system takes its impact in period 2. But we want when we do clearing on 5th either system ta

    • Internal Table Doubt!!!

      Hi!    I ve doubt on the following, 1) Data: Begin of itab occurs 10               ......, end of itab.     In the above what will happen if i store records more than 10 & less than 10 records if more than 10 where records will be stored . if i store

    • Analytics: Error msg while downlodaing report in PDF format.

      Sax parser returned an exception. Message: Expected an element name, Entity publicId: , Entity systemId: , Line number: 93, Column number: 56 Error Details Error Codes: UH6MBRBC Please let me know, how to overcome this issue..

    • Installation der CS5 Web-Premium Trial schlägt fehl - Datenträger fehlt?

      Hallo, ich habe mir von der Adobe Website die deutschte Trial des CS5 Web Premium für Windows heruntergeladen. Danach hatte ich 2 Dateien: Einmal die 7z-Datei und die exe-Datei, die einem dabei hilft die erstere zu entpacken. Nach dem Start der Insta