Script for replacing Image from a frame into InDesign document file

Hi All,
I am having an indesign document (indd) file with images and texts. I am using InDesign Server CS4 to run the scripts via SOAP.
My requirement is to replace any of the images from the required frame/s of indesign document through scripting (I already have frame id of which image needs to be replaced). I have written written java-script file (as given below): but when I execute this java-script on InDesign Server via SOAP, I get follwoing error into InDesign Server:
10/03/09 15:15:54 INFO  [javascript] Executing File: \\Server_IP_Address\JavaScript_File_Path\JavaScript_File.js
10/03/09 15:16:01 ERROR [link manager] Link missing.; file:C:/help.gif
10/03/09 15:16:01 ERROR [link manager] Link missing.; file:C:/Documents%20and%20Settings/All%20Users/Documents/My%20Pictures/Sample%20Pictures/ Water%20lilies.jpg
10/03/09 15:16:01 ERROR [link manager] Link missing.; file:C:/Documents%20and%20Settings/All%20Users/Documents/My%20Pictures/Sample%20Pictures/ Winter.jpg
Following is the java-script that is being used for replacing image from indd's frame:
var myDocument = app.open(File('//Server_IP_Address/InDesignDocument_File_Path/Sample.indd'));
var tmp_frmid="1339"; //frame id of which image needs to be replaced.
for (var i=0;i<myDocument.pages.length;i++)
var objPage=myDocument.pages.item(i);
var objPageitems = objPage.pageItems;
try
var obj = objPageitems.itemByID(tmp_frmid);
obj.images[0].remove;
obj.appliedObjectStyle = null;
var myImage=obj.place(File('//Server_IP_Address/Images_to_be_reolaced_Path/ImageFile.jpg'));
var old_height = myImage.geometricBounds[2] - myImage.geometricBounds[0];
var new_height = obj.geometricBounds[2] - obj.geometricBounds[0];
var old_width = myImage.geometricBounds[3] - myImage.geometricBounds[1];
var new_width = obj.geometricBounds[1] + ((new_height / old_height) * old_width);
myImage.geometricBounds = [obj.geometricBounds[0] + "mm", obj.geometricBounds[1] + "mm", obj.geometricBounds[2] + "mm", new_width + "mm"];
var diff = obj.geometricBounds[1] - myImage.geometricBounds[1];
myImage.move( undefined, [diff,0] );
break;
catch(e)
myDocument.save('//Server_IP_Address/InDesignDocument_File_Path/Sample.indd');
var previewFile = File('//Server_IP_Address/Images_to_be_reolaced_Path/ImageFile.jpg');
app.jpegExportPreferences.jpegQuality["JPEGOptionsQuality.low"];
app.documents.item(0).exportFile(ExportFormat.jpg, previewFile);
myDocument.close();
I have very urgent requirement; if anyone have any idea; please suggest me. \
It would be highly appreciable.
Kind Regards,
Prashant.

http://www.automatication.com/selection-to-pdf-script.html
Harbs
http://www.in-tools.com

Similar Messages

  • Is there a script for CS5 to export a multi-page InDesign Document to single page InDesign documents

    Hello,
    I am having trouble finding a script or utility that would allow me to export each page of an InDesign CS5 document as multiple single page InDesign documents. I have found one script that does this for CS3, but nothing for CS5. Thank you for any help.

    Generally speaking, if a script doesn't run in a later version, you can put it in a subfolder withteh correct version number as the name and it will work. For CS3 that would be "Version 5.0 Scripts" without the quotes.
    That said, if you have Acrobat pro, it's probably easier to use the extract pages command...

  • Placing images from Bridge CC breaks Indesign Doc

    This seems to be intermittent but it's occuring only when I place images from Bridge to an InDesign document.
    I've experienced this bug before with InDesign but now it seems to happen more often when I drag an image from Bridge to an InDesign doc.
    After doing this I'm unable to Save the document or undo/redo anything. I know others have experienced this same bug. The only way I was able to fix the document was to close InDesign (and lose any unsaved changes) and then reopen the document. Then I create a new document and move all of the pages of my document to the new doc and resave it. This seems to stop the problem from happening.
    This is a serious bug: a) It's hard to pin down what causes it but it seems to be permission related to the document b) there is NO way to recover your unsaved changes, you can't copy your objects to a new document and save it as once the program breaks you can't save ANYTHING.
    Has anyone had success permanantly fixing this? Or run into it at all?

    Windows or MacOS?
    Because in Windows you can circumvent this by using the Explorer. I used to drag 'n drop images (ID CS6) and other files all the time - nothing like your problem so far.

  • Why can't I drag and drop images from the browser into other programs?

    Ever since I upgraded to Firefox 4 (even after I upgraded again to Firefox 5) I have been unable to drag images from the browser into other programs, including MS Paint and IcoFx. I receive an error message stating that the file (the address given lists it as being located in the temporary files folder) cannot be found.
    Prior to this I had always been able to conveniently drag and drop images for easy editing without having to save first and then open them. This feature is important to me, as I work with graphics very often, and is still available in Chrome and Internet Explorer. I love Firefox though, and hope that there is something I can do to fix the problem.

    I had this problem on Windows 8.1.1 and iTunes 11.2.2.3
    To resolve it from within Itunes I did :  Edit, Preferences, Sharing.
    I took the tick out of "Share my library on my local network"
    Click OK.
    Closed iTunes/
    Reopened iTunes and I can drag and drop.
    I went back into Edit, Preferences, Sharing and put the tick back and clicked OK.
    Works fine now.

  • How do I get a raw image from "My Pictures" into Photoshop?

    How do I get a RAW image from "My Pictures" into Photoshop? When I send it to Photoshop , it shows up as a grey checkerboard. The title is on the top. Whe I try to send a picture from Camera Raw, it does the same thing.

    Has it ever worked or is this just something that started happening recently?
    Have you tried resetting the photoshop preferences file?
    http://forums.adobe.com/thread/375776?tstart=0
    Have you installed the latest updates for photoshop cs5?
    In photoshop cs5 go to Help>Updates
    To post the system info here on the forum it might depend on your browser, but using firefox as an example, you would open the system info in photoshop, press Copy then OK.
    Here on the forum you would press the ctrl key and paste.

  • Best file for importing images from Illustrator and Photoshop for small file sizes

    Hello Adode consults!
    I'm in the process of preparing an inDesign file for a school project -- I've already had a few harrowing experiences sending large files to the printer that are too large to process (and a very grumpy computer, etc). The end result will be a poster around 36 inches by 4 or 5 feet.
    I'm wondering if there are any best practices for making sure that the files imported into InDesign are a manageable size to begin with. Should I, for instance, be saving each file as a jpeg before placing in Indesign?
    Thanks!
    -Katherine

    No, you should not save every file as JPG before placing it in INDesign. JPG is only usefull for raster images (like photos) without any transparency in high quality.
    When you place images use:
    For raster images from Photoshop psd (rgb with color profile)
    For raster images from Photoshop with form layers, texts or any vector element use PDF (or PDP) with layers.
    For vector graphics from Illustrator use AI files or PDF.
    For layouts from other InDesign projects use either the INDD itsself or export a PDF/X4.
    But to the printer deliver a PDF according to their standards. E.g. when they need CMYK files export as PDF/X1a with the required output color space and the resolution they want. Produce the pdf via Export (Print).
    Don't deliver open INDD. File size should for printing projects not be an issue.

  • Importing Images from iPhoto 11 into Elements 12 Organizer

    A friend is having lots of trouble trying to move his images from iPhoto 11 into the Elements Organizer, version 12.
    Someone tried to do it for him and he has hundreds of folders in the organizer that don't make any sense and often have only one image in them.
    To help him I would like to do two things:
    1.  How can we delete the entire import and start over?
    2.  What is the correct way to move these images into the elements organizer?
    Thanks for your help.
    Mary Lou
    PS:  It occurs to me that perhaps he needs to export them to his hard drive and then import then into the Organizer.  Might this be correct? If it is, he will still need to get rid of all the folder there now.

    To anwser the two questions you asked-
    1.  How can we delete the entire import and start over? : You may select all media in Elements Organizer grid (which he imported from iPhoto) and hit Delete key
    2.  What is the correct way to move these images into the elements organizer? : The correct way is what he already did. Actually the folder naming convention is same as that of iPhoto. If you see the package contents of iPhoto Library, these folders can be seen there as well. When importing in Elements Organizer, it creates a copy of the iPhoto folder structure and then imports in the catalog.
    Thanks
    Andaleeb

  • I am trying to import developed images from LightRoom 5 into Photoshop 6.  I am receiving this message and the images will not open.....'Could not open scratch file because the file is locked, you do not have necessary access permissions or another progra

    I am trying to import developed images from LightRoom 5 into Photoshop 6.  I am receiving this message and the images will not open.....'Could not open scratch file because the file is locked, you do not have necessary access permissions or another program is using the file.  Use the 'properties' command in the Windows Explorer to unlock the file'.  This has not happened before.  How do I change this?

    Could not open a scratch file because the file is locked or you do not have the necessary access privileges. (…) | Mylen…
    Mylenium

  • Cannot place files from Bridge CC into Indesign CC 2014. No option for anything except Photoshop.

    I can no longer place files from Bridge CC into Indesign CC 2014. No option for anything except Photoshop.

    I can no longer place files from Bridge CC into Indesign CC 2014. No option for anything except Photoshop.

  • I used to be able to copy and paste images from the internet into keynote slides and pages. Now when I copy and paste all I get is an empty  box. My iskysoft iTube studio has also stopped downloading videos. Is there an extension I need to enable?

    I used to be able to copy and paste images from the internet into keynote slides and pages. Now when I copy and paste all I get is an empty  box. My iskysoft iTube studio has also stopped downloading videos. Is there an extension I need to enable? Any ideas

    Try dragging the image to the desktop, then drag the image to the slide you want it on

  • Since I downloaded the latest PSE12 update, when I download images from my camera into Organizer on my iMac, the application freezes.

    Since I installed the latest PSE12 update, when I download images from my camera into Organizer on my iMac, the application freezes.  If I "force quit" then it seems to download them, but will do nothing else, including verifying and deleting the images from my camera.  It worked fine prior to the update.

    Dear Steve--
        You are the man--a true Apple genius. Your suggestion worked.
        Thanks you so much.
      Charlie Jarowski

  • How do I extract multiple tracks from a CD into a single file in Audition CS6?

    I use Audition to edit my Pastor's messages. The message CD is made with five minute tracks. I want to extract the tracks from the CD into a single file for editing and altering the track lengths. I have done this before in Audition CS6, but I haven't been able to find instructions for it. I only found a note stating this is available in AuditionCC.

    I have discovered an answer to my problem. The way to bring multiple tracks into Audition CS6 from a CD is to use the FILE / OPEN APPEND / TO NEW command. This brings the separate tracks into a single file in Audition CD6. Thanks to everyone who commented.

  • How to read from and write into the same file from multiple threads?

    I need to read from and write into a same file multiple threads.
    How can we do that without any data contamination.
    Can u please provide coding for this type of task.
    Thanks in advance.

    Assuming you are using RandomAccessFile, you can use the locking functionality in the Java NIO library to lock sections of a file that you are reading/writing from each thread (or process).
    If you can't use NIO, and all your threads are in the same application, you can create your own in-process locking mechanism that each thread uses prior to accessing the file. That would take some development, and the OS already has the capability, so using NIO is the best way to go if you can use JDK 1.4 or higher.
    - K
    I need to read from and write into a same file
    multiple threads.
    How can we do that without any data contamination.
    Can u please provide coding for this type of task.
    Thanks in advance.

  • Why can´t i change language inside PsCC from Danish to English? Instead of going into Program:Adobe. Locales: rename file from .tw10428.dat into tw10428.bat file??

    Why can´t i change language inside PsCC from Danish to English? Instead of going into Program:Adobe. Locales: rename file from .tw10428.dat into tw10428.bat file??

    Creative Cloud Help / Adjust the install language | Creative Cloud applications | CCM -
    http://helpx.adobe.com/creative-cloud/kb/change-installed-language.html

  • How can I convert my Open Source document files into Word document files? I cannot download Pages since my Macbook Air does not have the most recent software.

    How can I convert my Open Source document files into Word document files? I cannot download Pages since my Macbook Air does not have the most recent software. I downloaded open office to my mac to try and save money. It worked well for a while. Now I get this pop-up message that asks me to "Reopen" and when I select the option, nothing happens. I cannot save my documents anymore and I cannot convert them to word. Help!

    dwb wrote:
    Does OpenOffice output Word documents by default or do you have to select it manually?
    You have 17 options to save as in Open Office, one of which is .doc  files,  yes it needs to be saved manually.
    You may be able to default to DOC, but have not tried same.
    Since Open Office is 99% same as Word, I use it, or Word, either one.  Open Office is a bit less buggy than Word 11'

Maybe you are looking for

  • Safari keeps crashing

    I am having a problem with Safari crashing. I posted in another thread and was advised to start a new thread. Here is my original post, followed by some additional information, and finally my crash log: I am also having a problem with Safari crashing

  • Want to use ouput of a report in my program

    Hi all,       I want to use the output of report rm07mlbd(stock on posting date) in my report program. How do I get the same done.

  • Java.lang.ClassNotFoundException: oracle.spatial.geometry.JGeometry

    I have installed UIM 7.2.2 on Oracle Linux 5.6_64 bit. There was no error message during the installation. But we are getting java.lang.ClassNotFoundException: oracle.spatial.geometry.JGeometry exception during runtime, specially while opening UIM ho

  • 356mb back up in 12 hours!

    Brand new 1TB TC. Has taken several days to get the thing working after the repeated "making back up disk available" message and then errors. Been through the trouble shooting tips step by step and searched on this forum. Last night (hallelujah!), it

  • FREEEEE struts/jsp editor plugin for Eclipse

    Hi guys, I am tired of searching for struts/jsp editor plugin for Eclipse. I tried the trail version for Exadel, My eclipse, Lomboz, but none of them are good enough. I dont want to pay for a plugin. So I downloaded Netbeans IDE which has good suppor