Copy link to clipboard
Copied
Hi all.
I have inline images anchored to some paragraphs of a text.
How do I get those paragraphs with images?
Thanks in advance.
If a paragraph contains an inline image, it contains a rectangle. Two way to go about finding them:
1. Test every paragraph for the presence of rectangles:
if (myParagraphs.rectangles.length > 0) {
2. Find all anchors, then get their parent paragraphs:
app.findGrepPreferences = null;
app.findGrepPreferences.findWhat = '~a';
inlines = xxx.findGrep();
// Now iterate through inlines
Peter
Copy link to clipboard
Copied
If a paragraph contains an inline image, it contains a rectangle. Two way to go about finding them:
1. Test every paragraph for the presence of rectangles:
if (myParagraphs.rectangles.length > 0) {
2. Find all anchors, then get their parent paragraphs:
app.findGrepPreferences = null;
app.findGrepPreferences.findWhat = '~a';
inlines = xxx.findGrep();
// Now iterate through inlines
Peter
Copy link to clipboard
Copied
Hi Peter,
it does not necessarily mean a rectangle. Could be an oval or polygon as well.
What I do not know, so this question goes to the OP laindustia:
Would you like to find paragraphs that contain nested structures like e.g. groups that contain images as well?
Or that contain tables that contain images as well?
Regards,
Uwe
Copy link to clipboard
Copied
> it does not necessarily mean a rectangle. Could be an oval or polygon as well.
True. But it gives the op something to go on. Anyway, instead of rectangles, use pageItems and do some further test(s).
P.
Copy link to clipboard
Copied
All my images are in rectangles non grouped by now. Maybe ovals later.
Copy link to clipboard
Copied
The first way works fine.
Thanks very much, pkahrel.