[poppler] Incremental update in poppler
Julien Rebetez
julien at fhtagn.net
Tue Jul 11 13:34:31 PDT 2006
Hi,
I'm working on 'Interactive PDF form support in Evince' during this
summer (Google SoC project).
I started to implement pdf write support in poppler through incremental
update, you can find my current patch here (it also contains the
interactive form part.. and it's far from finished):
http://fhtagn.net/soc/poppler_patch_07092006.diff
If you want to test the whole thing, read the instructions here:
http://live.gnome.org/Evince/Forms
The main change is the addition of the 'addIncrementalObject' function
to PDFDoc :
When you call this function, the object given as argument is 'queued' in
the document.
The next time 'PDFDoc::SaveAs' is called, all the queued objects are
written (with a new XRef/Trailer and all the needed stuff) to the file.
This part works almost correctly (though Acrobat wants to repair the
updated file before reading it).
Now, to explain my problem, I think I should make a little summary on
how things are handled on evince side :
All the field content is stored in Poppler.
When the user focus a field, content is retrieved from poppler, when he
unfocus a field, content is updated in poppler. (here
addIncrementalObject is called to 'save' the updated field).
Until Poppler re-render the page, field content is quickly rendered in
Evince using Pango.
Next time Poppler render the page, it should also render the updated
field content.
The last point is not implemented at the moment (you can 'simulate it'
by saving the document and re-opening it) because Object are only
written to the file when PDFDoc::SaveAs is called.
I'm not a Poppler-guru, but the only way I see to add this 'live update'
feature is that PDFDoc::addIncrementalObject should add the updated
Object/Xref/Trailer directly into the stream.
For MemStream, it's quite easy (since all the document is buffered), but
for FileStream and other where only small part of the document is
buffered, it may become tricky.
I think I could add an additionnal buffer where these new informations
are stored to each Stream and modify all the member functions to handle
it, but perhaps it's not the better approach.
That's all for the moment, I'll be glad to read any idea/critics about
what I did :-)
Thanks for reading and sorry for the bad english,
Julien
P.S: my IRC nick is 'julienr'
More information about the poppler
mailing list