You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Peter Coppens <pc...@gmail.com> on 2008/12/05 16:02:40 UTC

PDF Image extension and encryption don't go together?

Fop fans,

I have the impression that when using e.g. the -noprint fop command line
option while pdf rendering an fo that referers to a pdf as external-graphic,
the pdf is either not included or not included correctly. 

E.g. this fo document reproduces the problem

<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
  <fo:layout-master-set>
      <fo:simple-page-master master-name="pm" page-height="25cm"
page-width="20cm">
        <fo:region-body/>
      </fo:simple-page-master>
  </fo:layout-master-set>
  <fo:page-sequence master-reference="pm">
      <fo:flow flow-name="xsl-region-body">
        <fo:block-container absolute-position="fixed" >
          <fo:block >
            <fo:external-graphic
src="url(http://xmlgraphics.apache.org/fop/0.95/pdfencryption.pdf#1)"
content-height="scale-to-fit" content-width="scale-to-fit"/>
          </fo:block>
        </fo:block-container>
    </fo:flow>
  </fo:page-sequence>
</fo:root>


Thanks

Peter
-- 
View this message in context: http://www.nabble.com/PDF-Image-extension-and-encryption-don%27t-go-together--tp20855649p20855649.html
Sent from the FOP - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: PDF Image extension and encryption don't go together?

Posted by Peter Coppens <pc...@gmail.com>.
Thanks. 

One can also use PDFBox in such a setup. It works in my case and PDFBox is
already part of the FOP PDF image extension. That avoids the platform
problem and does not introduce another dependency to manage. I just wanted
to avoid a two step process.

Peter


> From: Jay Berkenbilt <ej...@ql.org>
> Reply-To: <fo...@xmlgraphics.apache.org>
> Date: Thu, 11 Dec 2008 22:22:51 -0500
> To: <fo...@xmlgraphics.apache.org>
> Subject: Re: PDF Image extension and encryption don't go together?
> 
> Jeremias Maerki <de...@jeremias-maerki.ch> wrote:
> 
>> It appears this is not so simple. Depending on which approach I try I
>> end up missing functionality in either the PDFBox or FOP PDF library
>> APIs to cover that requirement: If I work with the decoded stream but
>> get a PDF with JPEG images I get a warning from PDFBox: "Warning:
>> DCTFilter.decode is not implemented yet, skipping this stream." And the
>> resulting PDF is corrupt. I would need the ability to ignore the DCT
>> filter which is currently not possible. On the other side, if I want to
>> try to just encrypt the undecoded stream AbstractPDFStream currently
>> lacks finer control over the applied filters. So I either have to modify
>> PDFBox or the FOP PDF library for which I don't currently have enough time.
>> It also creates a dependency on a new version of either package. So for
>> now, that means: no support for encrypting PDFs when PDF images are used.
>> If you want to try yourself, feel free.
> 
> Sorry if this is a little bit of a shameless plug, but Linux users
> would most likely be able to use my qpdf software,
> http://qpdf.sourceforge.net/, which can encrypt arbitrary PDF files.
> The licensing terms are relatively unrestrictive (Artistic license),
> so if there's any logic there that you could steal, have at it.  It's
> C++ code, so it would have to be translated, of course.  To use it
> outright, one could generate a non-encrypted PDF with fop and then
> encrypt it with qpdf.  qpdf can also linearize and do other
> transformations on the file.
> 
> I haven't tried this on a PDF file that fop is encrypting incorrectly,
> but I would be willing to try it.  I don't have a windows version of
> qpdf at this time.
> 
> -- 
> Jay Berkenbilt
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: PDF Image extension and encryption don't go together?

Posted by Jay Berkenbilt <ej...@ql.org>.
Jeremias Maerki <de...@jeremias-maerki.ch> wrote:

> It appears this is not so simple. Depending on which approach I try I
> end up missing functionality in either the PDFBox or FOP PDF library
> APIs to cover that requirement: If I work with the decoded stream but
> get a PDF with JPEG images I get a warning from PDFBox: "Warning:
> DCTFilter.decode is not implemented yet, skipping this stream." And the
> resulting PDF is corrupt. I would need the ability to ignore the DCT
> filter which is currently not possible. On the other side, if I want to
> try to just encrypt the undecoded stream AbstractPDFStream currently
> lacks finer control over the applied filters. So I either have to modify
> PDFBox or the FOP PDF library for which I don't currently have enough time.
> It also creates a dependency on a new version of either package. So for
> now, that means: no support for encrypting PDFs when PDF images are used.
> If you want to try yourself, feel free.

Sorry if this is a little bit of a shameless plug, but Linux users
would most likely be able to use my qpdf software,
http://qpdf.sourceforge.net/, which can encrypt arbitrary PDF files.
The licensing terms are relatively unrestrictive (Artistic license),
so if there's any logic there that you could steal, have at it.  It's
C++ code, so it would have to be translated, of course.  To use it
outright, one could generate a non-encrypted PDF with fop and then
encrypt it with qpdf.  qpdf can also linearize and do other
transformations on the file.

I haven't tried this on a PDF file that fop is encrypting incorrectly,
but I would be willing to try it.  I don't have a windows version of
qpdf at this time.

-- 
Jay Berkenbilt

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: PDF Image extension and encryption don't go together?

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
It appears this is not so simple. Depending on which approach I try I
end up missing functionality in either the PDFBox or FOP PDF library
APIs to cover that requirement: If I work with the decoded stream but
get a PDF with JPEG images I get a warning from PDFBox: "Warning:
DCTFilter.decode is not implemented yet, skipping this stream." And the
resulting PDF is corrupt. I would need the ability to ignore the DCT
filter which is currently not possible. On the other side, if I want to
try to just encrypt the undecoded stream AbstractPDFStream currently
lacks finer control over the applied filters. So I either have to modify
PDFBox or the FOP PDF library for which I don't currently have enough time.
It also creates a dependency on a new version of either package. So for
now, that means: no support for encrypting PDFs when PDF images are used.
If you want to try yourself, feel free.

On 07.12.2008 21:56:12 Jeremias Maerki wrote:
> As a performance measure, I have copied the undecoded stream content
> over to the target document which, if encryption is enabled, obviously
> won't work. I'm working on a fix and will get back to you.
> 
> On 05.12.2008 16:02:40 Peter Coppens wrote:
> > 
> > Fop fans,
> > 
> > I have the impression that when using e.g. the -noprint fop command line
> > option while pdf rendering an fo that referers to a pdf as external-graphic,
> > the pdf is either not included or not included correctly. 
> > 
> > E.g. this fo document reproduces the problem
> > 
> > <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
> >   <fo:layout-master-set>
> >       <fo:simple-page-master master-name="pm" page-height="25cm"
> > page-width="20cm">
> >         <fo:region-body/>
> >       </fo:simple-page-master>
> >   </fo:layout-master-set>
> >   <fo:page-sequence master-reference="pm">
> >       <fo:flow flow-name="xsl-region-body">
> >         <fo:block-container absolute-position="fixed" >
> >           <fo:block >
> >             <fo:external-graphic
> > src="url(http://xmlgraphics.apache.org/fop/0.95/pdfencryption.pdf#1)"
> > content-height="scale-to-fit" content-width="scale-to-fit"/>
> >           </fo:block>
> >         </fo:block-container>
> >     </fo:flow>
> >   </fo:page-sequence>
> > </fo:root>
> > 
> > 
> > Thanks
> > 
> > Peter
> > -- 
> > View this message in context: http://www.nabble.com/PDF-Image-extension-and-encryption-don%27t-go-together--tp20855649p20855649.html
> > Sent from the FOP - Users mailing list archive at Nabble.com.
> 
> 
> 
> Jeremias Maerki
> 



Jeremias Maerki


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: PDF Image extension and encryption don't go together?

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
As a performance measure, I have copied the undecoded stream content
over to the target document which, if encryption is enabled, obviously
won't work. I'm working on a fix and will get back to you.

On 05.12.2008 16:02:40 Peter Coppens wrote:
> 
> Fop fans,
> 
> I have the impression that when using e.g. the -noprint fop command line
> option while pdf rendering an fo that referers to a pdf as external-graphic,
> the pdf is either not included or not included correctly. 
> 
> E.g. this fo document reproduces the problem
> 
> <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
>   <fo:layout-master-set>
>       <fo:simple-page-master master-name="pm" page-height="25cm"
> page-width="20cm">
>         <fo:region-body/>
>       </fo:simple-page-master>
>   </fo:layout-master-set>
>   <fo:page-sequence master-reference="pm">
>       <fo:flow flow-name="xsl-region-body">
>         <fo:block-container absolute-position="fixed" >
>           <fo:block >
>             <fo:external-graphic
> src="url(http://xmlgraphics.apache.org/fop/0.95/pdfencryption.pdf#1)"
> content-height="scale-to-fit" content-width="scale-to-fit"/>
>           </fo:block>
>         </fo:block-container>
>     </fo:flow>
>   </fo:page-sequence>
> </fo:root>
> 
> 
> Thanks
> 
> Peter
> -- 
> View this message in context: http://www.nabble.com/PDF-Image-extension-and-encryption-don%27t-go-together--tp20855649p20855649.html
> Sent from the FOP - Users mailing list archive at Nabble.com.



Jeremias Maerki


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org