Getting the offset of a placed PDF within the container rectangle

I need to get the offset of a placed PDF inside of the container rectangle. I have figured out that this information should be available in the transformationMatrix of the placed file. So I do something like:
var pdfTransform = pdf.transformValuesOf(CoordinateSpaces.pasteboardCoordinates)[0];
var horzTranslation = pdfTransform.horizontalTranslation;
var vertTranslation = pdfTransform.verticalTranslation;
but the coordinates I get back are just weird. The horizontal value seems reasonable, but the vertical is way off what I expect.
There may be some precondition to doing this that I'm missing. Running the pageitems/TransformValuesOf.jsx sample from the Scripting Guide also gives weird values. That sample creates a rectangle with a center point of [0, 0] and then retrieves the transform. I would expect the translation to be [0, 0] but I actually get [5, -415.95] (horz, vert).
In that sample it talks about ruler coordinates, so I tried setting document.viewPreferences.rulerOrigin to different values, but that does nothing.
I'm stumped. Can someone please give me a hint on what's going on here?

Thanks Peter.
Some more info: I basically want to get the coordinates of the objects in a placed file in the coordinate space of the containing document. As an extra twist, the placed file is a PDF created from an InDesign document. So, I first extract the coordinates from that InDesign file, then the coordinates for the document that contains the placed PDF, and finally I merge the coordinates of the two documents as if all the objects were contained in a single document. This workflow is then used outside of InDesign to draw frames around all the object boxes on a JPEG created from the document containing the placed PDF.
Anyhow, to answer my own original question, this seems to work thus far:
rectOffset = containingRect.resolve(AnchorPoint.TOP_LEFT_ANCHOR, CoordinateSpaces.PASTEBOARD_COORDINATES)[0];
pdfOffset = pdf.resolve(AnchorPoint.TOP_LEFT_ANCHOR, CoordinateSpaces.PASTEBOARD_COORDINATES)[0];
horzTranslation = rectOffset[0] - pdfOffset[0];
vertTranslation = rectOffset[1] - pdfOffset[1];
That gives the same values as I can see in InDesign when selecting the placed PDF. So far so good ...
BUT, that is not enough! When placing a PDF using the default option of Crop to Bounding Box, I sometimes get a bit of extra margin (different for different documents) that offsets the translation values. I have no idea where this margin comes from but I need to compensate for it.
Please help! And let me know if this description is unclear so I can try to explain better.

Similar Messages

  • How can I get the container of a button after the button is clicked?

    I have two components:
    public class A extends JPanel implements ActionListener {
        public A() {
        public void actionPerformed(ActionEvent e) {
            String command = e.getActionCommand();
            // here need to know the instance of B to execute it's process()
            // but I can only know the button jb in B via the following code:
            JButton myjb = (JButton)(e.getSource());
    public class B extends JPanel {
        public ContainerInfoInput(ActionListener al) {
            JButton jb = new JButton("OK");
            jb.setActionCommand("B.ok");
            jb.addActionListener(al);
        public process() {
    public class Main {
        A a = new A();
        B b = new B(a);
    }How can I get the instance of B in which the button is clicked?
    Thank you

    I think it's a defect of the listener mechanism. Under the present circumstance, I must do it like the following:
    I must use another class M as a bridge:
    class A {
        public A() { }   
        public processA (String info ){}
    class B{
        public B(ActionListener al) {       
            JButton jb = new JButton("OK");       
            jb.setActionCommand("B.ok");      
            jb.addActionListener(al);  
       public String processB () {    }
    class M implements ActionListener  {
        public M() {
            A a = new A();
            B b = new B(this);
        public void actionPerformed(ActionEvent e) {
            String command = e.getActionCommand();
            if(command.equals("B.ok")) {
                String information =b.processB();
                a.processA(information);
    }Why not just use A to listen B and obtain instance of B through the ActionEvent?
    Anyone know a solution about it?

  • Is it possible to get the containing table name of a UDT with ToCustomObj?

    Hi,
    I got several UDTs that I use in various different tables, in order to update them I need to know which table they came from (I handle updates manually). I'm looking for a way to store the table name the UDT came from in the ToCustomObject method during mapping. Is it possible to do that?

    Acutally, i wanna make clear about the concept of a "Thread"
    Is it true that ..
    the main() method is a thread , once I create another thread in the program , both of (or all of them) will contains it owns stack exception information ?
    My english is poor, please try to understand it. Thx

  • Trouble moving file after rename; can't get the new name, what's missing?

    I know I'm missing a statement to redefine this_item after it has been renamed, but I'm too noobed to know how.
    Files I drop into my layersRenameFolder do get renamed, but then the script fails with error (simplified) "can't get <name of pre-renamed file>"
    So I'm struggling with how to reset the variable so finder knows the new name of the files to move them.
    Note, the code is compilations of other scripts and others corrections. I don't claim to be the original author of any of it. Just trying to piece it together.
    Script follows--------
    on idle
    set PathToDesktop to path to desktop as text
    set layersRenameFolder to (PathToDesktop & "On-Line Proofing1:1 Layout Proofs InDesign:LayoutRenameLAYERS:") as alias
    set outFolder to (PathToDesktop & "On-Line Proofing1:1 Layout Proofs InDesign:Out:") as alias
    tell application "Finder" to set these_items to (every file of layersRenameFolder whose kind contains "PDF")
    --Check to see if there are one or more PDF files in the LayersRename folder on the desktop
    if (count these_items) is greater than 0 then
    tell me to activate
    display dialog "Files located. Script starting!" buttons " " default button 1 giving up after 2
    --Go through all PDF files, one at a time
    repeat with PDFfile in these_items
    --rename PDFFile
    set this_item to contents of PDFfile
    set fileName to name of this_item
    set {TID, text item delimiters} to {text item delimiters, "-"}
    if fileName ends with "1.pdf" or fileName ends with "ALL.pdf" or fileName ends with "CAR.pdf" then set newFileName to (text items 1 thru 2 of fileName) & "1.pdf" as text
    set text item delimiters to TID
    end repeat
    end if
    -- move renamed pdfs to out
    tell application "Finder"
    set name of this_item to newFileName
    move this_item to outFolder with replacing
    end tell
    return 5
    end idle

    When you set the name of a file, the result is just the new name, not a full path. You can rebuild the file path by getting the containing folder and adding the resulting name, for example:
    <pre style="
    font-family: Monaco, 'Courier New', Courier, monospace;
    font-size: 10px;
    font-weight: normal;
    margin: 0px;
    padding: 5px;
    border: 1px solid #000000;
    width: 720px;
    color: #000000;
    background-color: #FFEE80;
    overflow: auto;"
    title="this text can be pasted into the Script Editor">
    tell application "Finder"
    set theContainer to the container of this_item as text
    set name of this_item to newFileName
    move ((theContainer & the result) as alias) to outFolder with replacing
    end tell
    </pre>

  • How do I get the date of a file in an FTP?

    As stated in the subject.
    I am at wits end trying to get the date of a file from FTP(Stuck for days).
    I tried the "URLConnection" Class but could only get me the size of the file with "getContentLength()"
    "getContentDate()" & "getLastModified()" both give me a 0. They only works for files on HTTP but not FTP.
    Anyone has any simple solution on how to get the date of a file on FTP?
    Thanks in Advance.

    The FTP specification has long awaited the magical file meta-data access protocol, which never came. There is no FTP defined manner to obtain the date of a file. The common work-around is to get the containing directory list and <shudder> parse the format of the returned text for the target file and date. Since there is no standard directory listing format, there is no guarantee that you will be able to get that date, and your application would have to cry to the user for help.
    Some FTP applications, in addition to providing parsers for Unix/Linux and DOS/Windows directory list formats, also provide the user with a format definition script to parse whatever the user encounters.
    I hope you find this of some help.

  • Find the container name of a component

    hi
    how does one get the container name of a component on the component's actionListener event.
    i have a ' N ' number of JInternalFrames in which there are multiple JToggleButtons. On the actionListener event of the togglebutton i would like to know the name of the internalframe which is holding it. how do i get that name.
    Plz suggest Thanks Trushant

    NO it did not work. getTopLevelAncestor() function returns me the main frame on which i have all the jinternalframes . is there any way to know the next immediate container of the component.
    Anyways thanks for consideration .

  • Using the container format to call BAPIs

    I'm trying to call BAPIs with the SWO_CREATE and SWO_INVOKE RFC's, and having a difficult time getting the container marshalled correctly.  Can anyone supply or point me to information about marshaling arguments in the container?
    Thanks

    Hi Jhon,
    I have seen your question for the container format to call BAPI and could not find any replies or any kind of information regarding the container marshalling on the web. I am having a simillar problem when invoking the SWO_INVOKE, i am passing a container and it gives me a error saying "packed field with incorrect BCD format" and i am trying to find some kind of solution for this, if you  had a some kind of solution or guidance that would be great.
    Thanks,
    Praveen

  • How do I get the Adobe toolbar to display above a pdf in the web browser?

    Hi guys,
    I'm just having trouble with locating the grey toolbar, it's not displaying when I open a .pdf in a web browser.
    I can open the .pdf fine, (within Safari), and usually (on my old computer) there was a grey toolbar above the .pdf & there's a print icon on it - that's what I'm looking for, so that I can print my lecture notes straight away.
    The toolbar won't display on the web browser above the .pdf, but if I save the .pdf & open it with Adobe Reader, then the toolbar displays there with all of the icons etc.
    So I was wanting to know if instead of saving them every time, if there's an option to get the toolbar displaying above .pdfs in Safari?
    Has anyone else encountered this problem?
    Any help would be greatly appreciated.

    Unfortunately, iOS does not provide a way to install "plugins" to Safari so there is no possible way the Reader can do this. You can use the "open in" functionality to launch Reader from Safari.

  • Getting the page size in PDF file

    i want know how do get the page size in PDF file befor placing every page in document
    for example height=297 mm And width=210mm

    This script:
    http://indesignsecrets.com/zanelli-releases-multipageimporter-for-importing-both -pdf-and-indd-files.php
    answers all your questions.
    Peter

  • How do I get the Converting to Adobe PDF process to stop hanging?

    I installed Adobe Acrobat 8 Professional on a machine running Windows 7 Professional 64bit.  I have tried creating PDFs from MS Office files (using the Acrobat PDFMaker toolbar).  I have also tried printing to Adobe PDF, from within MS office but also elsewhere (e.g. IE, Notepad).  No matter the creation method, I am prompted for a file name and location and then the Acrobat PDFMaker window appears with a taskbar and message "Coverting to Adobe PDF..."  The process hangs there and a print job appears in the Adobe PDF printer with a status of "Error - Printing."  How do I get the process to stop hanging and successfully create PDFs?

    FWIW, a former colleague was also frustrated with this "Error - Printing" hang-up problem, when printing from any app to Adobe PDF, with Acrobat Pro 9.3.0 on a Win7x64 system. I recall forum threads on that issue, with no clear resolution?. What did work on every print job, though, was the two-step method: (a) Print to File with Adobe PDF, then (b) fire up Acrobat Distiller 9 to convert the intermediate .prn Postscript file. (It would seem that Acrotray wasn't functioning properly in a x64 environment?...though it did run as one of the pc startup processes)
    As that two-step method was acceptable for his workflow, he never explored the possibility of getting a fluent one-step PDF creation by upgrading to the highest available v9x version, or beyond.

  • When I convert a PDF to a Word doc, it "converts" as a picture and I cannot edit the document. What can I do to get the PDF to convert properly?

    When I convert a PDF to a Word doc, it "converts" as a picture and I cannot edit the document. What can I do to get the PDF to convert properly?

    Hi conversionnewbie,
    Are you able to select the text in Word by triple-clicking inside the text box? (Sometimes text selections can be tricky in converted files.) If you can't select the text, then I'm guessing that the PDF was created from a scanned file (so the text becomes images). Make sure that OCR is enabled when you convert the file to Word. OCR is enabled by default in the ExportPDF web interface, but can be disabled in Adobe Reader. If you're converting to Word from within Adobe Reader, make sure that OCR is enabled and that the correct language is selected:
    Please let us know that works for you!
    Best,
    Sara

  • We use a plugin Adobe Acrobat NPAPI Plug-in Version 10.1.2 on a Mac to get the pdf to open in a browser window. Is there a later version or other method ?

    We use a plugin Adobe Acrobat NPAPI Plug-in Version 10.1.2 on a Mac to get the pdf to open in Acrobat and the pdf display within the browser window, as within our Online artwork Approval system we use the Acrobat Annotations server to annotate pdfs and publish to the server
    But we can no longer get this plugin to work! Is there a later version ? or is there another way of forcing the pdf to open in a Acrobat Reader application (not the Mac viewer) within the browser and not open another window to display the pdf in Acrobat?

    The latest version is 11.0.6. Whether that's available to you depends on the version of Mac OS you're running.
    * http://get.adobe.com/reader/enterprise/
    See the following articles.
    * [[PDF files are blank or cause an error message on Mac]]
    * [[Use the Adobe Reader plugin to view or download PDF files]]

  • When opening a pdf I get the message "FoxitreaderOCX.ocx failed to load"

    Each time I try to open a pdf file, I get the message "FoxitreaderOCX.ocx failed to load"
    I don't know what to do about this.
    I can open the pdf file from other browsers or from Windows Explorer if the pdf is stored.

    Opening PDF files within Firefox
    https://support.mozilla.com/en-US/kb/Opening%20PDF%20files%20within%20Firefox
    Check and tell if its working.

  • Getting the file type from a placed file

    Hi
    I am trying to get the file type from items placed on a page. I know the types available has one of the three interfaces "IImageAttributes", "IEPSAttributes" or "IPDFAttributes", but how can i test whether the placed image is a TIF, JPG ... Of course i could test on the suffix or the file type (mac), but that isnt "secure" enough, since InDesign can place files with no filetype or extension, if they are in an importable format.
    What I want in short, is to read the filetype shown in the Info palette, any one knows how to do this?
    Jon

    Thanks, I did take a look in these interfaces, but that didnt solve the problem for eps, pdf and other none raster types.
    Instead I found the:
    IDataLink->GetNameInfo()
    Which gives me the string from the Info palette.

  • Change the page in a placed PDF?

    Is there an easy way to change the page in a placed PDF? Something along the lines of Object Layer Options?
    Thanks.

    We can fix this with scripting! Easy oneline script [Edit: break it two 2 lines so you don't get a scrollbar in the forum]:
    var g; (g=app.selection[0].graphics[0]).
        place(g.itemLink.filePath, true);
    save as replace.jsx and assign it a key in Edit > Keyboard Shortcuts (Scripts Area).
    It assumes a frame (rectangle) is currently selected, and re-places the file associated with it, while showing the options dialog box (2nd argument to place()).

Maybe you are looking for

  • Class/Package problem with tomcat

    Hi everyone, i am pretty new to tomcat and jsp and I have to setup a webapp using tomcat. Actually I setup the tomcat-server and moved all files in the webapps/ROOT/myapp directory. Unfortunately I get the following error-message when I access the ma

  • Lightning 1.0 recurent event and Communications Synchronization Engine

    Hello, We have noticed that lightning 1.0 does add interval value when it is 1. Then our synchronica gateway does not sync recurrent events. Could someone test it with Communications Synchronization Engine to tell me if there is also the problem? Exa

  • How to set height of a JPanel ?

    Hi. My JPanel is a tad too high and I'd rather not use mypanel.setPreferredSize(int xxx, int yyy) because the breadth is alright. How do I play around with the height only? Something like myjpanel.setHeight(int yyy); would be nice but the method deoe

  • How do I  "mask" or blurr out sections of movie clips saved in windows media format in After Effects

    I was informed that I needed to use After Effects to "mask" or blurr out sections of movie clips saved in windows media format. I have the movie clip in composition, I see the effects and presets drop box on the lower right. How do I insert the text

  • 10G lite database error

    Hi, I am getting the following error while getting connection from 10G Lite database on PDA. An unhandled exception of type 'Oracle.DataAccess.Lite.OracleException' occurred in Oracle.DataAccess.Lite_wce.dll Additional information: S1000[POL-3261] th