Hauke Ingmar Schmidt wrote:Hej,
we are evaluating to use iText for invoice generation. Right now we have PDF forms that work as layout templates. Filling in and generating the PDFs works. But as soon as fields are filled in the generated PDFs get quite large, from a few kilobytes to megabytes. What is the best way to avoid this? The generated invoices do not need to have any form-related functionality; is it a bad idea to use forms as templates?
Thanks.
Let me give you an example:
I have a
datasheet that is 56.54 KB.
I want to use this template to create a document with 120 pages: one page per movie in my moviedatabase.
If I don't read the documentation, I end up with this
document with file size 4.84 MB.
If I read the documentation, I end up with a
document containing the same information and file size 304.36 KB.
In the first case, the document size consists of 120 times the size of the template + the size of the content of the fields + some necessary overhead. In the second case, the document size consists of 1 times the size of the template + the size of the content of the fields + some necessary overhead. Not using a template will result in a file with about the same size.
Is this more or less the problem you're experiencing?
If not, there are some other reasons why the filesize of a template that is filled in can get huge: are you adding high resolution images? Are you embedding complete fonts? (See
the thread about optimization, more specifically about font subsets.)