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 eelboy <ee...@aol.com> on 2013/04/04 21:39:11 UTC

Re: corrupt PDF file - disregard

Doh! Sorry -- just forgot to close the output stream - works like a charm.
Edward

On 04/04/2013 03:31 PM, eelboy wrote:
> Hi,
>
> I am using FOP for the first time to generate PDF files using an XML 
> source file, and an accompanying XSL-FO stylesheet.  From the command 
> line I can issue this command and generate the PDF just fine:
>
> ./fop -xml /some/file.xml -xsl /some/file.xsl -pdf ~/new.pdf
>
> However, in my java application the same source files create a PDF 
> which will not open (one program says it is corrupt, and another says 
> it is encrypted).  I also see they are slightly different in size. I'm 
> probably not setting this up correctly.  Any help would be appreciated 
> - thanks!
>
> Quick java excerpt:
>
> OutputStream out = new BufferedOutputStream(new FileOutputStream(new 
> File(pdfFileName)));
>
> Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, out);
>
> TransformerFactory factory = TransformerFactory.newInstance();
> Transformer transformer = factory.newTransformer(new 
> StreamSource(xslFileName));
>
> Source xml = new StreamSource(new File(xmlFileName));
>
> Result res = new SAXResult(fop.getDefaultHandler());
> transformer.transform(xml, res);
>
>
>
> ---------------------------------------------------------------------
> 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