🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #15834

Re: Missing images on XML import

#15834
From: Aigars_Grins
Date: Fri, 07 Nov 2003 10:04
26 lines
4160 bytes
Hi all,

I've now solved my problems, in a at least good-enough-for-now manner. So, I'll just quickly write some of the things that I've "found out" (not that you all didn't already know them :)), just in case someone else could use the hints some other time.

If the images get lost, as they did for me (see original post et al), there's at least one way to get them back. Although it might not be the best way, it works, and this is how I did it:

a) Find a way to identify that there is a missing object. In my case the images that where lost where all residing in an otherwise empty Table Cell. So, I could check the original Cell's (before import) AllPageItems() and compare that to the new Cell's (after import). If they compared as 2 to 0 and the 2 items where a Rectangle and an Image, I had a match. Actually the original Cell does contain one Character (I still don't know what Character that it is, but just ignoring that fact seems to work out well anyway).

b) Copy the image from the original Document (before import) to the new one (after import). In my case I used a temporary Library where I Store()'d the Rectangle. Then I set the new Document as ActiveDocument(), the new Spread (in which the Table Cell resides in) as ActiveSpread(), and finally tried to select the Cell. Although since the Cell seems not be a PageItem as well, this last step seems to fail. In any case I continued with Place()'ing the corresponding Asset from the Library (corresponding to the original Rectangle that is). This make a copy of the original Rectangle appear in the new Document. And most importantly it still has all information about the broken Link intact.

c) Set the same boundaries of the newly Place()d objects. By setting GeometricBounds and VisualBounds to the same values that the original objects had it seems they actually get relocated not only spatially but also structurally, that is the new Rectangle actually gets "inside" the new Cell, i.e. it can be found through the new Cell's AllPageItems(). Why this happens I don't know. I haven't checked if the strange single Character just appears there as well, but from a purely graphical point of view a complete copy has now been done of the images even though the Links are all broken.

In the course of trying to figure out this acceptable work-around I stumbled around a lot and discarded a quote a few other alternatives, of which none worked for me. Perhaps they should work, if you just handle them more correctly. Here's a short list of things that didn't work for me:

1) Select()'ing the original containing Cell (the Rectangle is not actually directly located in the Cell but rather in a single Character in the Cell). This didn't work at all - I simply couldn't figure out how to Select() the Character (I've only managed to Select() PageItems, of which Character isn't one).

2) Instead of Select()'ing the Character I've also tried with both InsertionPoints around it. Didn't work either.

3) Nor did it work with Select()'ing the Cell instead.

4) Select()'ing the original Rectangle and cut'n'paste into the new Spread didn't work either, i.e. not using the temporary Library. This didn't work out since the Paste() or PasteInto() always seemed to fail. I probably just Select()'ed the wrong things in the wrong order (Documents and Spreads and whatnots), but still.

If someone needs help with anything similar about automating InDesign 2.0.2 via COM+ in Delphi, just give me a holler (aigars at cryptmedia dot com).

--
Aigars
Technical Details
Message-ID: <2cce25cc.4@webx.la2eafNXanI>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!newsfeed01.sul.t-online.de!t-online.de!webx
References: <2cce25cc.-1@webx.la2eafNXanI>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f939a,c928bd7670cd395b
X-Google-Attributes: gidf939a,public
X-Google-ArrivalTime: 2003-11-07 02:07:54 PST
From: Aigars_Grins@adobeforums.com
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!newsfeed01.sul.t-online.de!t-online.de!webx
Newsgroups: adobe.scripting.indesign
Subject: Re: Missing images on XML import
Message-ID: <2cce25cc.4@webx.la2eafNXanI>
Date: Fri, 7 Nov 2003 02:04:29 -0800
References: <2cce25cc.-1@webx.la2eafNXanI>
Lines: 69
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit