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 Jeremias Maerki <de...@jeremias-maerki.ch> on 2007/08/06 17:05:48 UTC

PDF in PDF (experimental)

As you will have seen, I've uploaded some changes into a temporary
branch. I've not committed them to Trunk since I've done some changes at
the lowest level in the PDF library and I've not done very extensive
tests (encryption etc.). I don't want to destabilize the 0.95 release in
case I made a mistake somewhere. If anyone does more extensive tests and
feels that the changes can safely be merged back into Trunk, feel free.
Otherwise, I'll look into it after my holidays.

I've created "PDF in PDF" support in two parts:
1. Changes to core FOP, mainly the PDF library and infrastructure for
the image package and the PDF renderer. (revision 563142)
2. A fully separate package with only the PDF-in-PDF code (with a
dependency on a specially patched PDFBox (didn't work out of the box for
me). I have yet to send a patch to Ben for PDFBox.

Part 2 can be downloaded from my website:
http://www.jeremias-maerki.ch/download/fop/pdf-images/

What this enables is using PDF files as the "src" attribute of an
fo:external-graphic when doing PDF output. This does not work for any
other renderer. If anyone wants to experiment with it, please find more
details/limitations in the README file in the distribution. Feedback is
welcome. The code is to be considered experimental!

The reason why I provide a separate package for the plug-in is that I
needed to use PDFBox to parse the PDF. Of course, I can't just add a new
dependency to FOP without consulting the team.

I wanted to get this off my machine before I finally go off-line (long
holidays until the end of September).

Have fun,
Jeremias Maerki



On 06.08.2007 16:03:02 jeremias wrote:
> Author: jeremias
> Date: Mon Aug  6 07:03:00 2007
> New Revision: 563142
> 
> URL: http://svn.apache.org/viewvc?view=rev&rev=563142
> Log:
> Preparations for supporting "PDF in PDF" (PDF file as "src" attribute for fo:external-graphic).
> 
> Changes in the PDF library:
> - Support all basic PDF objects as generic classes.
> - Reworked some of the PDF classes to use the new generic classes instead of writing to StringBuffers everywhere (less code, less error-prone in the long run).
> - Finished Form XObject support.
> - Manage Image XObjects together with Form XObjects in PDFDocument
> - Tweaked the filters so externally applied filters can more easily be handled.
> 
> Changes to image package:
> - Added a very simple and temporary dynamic registration for image implementations (in order to plug in external image implementations)
> ("temporary" since the image package redesign is still on the task list for this year)
> 
> Changes to the PDF Renderer:
> - Added a PDFImageHandler interface which can be used to create arbitrary XObjects (in the case of PDF-in-PDF: Form XObjects).


Re: PDF in PDF (experimental)

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
Thanks for your feedback, Peter. The bug's fixed.

Jeremias Maerki



On 06.08.2007 21:58:37 Peter wrote:
> Hi Jeremias,
> 
> I am quite interested in this feature and just tried it out. Seems to work for a lot of cases, but I ran into an issue which I guess might interest you.
> 
> If I attempt to render
> 
> <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
>     <fo:layout-master-set>
>         <fo:simple-page-master master-name="Page" page-width="25cm" page-height="30cm">
>             <fo:region-body region-name="Body" />
>         </fo:simple-page-master>
>     </fo:layout-master-set>
>     <fo:page-sequence master-reference="Page">
>         <fo:flow flow-name="Body">
>             <fo:block>
>                 <fo:external-graphic src="../Temp_PDF_in_PDF/src/documentation/content/xdocs/dev/svg/images.pdf" />
>             </fo:block>
>         </fo:flow>
>     </fo:page-sequence>
> </fo:root>
> 
> 
> Where the images.pdf is the images.pdf that one finds after building fop, the resulting pdf seems to be corrupt.
> 
> Enjoy your vacation, or, more likely, I hope you enjoyed your vacation,
> 
> Thanks,
> 
> Peter
> 
> > -----Original Message-----
> > From: Jeremias Maerki [mailto:dev@jeremias-maerki.ch]
> > Sent: Monday, August 06, 2007 5:06 PM
> > To: fop-dev@xmlgraphics.apache.org
> > Subject: PDF in PDF (experimental)
> > 
> > As you will have seen, I've uploaded some changes into a temporary
> > branch. I've not committed them to Trunk since I've done some changes at
> > the lowest level in the PDF library and I've not done very extensive
> > tests (encryption etc.). I don't want to destabilize the 0.95 release in
> > case I made a mistake somewhere. If anyone does more extensive tests and
> > feels that the changes can safely be merged back into Trunk, feel free.
> > Otherwise, I'll look into it after my holidays.
> > 
> > I've created "PDF in PDF" support in two parts:
> > 1. Changes to core FOP, mainly the PDF library and infrastructure for
> > the image package and the PDF renderer. (revision 563142)
> > 2. A fully separate package with only the PDF-in-PDF code (with a
> > dependency on a specially patched PDFBox (didn't work out of the box for
> > me). I have yet to send a patch to Ben for PDFBox.
> > 
> > Part 2 can be downloaded from my website:
> > http://www.jeremias-maerki.ch/download/fop/pdf-images/
> > 
> > What this enables is using PDF files as the "src" attribute of an
> > fo:external-graphic when doing PDF output. This does not work for any
> > other renderer. If anyone wants to experiment with it, please find more
> > details/limitations in the README file in the distribution. Feedback is
> > welcome. The code is to be considered experimental!
> > 
> > The reason why I provide a separate package for the plug-in is that I
> > needed to use PDFBox to parse the PDF. Of course, I can't just add a new
> > dependency to FOP without consulting the team.
> > 
> > I wanted to get this off my machine before I finally go off-line (long
> > holidays until the end of September).
> > 
> > Have fun,
> > Jeremias Maerki
> > 
> > 
> > 
> > On 06.08.2007 16:03:02 jeremias wrote:
> > > Author: jeremias
> > > Date: Mon Aug  6 07:03:00 2007
> > > New Revision: 563142
> > >
> > > URL: http://svn.apache.org/viewvc?view=rev&rev=563142
> > > Log:
> > > Preparations for supporting "PDF in PDF" (PDF file as "src" attribute
> > for fo:external-graphic).
> > >
> > > Changes in the PDF library:
> > > - Support all basic PDF objects as generic classes.
> > > - Reworked some of the PDF classes to use the new generic classes
> > instead of writing to StringBuffers everywhere (less code, less error-
> > prone in the long run).
> > > - Finished Form XObject support.
> > > - Manage Image XObjects together with Form XObjects in PDFDocument
> > > - Tweaked the filters so externally applied filters can more easily be
> > handled.
> > >
> > > Changes to image package:
> > > - Added a very simple and temporary dynamic registration for image
> > implementations (in order to plug in external image implementations)
> > > ("temporary" since the image package redesign is still on the task
> > list for this year)
> > >
> > > Changes to the PDF Renderer:
> > > - Added a PDFImageHandler interface which can be used to create
> > arbitrary XObjects (in the case of PDF-in-PDF: Form XObjects).
> 


RE: PDF in PDF (experimental)

Posted by Peter <pc...@gmail.com>.
Hi Jeremias,

I am quite interested in this feature and just tried it out. Seems to work for a lot of cases, but I ran into an issue which I guess might interest you.

If I attempt to render

<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
    <fo:layout-master-set>
        <fo:simple-page-master master-name="Page" page-width="25cm" page-height="30cm">
            <fo:region-body region-name="Body" />
        </fo:simple-page-master>
    </fo:layout-master-set>
    <fo:page-sequence master-reference="Page">
        <fo:flow flow-name="Body">
            <fo:block>
                <fo:external-graphic src="../Temp_PDF_in_PDF/src/documentation/content/xdocs/dev/svg/images.pdf" />
            </fo:block>
        </fo:flow>
    </fo:page-sequence>
</fo:root>


Where the images.pdf is the images.pdf that one finds after building fop, the resulting pdf seems to be corrupt.

Enjoy your vacation, or, more likely, I hope you enjoyed your vacation,

Thanks,

Peter

> -----Original Message-----
> From: Jeremias Maerki [mailto:dev@jeremias-maerki.ch]
> Sent: Monday, August 06, 2007 5:06 PM
> To: fop-dev@xmlgraphics.apache.org
> Subject: PDF in PDF (experimental)
> 
> As you will have seen, I've uploaded some changes into a temporary
> branch. I've not committed them to Trunk since I've done some changes at
> the lowest level in the PDF library and I've not done very extensive
> tests (encryption etc.). I don't want to destabilize the 0.95 release in
> case I made a mistake somewhere. If anyone does more extensive tests and
> feels that the changes can safely be merged back into Trunk, feel free.
> Otherwise, I'll look into it after my holidays.
> 
> I've created "PDF in PDF" support in two parts:
> 1. Changes to core FOP, mainly the PDF library and infrastructure for
> the image package and the PDF renderer. (revision 563142)
> 2. A fully separate package with only the PDF-in-PDF code (with a
> dependency on a specially patched PDFBox (didn't work out of the box for
> me). I have yet to send a patch to Ben for PDFBox.
> 
> Part 2 can be downloaded from my website:
> http://www.jeremias-maerki.ch/download/fop/pdf-images/
> 
> What this enables is using PDF files as the "src" attribute of an
> fo:external-graphic when doing PDF output. This does not work for any
> other renderer. If anyone wants to experiment with it, please find more
> details/limitations in the README file in the distribution. Feedback is
> welcome. The code is to be considered experimental!
> 
> The reason why I provide a separate package for the plug-in is that I
> needed to use PDFBox to parse the PDF. Of course, I can't just add a new
> dependency to FOP without consulting the team.
> 
> I wanted to get this off my machine before I finally go off-line (long
> holidays until the end of September).
> 
> Have fun,
> Jeremias Maerki
> 
> 
> 
> On 06.08.2007 16:03:02 jeremias wrote:
> > Author: jeremias
> > Date: Mon Aug  6 07:03:00 2007
> > New Revision: 563142
> >
> > URL: http://svn.apache.org/viewvc?view=rev&rev=563142
> > Log:
> > Preparations for supporting "PDF in PDF" (PDF file as "src" attribute
> for fo:external-graphic).
> >
> > Changes in the PDF library:
> > - Support all basic PDF objects as generic classes.
> > - Reworked some of the PDF classes to use the new generic classes
> instead of writing to StringBuffers everywhere (less code, less error-
> prone in the long run).
> > - Finished Form XObject support.
> > - Manage Image XObjects together with Form XObjects in PDFDocument
> > - Tweaked the filters so externally applied filters can more easily be
> handled.
> >
> > Changes to image package:
> > - Added a very simple and temporary dynamic registration for image
> implementations (in order to plug in external image implementations)
> > ("temporary" since the image package redesign is still on the task
> list for this year)
> >
> > Changes to the PDF Renderer:
> > - Added a PDFImageHandler interface which can be used to create
> arbitrary XObjects (in the case of PDF-in-PDF: Form XObjects).