Craig Ringer,
Thank you for your advice.
I know that if I change the object number, all objects reference this object
will have to be changed. And this is really what I want to do.
But now I have a maybe trivial question, that is:
If I have traversed all the objects for references to the object, whose
object number has been changed, and change them one by one, then I write
them back to the file, how about the new generated pdf file, is it a
self-contained one? Or should I do something else before write them back?
Thank you very much.
ZHANG, Yang.
-----邮件原件-----
发件人: Craig Ringer [mailto:[EMAIL PROTECTED]
发送时间: 2007年7月2日 14:41
收件人: [email protected]
抄送: [EMAIL PROTECTED]
主题: Re: [Podofo-users] Help about podofo object numbers.
[EMAIL PROTECTED] wrote:
> Dear Dominik,
> I am using podofo and doing something to change the content of a pdf file.
> I can get the objects in a pdf now and I want to change the object number
of
> the objects. But I found that the PdfObject::Reference() is a const
> function. So how shall I make it? And, if I have changed the object
number,
> is there a simple way to make the pdf still self-contained?
> Thank you.
When you change the object number, you must also find and update any
references to that object number from elsewhere in the PDF. It's really
an operation on the whole document rather than a single object.
You will probably want to create a new PdfObject with the required
object number and set its initial value to the source PdfObject
(actually, it's variant). If it has a stream, you must separately copy
the stream.
The PdfDocument::Append(...) method does part of what you want. It's
written to be efficient when renumbering a large number of objects,
rather than just one, though. It does use PdfVecObjects innards, though,
so be very careful (maybe we need to provide a safer public interface
for this sort of thing?).
--
Craig Ringer
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Podofo-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/podofo-users