You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-dev@xmlgraphics.apache.org by Vincent Hennebert <vh...@gmail.com> on 2012/02/27 13:08:05 UTC
Implementing PDF Object Streams
Hi,
Now that the accessibility code has been re-architectured and does no
longer have feature limitations, we would like to work on improving the
size of accessible PDF files.
The structure tree of a document is stored in the form of PDF objects.
Contrary to the content presentation (the drawing commands stored in the
page streams), it is not compressed and quickly causes the file size to
blow up. On a typical 20-page document the structure tree can take up to
70% of the file size.
We would like to implement PDF Object Streams as defined in the PDF 1.5
Reference. In short, the structure tree would be stored inside a stream
to allow for compression in the same way as the page content.
This has implications on how to refer to those objects, which can no
longer be done using the classic cross-reference table. For that we need
to implement the new cross-reference stream defined in the 1.5 spec.
The compression of the structure tree would be optional and enabled only
when 1.5 has been selected as the minimum PDF version.
Like for the accessibility re-architecturing we will work on a branch
and launch a vote once we feel it’s ready to be merged to Trunk.
Any comments welcome.
Thanks,
Vincent
Re: Implementing PDF Object Streams
Posted by mehdi houshmand <me...@gmail.com>.
Hi Craig,
Just out of curiosity, what issues are you having with the
pdf-image-plugin? I spent quite a lot of time with it and submitted a
patch to Jeremias (not sure if he's committed it). Maybe we could help
you there? We've also got some commits lying around that we're not
happy with per-se because they sacrifice rendered fidelity for file
size that may help you.
Let us know what you've done and what you're trying to do in a new
thread and I'll let you know if we can help.
Mehdi
On 28 February 2012 00:39, Craig Ringer <ri...@ringerc.id.au> wrote:
> On 27/02/2012 8:08 PM, Vincent Hennebert wrote:
>>
>> We would like to implement PDF Object Streams as defined in the PDF 1.5
>> Reference. In short, the structure tree would be stored inside a stream
>> to allow for compression in the same way as the page content.
>
> What's the status of object stream support in PDFBox? Is it possible the
> feature is bettern implemented by adopting a PDFBox based backend?
>
> There's been long term planning talk of moving over to PDFBox as the
> underlying PDF support library. It'd massively simplify work with PDF-in-PDF
> embedding, reduce maintenance work, etc. Is it worth doing major enhancement
> work on fop's pdf library if it may go away in future?
>
> I'm struggling with getting fop and pdfbox to play well together at the
> moment as I work on enhancing fop-pdf-image to merge duplicate font subsets.
> The use of two different pdf libraries makes fop-pdf-image much more complex
> and makes working with fonts a lot harder. I'm sure it's not the only area
> where a pdfbox-based backend might be good.
>
> --
> Craig Ringer
Re: Implementing PDF Object Streams
Posted by Vincent Hennebert <vh...@gmail.com>.
Hi Craig,
On 28/02/12 00:39, Craig Ringer wrote:
> On 27/02/2012 8:08 PM, Vincent Hennebert wrote:
>> We would like to implement PDF Object Streams as defined in the PDF 1.5
>> Reference. In short, the structure tree would be stored inside a stream
>> to allow for compression in the same way as the page content.
> What's the status of object stream support in PDFBox? Is it possible the
> feature is bettern implemented by adopting a PDFBox based backend?
>
> There's been long term planning talk of moving over to PDFBox as the
> underlying PDF support library. It'd massively simplify work with PDF-in-PDF
> embedding, reduce maintenance work, etc. Is it worth doing major enhancement
> work on fop's pdf library if it may go away in future?
This is something that crossed my mind actually. Honestly I don’t have
a definite answer to this.
We would have to check whether PDFBox provides all the functionalities
that the FOP PDF library has. Assuming this is the case, we would have
to write a DocumentHandler/Painter implementation based on PDFBox, which
is a major task.
Then there is the problem of maintenance of such a renderer. How much
work would that be to keep it in sync with the PDFBox library? There
will inevitably be some overhead caused by the external dependency.
On the other hand, the FOP PDF library has serious design flaws that
make it impractical to use and enhance. Fixing those design flaws would
require to heavily modify it, in which case we might as well restart
with a more sound base.
But this is something that we can do progressively, while keeping the
renderer functional. We would have control over when and how we do the
refactoring.
So, while I can see the interest of having a PDFBox-based renderer, I’m
not too sure about how to proceed. Other opinions are welcome.
> I'm struggling with getting fop and pdfbox to play well together at the moment
> as I work on enhancing fop-pdf-image to merge duplicate font subsets. The use
> of two different pdf libraries makes fop-pdf-image much more complex and makes
> working with fonts a lot harder. I'm sure it's not the only area where a
> pdfbox-based backend might be good.
>
> --
> Craig Ringer
Vincent
Re: Implementing PDF Object Streams
Posted by Craig Ringer <ri...@ringerc.id.au>.
On 27/02/2012 8:08 PM, Vincent Hennebert wrote:
> We would like to implement PDF Object Streams as defined in the PDF 1.5
> Reference. In short, the structure tree would be stored inside a stream
> to allow for compression in the same way as the page content.
What's the status of object stream support in PDFBox? Is it possible the
feature is bettern implemented by adopting a PDFBox based backend?
There's been long term planning talk of moving over to PDFBox as the
underlying PDF support library. It'd massively simplify work with
PDF-in-PDF embedding, reduce maintenance work, etc. Is it worth doing
major enhancement work on fop's pdf library if it may go away in future?
I'm struggling with getting fop and pdfbox to play well together at the
moment as I work on enhancing fop-pdf-image to merge duplicate font
subsets. The use of two different pdf libraries makes fop-pdf-image much
more complex and makes working with fonts a lot harder. I'm sure it's
not the only area where a pdfbox-based backend might be good.
--
Craig Ringer