Anchor all images within a document

Hello everynbody,
i am currently triing to write a script that loops all (not anchored) graphics within a document. I want to anchor the image because i want them to move along with the text.
Here are the steps i took so far:
1. Iterating through graphics using "myDocument.allGraphics"
2. Check if "myGraphic.parent.parent.constructor.name" is Character or Page. If it is character the image is already anchored.
3. Iterate through all text frames on the page of the current image and
determine one frame that overlaps the Rectangle of the image.
4. Determine the everage height of a line of the frame (Heigh of frame / number of lines)
5. Determine the line number of the insertion point for the graphic (=iLine)
6. Determine the average number of characters per line (=averageChars)
7. Calculate the average width of a chracter (width if text frame / average number of chars per line)
8. Calculate the number of characters for the indention (horicontal) of the graphic (=iChars)
9. Insert graphic as follows:
var myNewGraphic = matchingFrame.insertionPoints.item(iChars + iLines * averageChars).place(file, false);
10. Delete the original graphic and it´s rectangle
My problems are as follows:
1. The insertion position of the image is never correct even though the calculated line number (iLines) and the calculated indention (iChars) is correct.
2. After insertion of the image the text does not flow correctly around the contures of the image
3. I dont know how to set the options for anchored objects as listed in (Objekt -> Verankertes Objekt -> Optionen IN GERMAN VERSION OF INDESIGN)
I am using Windows XP SP3, i am working with Adobe InDesign CS3 and for scripting i am using JavaScript (for compatibility between MAC and WINDOWS).
Thanks everybody. If the source code is needed i will provide it.

Thomas,
>1. The insertion position of the image is never correct
You need to start at the end of the document and work your way to the beginning. This is to ensure that references to graphics and frames remain constant.
>2./3. I dont know how to set the options for anchored objects as listed in (Objekt -> Verankertes Objekt -> Optionen IN GERMAN VERSION OF INDESIGN)
All these are enumerations, so you should use the English names. The object-model viewer shows the terms you can use (see under anchorPosition, anchorObjectDefault, anchorObjectSettings, etc.).
Peter

Similar Messages

  • Resizing/compresing images within a document

    Hi
    I am trying to compress all images within a document I've just creacted, in order to avoid having a 20Mb size document, but I cannot find the tool anywhere. I am just new to Pages, transfered from Office Word, where this task can easily be done by write clicking and imag properties.
    Would someone be able to help me?
    Thanks

    Thanks dennis.
    Thats what I've been doing, exporting the images into mail and re-sizing them, then a drag and drop into the document. Seems rediculous though. We make reports so we have loads of documents, all around 50MB, it soon builds up.
    I'll leave feedback in pages I recon.
    Regards,
    Rob

  • Add captions to all images in a document

    Does anyone already have a script that will add captions to all the images in a document? Right now I have to select each image on each spread which doesn't feel very efficient.

    Hi Sandee!
    Would that be using CS5's automatic caption function, or just "captions in general"?
    If the latter, I s'pose it's not too hard to write a quick & dirty script to add a text frame below (above?) each image, sets its width to the image size, sets the height to a reasonable amount, optionally add an object style to it, and (for instance) copy the image file name into it so you know what you're talking about.
    If the former ... anyone else?

  • Selecting All Images in a Document over multiple pages

    Hello,
    Is there anyway to select all the images in a document, not just a spread.
    For example, if I want to apply an object style to every image.
    I can only do one page (spread) at a time
    There was a post out there that started like this, but started talking about converting to outlines, so this part was never answered.
    I was teying to find something through GREP, but nothere there either.
    Is this possible?
    thanks
    babs

    Oh bait. I like bait.
    for (a=0; a<app.activeDocument.allGraphics.length; a++)
         if (app.activeDocument.allGraphics[a].imageTypeName in {"JPEG":0, "PNG":0, "TIFF":0, "Windows Bitmap":0, "CompuServe GIF":0, "Photoshop":0})
    app.activeDocument.allGraphics[a].parent.appliedObjectStyle = app.activeDocument.objectStyles.item("test");
    //     else
    //          alert (app.activeDocument.allGraphics[a].imageTypeName);
    .. and perhaps some more raster formats -- I don't know exactly which types ID distinguishes by name. You can find the type name per image in the Info palette -- it doesn't seem to differentiate between TIF and TIFF, for example. "Photoshop" is any PSD file.
    An Illustrator file is tagged "Adobe PDF" (not weird, if you know how it works), and a placed InDesign page as "InDesign". Didn't find a real EPS quick enough to test that as well, but you could try.
    If you remove the comment slashes from the 'else' part the script will show an alert for the image types it did not change.
    All of these types are distinguished by type name only, you cannot check for a PDF only containing a single raster image, or a PSD containing vector info.

  • Paste loses all formatting within same document

    In all three of my iWork '09 applications, Cut and Paste loses all the formatting of the object I'm trying to copy within the same document.
    In some cases I can copy the object, then copy the style, then paste the object, then paste the style, which works albeit in a very cumbersome way.
    But to move a table around (within the same document!) this doesn't work at all and I'm reduced to dragging the object, which often doesn't work properly.
    Any ideas on what's gone wrong? I'm on Lion now running on a 2006 Mac Book Pro 3Gb, but the same behaviour was evident in Snow Leopard.
    Cheers,
    i

    Would be useful to select a table (so that it has its eight handles then Copy and paste in the other location.
    Yvan KOENIG (VALLAURIS, France) dimanche 21 août 2011 23:57:07
    iMac 21”5, i7, 2.8 GHz, 4 Gbytes, 1 Tbytes, mac OS X 10.6.8 and 10.7.0
    My iDisk is : <http://public.me.com/koenigyvan>
    Please : Search for questions similar to your own before submitting them to the community
    To be the AW6 successor, iWork MUST integrate a TRUE DB, not a list organizer !

  • Adding name of indesign document to metadata of all images used in document

    I have been asked to include the indesign file name in the metatag of each image used in every document i produce from here on.
    is there a way to write a script in indesign that will copy the document name then open every link (in bridge?) and append the document name to the metadata (i don't want to lose any existing tags) and then save?
    scott

    This should should give you a start. It'll add the active documents name to the field instructions of the img when executed. Tested once. No errorhandling.
    currDoc = app.activeDocument;
    docName = currDoc.name;
    docGraphics = currDoc.allGraphics;
    for(var g = 0; g < docGraphics.length; g++){
        currGraphic = docGraphics[g];
            currGraphicFilePath = currGraphic.itemLink.filePath;
            fileObject = File(currGraphicFilePath);
    writeDocNameToMeta(fileObject, docName);
    function writeDocNameToMeta(fileObject, docName){
    if(loadXMPLibrary()){
            var myFile = fileObject;
            xmpFile = new XMPFile(myFile.fsName, XMPConst.UNKNOWN, XMPConst.OPEN_FOR_UPDATE);
            var myXmp = xmpFile.getXMP();
                  var myStatus = myXmp.getProperty(XMPConst.NS_PHOTOSHOP,"Instructions");
       myXmp.deleteProperty(XMPConst.NS_PHOTOSHOP, "Instructions");
       myXmp.setProperty(XMPConst.NS_PHOTOSHOP, "Instructions", docName);
       if (xmpFile.canPutXMP(myXmp)) {          xmpFile.putXMP(myXmp);    }
            xmpFile.closeFile(XMPConst.CLOSE_UPDATE_SAFELY);
            unloadXMPLibrary();
        function loadXMPLibrary(){
            if ( !ExternalObject.AdobeXMPScript ){
                try{ExternalObject.AdobeXMPScript = new ExternalObject('lib:AdobeXMPScript');}
                catch (e){alert('Unable to load the AdobeXMPScript library!'); return false;}
            return true;
    function unloadXMPLibrary(){
            if( ExternalObject.AdobeXMPScript ){
                try{ExternalObject.AdobeXMPScript.unload(); ExternalObject.AdobeXMPScript = undefined;}
                catch (e){alert('Unable to unload the AdobeXMPScript library!');}
    Hans-Gerd Claßen

  • PreLoad ALL images within a site?

    My ImageReady rollover preloads are working fine (per page).
    However, can someone please provide script that I can place in my
    index page, that downloads every single image in my site?
    Thanks.

    ...and it would be a pain for anyone still using dialup. They
    may just
    close your portfolio and go somewhere else.
    "David Powers" <[email protected]> wrote in message
    news:e7eotm$j2v$[email protected]..
    > swissgrid wrote:
    >> Why not? Of course you would want the index page to
    load its own images
    >> first. However, why stop there? By the time a user
    clicks on the next
    >> page, all of the images could be loaded.
    >
    > Wasting huge amounts of bandwidth on images that may
    never be seen. If
    > your images are taking too long to download, you ought
    to reconsider their
    > size. On the other hand, if it's a portfolio site, users
    will normally be
    > happy to wait if your material is really worth looking
    at.
    >
    > --
    > David Powers
    > Author, "Foundation PHP for Dreamweaver 8" (friends of
    ED)
    > Author, "Foundation PHP 5 for Flash" (friends of ED)
    >
    http://foundationphp.com/

  • Linking images within a document?

    Hi,
    I'm laying out a photographic book with a visual index at the end containing thumbnails and
    captions for each photograph in the book.
    Is there a way to link the thumbnails to the images, so that if I change the photo it updates the thumbnail?
    If so, is there also a way to input text linked to each photo, so that if the thumbnail changes the text also changes?
    Many thanks,
    Matthew

    mlondon88 wrote:
    Hi,
    I'm laying out a photographic book with a visual index at the end containing thumbnails and
    captions for each photograph in the book.
    Is there a way to link the thumbnails to the images, so that if I change the photo it updates the thumbnail?
    Say you have one full size image and a corresponding thumbnail. You want to replace both. A few scenarios:
    1. You have the same image placed twice, for the thumbnail the image is scaled down in InDesign. In the Links panel the image will show double placement. Click on the top name, relink to the new image. Both will update.
    2. You have the same image placed twice, for the thumbnail the image is scaled down in InDesign. Save and replace the old images in Photoshop. The links come up modified in InDesign, just update. Note: You might want to keep copies of the old images if you ever need them again.
    3. You have two versions of the same picture, one large and one small, placed in InDesign. Actually the better option for image clarity, but it's very important to establish a good naming convention for your images. Personally I would not use the same name for the large and small images, it would be confusing. You can re-link to the new images one at a time, or you can save and replace the old in Photoshop and update in InDesign.
    mlondon88 wrote:
    If so, is there also a way to input text linked to each photo, so that if the thumbnail changes the text also changes?
    For the index I would first select the thumbnail and the caption. Group. Copy. Now create a master text box and paste. The image and caption now behave as a large text character. This keeps them together, they flow like text.
    In the event you change the image and the text needs to change in two places, use Find/Change. As long as the text reads the same in the index and the body text, Find/Change will replace both at the same time.

  • Is it possible to find all images below 300dpi in a document?

    Hi there, I'm hoping this is a quick question. I've had a look on google but to no avail.
    Is it possible to find all images within an indesign document that are below 300dpi. I've got a lot of images placed in a document, quite a lot were low res (not all, but a lot) just for quickness to begin with...but now I need to replace them with the high res for print, and theres LOADS so i don't really wanna do it manually.
    I know when you do preflight indesign will tell you if there are any images using RGB colour space, but will it do somehting similar with image quality?
    Mac OSX 10.5.8, InDesign CS3

    Okay, here is a fast one but it seems to do the job.
    Copy the text in the frame below into a plain text document using Notepad, Textedit (in plain text mode!), or -- safest -- InDesign's own ESTK Editor that comes installed with the package. Save as "ReportBadResolution.jsx" in your User Scripts folder (see also InDesignSecret's How to install scripts in InDesign).  Double-click to run.
    If nothing happens, all images are okay. If you get an error somewhere, you have used images in a way I did not foresee (and thus didn't script how to handle these); try to report what goes wrong where and on what sort of image, if possible.
    If the script does find anything wrong -- it checks for a minimum resolution of 300 dpi and, as a bonus, on badly scaled images -- it will create a new blank document and fill a text frame with the relevant information: image name, page, and x/y resolutions. It creates only one single page so if you get an 'overset text plus' at the bottom you have lots and lots of bad images ...
    Here's the script to copy:
    //DESCRIPTION:Report Bad Resolutions for a New Year
    // No Guarantees, Ltd. Use at your own risk.
    // Jongware, 05-Feb-2010
    // Minimum dpi allowed:
    var minimumValue = 300;
    // Alert when x/y scaling is off by this much percents:
    var percentageScaling = 1;
    var lowResList = new Array;
    for (aGraphic=0; aGraphic<app.activeDocument.allGraphics.length; aGraphic++)
    oneGraphic = app.activeDocument.allGraphics[aGraphic];
    try {
      xres = oneGraphic.effectivePpi[0];
      yres = oneGraphic.effectivePpi[1];
      if (xres < minimumValue || yres < minimumValue)
       lowResList.push (oneGraphic);
      else
       if (xres < yres)
        scaling = 100*yres/xres;
       else
        scaling = 100*xres/yres;
       if (scaling > 100+percentageScaling)
        lowResList.push (oneGraphic);
    } catch (_) {}
    if (lowResList.length > 0)
    doc = app.documents.add();
    frame = doc.textFrames.add({geometricBounds:[0,0,doc.documentPreferences.pageHeight, doc.documentPreferences.pageWidth]});
    txt = '';
    for (i=0; i<lowResList.length; i++)
      pg = ultimateParent (lowResList[i]);
      txt = txt+"File: "+lowResList[i].itemLink.name;
      if (pg.parent instanceof(MasterSpread))
       txt = txt+' on Master spread '+pg.name;
      else
       if (pg instanceof(Spread))
        txt = txt+' on clipboard of pg '+pg.pages[0].name;
        for (j=1; j<pg.pages.length; j++)
         txt += '-'+pg.pages[j].name;
       } else
        txt = txt+' on pg '+pg.name;
      txt = txt+' has xres: '+lowResList[i].effectivePpi[0]+', yres: '+lowResList[i].effectivePpi[1]+'\n';
    frame.contents = txt;
    } else
    alert ("No images have a resolution less than "+minimumValue+" dpi");
    function ultimateParent(obj)
    while (1)
      obj = obj.parent;
      if (obj.constructor.name == "Page")
       break;
      if (obj.constructor.name == "Character")
       obj = obj.parentTextFrames[0];
      if (obj.constructor.name == "Spread" || obj.constructor.name == "MasterSpread")
       break;
    return obj;

  • Warning Badge on all images in library but they are not referenced images.

    Hi All,
    I have my main library located on a server with all images within the library. I don't have any up to date vaults.
    I was having issues with one project where it was showing me 'unsupported image' so I set up a vault, backed it up and then rebuilt the library. When it came back all images have the warning badge with an arrow as if they are referenced files that have moved location or something?
    I am currently trying to rebuild the library again before I try restoring the last (flawed) vault to the local hard drive.
    Has anyone got any ideas?
    Thanks
    Max

    YEEESSS! Thank God.........
    I checked inside the project again and compared it with a working project on another manchine and noticed the / had turned to some weird scissor symbol. I guess this must have happened when I enabled Airport backup on my QNAP which turns the share into AFP.
    I am now manually changing them back to / and they are relinking back into the library - Phew!!
    I guess I will have to start Keeping the library on the local drive. I do the same with my macbook pro but have older images referenced to the server to save space, maybe I should use the same tactic on the Mac Pro. I guess that means that the Vault only holds the metadata and not the images as they will be on the NAS, however that is RAID protected so should be ok.
    Thanks!
    M

  • How to keep an image "in place" within a document using Pages?

    Here's what I want solved. When I position an image (like a jPeg photo) within a document I take a great amount of care as to how it looks in the layout. BUT, if I add a new line of text ABOVE the image, all the text moves, but the image stays in place. When the text above moves down, any kind of "art direction" is lost.
    Yes, I know there is a way to "LOCK" the image, but that doesn't solve this issue. The formatting still moves all the text and the image is stuck, LOCKED or UN-LOCKED.
    I want to know if there is a way to KEEP THE IMAGE in place within the text. I want to be able to edit above the image and not have the headache of needing to move the image every single time I change something above it.
    Does this make sense?
    I have to assume there is a way to do this, I just haven't figured it out.
    I am using Pages 09.
    thanks,
    Mike C

    (a little bit more)
    This text below is from the Pages help menu, but (sadly) This does NOT solve my problems.
    Locking and Unlocking Floating Objects
    You can lock floating objects to avoid inadvertently moving them as you work. Inline objects cannot be grouped or locked.
    After you lock individual or grouped objects, you can’t move, delete, or modify them in any way until you unlock them. However, a locked object can be selected, copied, or duplicated; when you copy or duplicate a locked object, the new object is also locked.
    To lock a floating object:
    Select the objects you want to lock, and then choose Arrange > Lock.
    To unlock a floating object:
    Select the objects you want to unlock, and then choose Arrange > Unlock.

  • HELP!!!! I have spent hours trying to find out how to embed an image with a link or a Microsoft Word document with a hyperlink built within the document -- not as an attachment! Does ANYONE know the secret? Can it be done, or not! My PC clients do it.

    HELP!!!! I have spent hours trying to find out how to embed an image with a link, or embed a Microsoft Word document with a hyperlink built within the document -- not as an attachment into my email -- but where it shows as the email content when opened! Does ANYONE know the secret? Can it be done, or not? My PC clients do it all the time easily. Then I want to be able to send the embedded image/document (not as an attachment, but visable within the email when opened) to many email contacts at once, BUT the individuals receiveing them DO NOT SEE the other email contacts. Cannot seem to be able to find anything on being able to do these 2 tasks.PLEASE, SOMEONE, HELP!!!

    Don't know if this applies to Lion, but read here:
    http://www.makeuseof.com/tag/create-html-announcement-mail-iweb-mac/

  • Automatically place images within multiple InDesign documents

    I work for a publishing company of agricultural trade magazines and work on few titles each month. We are trying to streamline our production procedures and previous company I worked for had a script they used to place images within text pages by searching for the file name, however there were some limitations with this script (it would only work within 1 InDesign document and only within 1 InDesign story at a time). The company I am with now breaks out each editorial story into separate InDesign files and we place image boxes when the display ads are going to go. For our purposes now, I am looking for a script that, once all of the image boxes were tagged with the image file names, could search between multiple InDesign documents in a folder and automatically place all the images for us. Is anything like this available or able to be created? If so, would it have the capacity to search between multiple InDesign documents and search the entire document for the image file names? Any help would be greatly appreciated!

    Hi Kasyan,
    They were tagged using a program called Pathways created by a computer programmer the company used at the time. The issues that I was working on were annual Buyers' Guides so they were mainly just listings and inline graphics. The kinds of issues I work on now are monthly issue with various stories and no inline graphics, but display advertisements. And each story is created and laid out in a separate InDesign document. So I would need a script that can search an entire group of documents for file names and/or image boxes instead of just in one story in one document for inline graphics. (sorry if this is confusing).
    I currently do not have a script to work from and am looking for something new that can be used to save use the time of placing every ad manually.
    Thanks for your help and feedback!
    Matt

  • Pages 5.2 - When I try to reorder different pages it just takes all the pages within the document and turns them into a stack! Why is this happening and how can I oder pages as the update is meant to let me?

    When I try to reorder different pages it just takes all the pages within the document and turns them into a stack! Why is this happening and how can I oder pages as the update is meant to let me?
    Any Help?I know the update has only been out a while but if anyone has an idea why it is doing this, please let me know!

    But you are telling me something I already know.
    Be precise.
    It is not Pages '09 that is broken.
    I am back in Mavericks and testing Pages 5.2.
    There are improvements, we shall see how useful, but in less than a minute I have already discovered bugs.
    Peter

  • I have a 2009 MB Pro. I have been trying to do some cleaning of files and discovered that in Finder, All Images, I am experiencing a frustrating problem. I spent a few hours trashing over 4K images and within a few hours, I had as many more. Help!

    I have a 2009 MB Pro. I have been trying to do some cleaning of files and discovered that in Finder, All Images, I am experiencing a frustrating problem. I spent a few hours trashing over 4K images and within a few hours, I had as many more.  I did a couple of thousand trashed images and half hour later, more arrived. There are a lot of images that seem off the internet, including gif.s, png.s. Help!

    First, back up all data immediately, as your boot drive might be failing.
    There are a few other possible causes of generalized slow performance that you can rule out easily.
    Reset the System Management Controller.
    If you have many image or video files on the Desktop with preview icons, move them to another folder.
    If applicable, uncheck all boxes in the iCloud preference pane.
    Disconnect all non-essential wired peripherals and remove aftermarket expansion cards, if any.
    Check your keychains in Keychain Access for excessively duplicated items.
    If you have more than one user account, you must be logged in as an administrator to carry out this step.
    Launch the Console application in the same way you launched Activity Monitor. Make sure the title of the Console window is All Messages. If it isn't, select All Messages from the SYSTEM LOG QUERIES menu on the left. If you don't see that menu, select
    View ▹ Show Log List
    from the menu bar.
    Select the 50 or so most recent entries in the log. Copy them to the Clipboard (command-C). Paste into a reply to this message (command-V). You're looking for entries at the end of the log, not at the beginning.
    When posting a log extract, be selective. Don't post more than is requested.
    Please do not indiscriminately dump thousands of lines from the log into this discussion.
    Important: Some personal information, such as your name, may appear in the log. Anonymize before posting. That should be easy to do if your extract is not too long.

Maybe you are looking for

  • I installed Adobe Reader X and i can't print PDF's without opening Reader first

    Hi, i am using windows XP and i just installed Adobe Reader X onto a workstation within' my office. I use to have Adobe Reader 9 where i could just open a folder with my PDF's. For example, My Documents folder and right click on the PDF i want to pri

  • Can I make an aperture slideshow and use it in iweb?

    I need to know if I can make an aperture slideshow and use it in iweb (not making it a quicktime movie)? I don't want to use I photo (I know how to make one in Iphoto and put it in Iweb and I dont want to do this). (dont want a .mac gallery either) P

  • How do i insert cgi into my movie clips?

    I have shot a couple scenes and i have downloaded free cgi effects. How do i put these in my movie using iMovie?

  • Users cannot see XServe after an undetermined time

    I have an office with an Xserve G5 with OS X Server 10.5.5 and 10 PowerMac G5 clients with OS X 10.5.5 The Xserve does nothing special except offer and FTP server and share files among the office... each user gets to the server via the left and Finde

  • How to synchronize multiple images

    I'm trying to convert my Lightroom skills to Aperture and need to understand how to synchronize images where by simply changing one image I will change selected images such as white balance, curves, etc.