Provided that you replace the ENTIRE object (with all associated
elements in the dictionary), then it should be fine to replace Form
XObjects as well.
Leonard
On May 5, 2008, at 11:43 AM, Lars Eirik Rønning wrote:
Thanks Leonard.
Would you or anyone else care to elaborate on your statement "The
replacement works fine for raster images, but not for the Form
XObjects".
In my case I know that there will either be Xobject of the subtype
image or form. I also need to be able to replace existing text
(from illustrator as xobjects) and graphic symbols (vectors)
Can you verify that replacing this with new elements should work
fine without corrupting the pdf.
On Mon, May 5, 2008 at 5:28 PM, Leonard Rosenthol
<[EMAIL PROTECTED]> wrote:
You can't influence either - they will do what they want when
authoring. So you'll need to write more complex code to deal with
the problem...
Remember that XObjects can either be simple raster images OR
complex "mini-PDFs". The replacement works fine for raster images,
but not for the Form XObjects...
Leonard
On May 5, 2008, at 8:18 AM, Lars Eirik Rønning wrote:
Thanks again.
I have to admit i am not aware how one can influence the creation
of an XObject with a explicit /OC entry using Acrobat or Illustrator.
Are you able to help me with pointers on this issue?
Also I had a look at your receipe for finding the object's
corresponding layer and it was similar to my pseudo code.
Replacing the image with another should be easitily done with
killIndirect and insert a new image right?
On Mon, May 5, 2008 at 4:49 PM, 1T3XT info <[EMAIL PROTECTED]> wrote:
Lars Eirik Rønning wrote:
> I fully understand your concern when it comes to the possibility of
> destroying the output, however in our case we have full control
of the
> original pdf that will be read.
OK.
> The idea is that someone with esthetics produce a nice pdf.
I have a counter-question: can this person produce a PDF
whare the XObjects have the /OC entry in their stream
dictionary? That would make your task so much easier...
> This pdf will then be opened and images and graphics that belong
to a
> certain layer will be replaced with new images.
> Do you still belive that this is a hopeless task?
It's not hopeless, but tricky.
You should parse the content stream (with PRTokeniser
or something else) and look for the PdfName "/OC".
The PdfName that follows this name (for instance "/MC0")
tells you what layer is in play (you can find a reference
to this layer in the /Properties entry of the page's
Resource dictionary). Inside the BMC/EMC sequence that
follows, look for the "Do" operator. The name preceding
this operator refers to the XObject (for instance "/Fm0").
You can find the location of that XObject by inspecting
the /XObjects entry of the page's resource dictionary.
Getting that PRStream with PdfReader and replacing its
data is the easy part. The tricky part is parsing the
content stream to find the layers and the corresponding
XObjects. It gets less tricky if the content stream is
"predictable" (and that's more or less what you're saying).
> We are fully aware that this is not an easy and generalizable
way of
> doing it, but it should be possible?
It may be feasible.
--
This answer is provided by 1T3XT BVBA
---------------------------------------------------------------------
----
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save
$100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://
java.sun.com/javaone
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions
Do you like iText?
Buy the iText book: http://www.1t3xt.com/docs/book.php
Or leave a tip: https://tipit.to/itexttipjar
---------------------------------------------------------------------
----
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save
$100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://
java.sun.com/javaone_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions
Do you like iText?
Buy the iText book: http://www.1t3xt.com/docs/book.php
Or leave a tip: https://tipit.to/itexttipjar
----------------------------------------------------------------------
---
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save
$100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://
java.sun.com/javaone
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions
Do you like iText?
Buy the iText book: http://www.1t3xt.com/docs/book.php
Or leave a tip: https://tipit.to/itexttipjar
----------------------------------------------------------------------
---
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save
$100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://
java.sun.com/javaone_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions
Do you like iText?
Buy the iText book: http://www.1t3xt.com/docs/book.php
Or leave a tip: https://tipit.to/itexttipjar
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions
Do you like iText?
Buy the iText book: http://www.1t3xt.com/docs/book.php
Or leave a tip: https://tipit.to/itexttipjar