No bueno.
Each of those slides is made up of a collection of resources & drawing
commands. To determine where one ends and the other starts (and which one
is which), you'd need to parse the page's content stream.
!trivial.
iText includes a basic content tokenizer, but beyond that you're in for a
medium-large amount of research and work to pull this off.
I'll talk you through this particular page's contents to let you know what
you're in for:
q // push the current graphic state onto the state stack
0.1 0 0 0.1 0 0 cm // Concatenate Matrix to 1/10th scale (from the default 1
0 0 1 0 0)
/R7 gs // use an extended graphic state
q // push
0.101562 0 6119.8 7920 re W n // clip to the given REctangle
1 1 1 rg // set the rgb foreground color to white
0.101562 0 6119.8 7920 re // rect
f // fill
0.199951 0.199951 0.199951 rg // new fill color
387.102 4136.9 4201.8 8.20312 re // rect
f // fill
387.102 4136.9 7.79688 3155.2 re //yada yada
f // blah blah
387.102 7283.9 4201.8 8.20312 re
f
4581.1 4136.9 7.79688 3155.2 re
f
Q // pop the graphic state
q // push
395.102 7284.1 m //move to
395.102 4144.9 l // line to
4580.9 4144.9 l //line
4580.9 7284.1 l //line
h // close the path
W n // create a new clipping region
1 1 1 rg // white fill
395.102 4144.9 4185.8 3139.2 re
f
q // push
4186 0 0 3139.5 394.5 4144.5 cm // big numbers due to prior 1/10th matrix
/R8 Do // draw the R8 resource
Q //pop
Q //pop
q //push
419.102 7260.1 m // move, line line line, close, clip
419.102 4290.9 l
2397.9 4290.9 l
2397.9 7260.1 l
h
W n
q//push
1979.5 0 0 2969 418.5 4291 cm // we'd popped back to the 1/10th again
/R9 Do // draw R9
Q // pop
Q //pop
q //push
// lots more of the same till we get down to some text operators
// I'll leave in the intervening content to let you know what
// you're up against.
2333.1 7147.1 m
2333.1 5712.9 l
3927.9 5712.9 l
3927.9 7147.1 l
h
W n
q 1595.5 0 0 1434.5 2332.5 5712.5 cm
/R10 Do
Q
Q
q
1862.1 5769.1 m
1862.1 4303.9 l
3858.9 4303.9 l
3858.9 5769.1 l
h
W n
q 1997 0 0 1465 1861.5 4304 cm
/R11 Do
Q
Q
q
0.101562 0 6119.8 7920 re W n
0.199951 0.199951 0.199951 rg
387.102 336.898 4201.8 8.20312 re
f
387.102 336.898 7.79688 3156.2 re
f
387.102 3484.9 4201.8 8.20312 re
f
4581.1 336.898 7.79688 3156.2 re
f
Q
q
395.102 3485.1 m
395.102 344.898 l
4580.9 344.898 l
4580.9 3485.1 l
h
W n
1 1 1 rg
395.102 344.898 4185.8 3140.2 re
f
q 4186 0 0 3139.5 394.5 345 cm
/R12 Do
Q
Q
q
419.102 3461.1 m
419.102 1101.9 l
1678.9 1101.9 l
1678.9 3461.1 l
h
W n
q 1260 0 0 2358.5 418.5 1102 cm
/R13 Do
Q
Q
q
395.102 3485.1 m
395.102 344.898 l
4580.9 344.898 l
4580.9 3485.1 l
h
W n
1 1 1 RG // sets the foreground color to white
1 1 1 rg
// ******** And here comes the text ********
q
10 0 0 10 0 0 cm // 1/10th * 10. An odd way to go about things
BT // begin a text object
/R14 17 Tf // set the current font
1 0 0 1 242.9 249.85 Tm // set the Text Matrix
// my content editor turns odd binary values into {hex hex}
// so bear with me:
({01}{02}{03}{04}{03}{04}{05}{03}{06}{07}{08} \n{0b}{0c})Tj // draw some
characters
-41.45 -20.8 Td //
(\r{03}{0b}{0e}{07}{0f}{03}{0b}{07}\n{08}{07}\n{0b}{07}{08}
{03}{07}{10}\n{08}{08}{10}{03}{07} {11}{08}{03}{10}{07}\n{12})Tj
84.4 -20.8 Td // move the start of the next line
({13}{14}{05}{15}\n{16})Tj // draw more text
ET // end text object
// and then we're back to more of the same
Q
Q
q
419.102 344.898 4161.8 779.203 re W n
q 4186 0 0 802 418.5 321.5 cm
/R16 Do
Q
Q
Q
---------------------------
So given all that STUFF, you need to parse it, interpret it, and figure out
which resource is used where. You can then determine the resource names of
things used outside the page's media box (or whichever page pox you're
altering), and remove them from the page's resource dictionary... then do
the whole removeUnusedObjects() thing.
Have fun. :\
--
--Mark Storer
Professional Geek
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/