[poppler] [RFC] PDF Modification in poppler

Julien Rebetez julien at fhtagn.net
Fri Aug 18 08:05:59 PDT 2006


Le vendredi 18 août 2006 à 09:04 -0400, Leonard Rosenthol a écrit :
> 1) You write all strings as Hex - that makes the file larger.  You 
> shouldn't need to do that.
> 2) The Save code all assumes that you are writing to a file.  Since 
> reading supports reading from a "generic stream" - it would be 
> worthwhile to do the same for writing.  That would provide more 
> future expansion/flexibility.
> 3) You might find that floating point values get written out with 
> more decimal places than you'd like - so consider limiting to 3 or 4 
> (or a user-setting).
I agree with all the three points.

> 4) You decompress ALL streams and write them out 
> uncompressed.  OUCH!   I would take the approach that if the stream 
> object is untouched, just copy the bytes "raw" from the original file 
> to the new one.  Faster (no decompression!) and smaller output files.
This is a good idea.
I'll also eventually need a stream encoder to encode the modified ones,
but this will be in a far future.

> 5) I didn't look at an output file, but I think you are outputting 
> MUCH MORE whitespace than necessary.
You're probably right, I'll try to reduce them to what is required by
the specs.

> 6) I don't see you updating the ID for either write.  For 
> incremental, you update only the second value, for a full, you need a 
> completely new ID.
Oups! I forgot that !
> 
> 
> >One things that isn't implemented at the moment is the update of direct
> >Objects. For example, the Annotation may be direct Objects (directly
> >contained in the Page dict "Annots" entry). If the client updates a
> >direct Annotation, the whole first 'indirect-parent' Object (probably
> >the Page dict in our example) must be updated through setModifiedObject.
> >This is, at least, the only solution I see for direct Objects update,
> >but perhaps other people have other ideas.
> 
>          Either that or convert the direct object to an indirect...
Nice idea, I'll try that.

Thanks you for the comments :-)

Julien





More information about the poppler mailing list