You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by acarrascal <al...@gmail.com> on 2013/02/15 07:07:39 UTC

PDF pagination

Hi all,

I'm trying to export pdf reports by converting original SVG documents. This
is the code I'm using to do it:

public static void renderReport(Document document, File file) throws
IOException, TranscoderException,
           TransformerException {
       OutputStream outputStream = new FileOutputStream(file);
       try {
           TransformerFactory transformerFactory =
TransformerFactory.newInstance();
           Transformer transformer = transformerFactory.newTransformer();
           transformer.setOutputProperty(OutputKeys.INDENT, "yes");
          
transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount",
"4");
           DOMSource domSource = new DOMSource(document);
           StreamResult streamResult = new StreamResult(System.out);
           transformer.transform(domSource, streamResult);
           TranscoderInput transcoderInput = new TranscoderInput(document);
           TranscoderOutput transcoderOutput = new
TranscoderOutput(outputStream);
           Transcoder transcoder = new PDFTranscoder();
           transcoder.transcode(transcoderInput, transcoderOutput);
           outputStream.flush();
       } finally {
           outputStream.close();
       }
   }


The question is: is there any supported batik feature to paginate final pdf
reports? any idea?

Thanks



--
View this message in context: http://batik.2283329.n4.nabble.com/PDF-pagination-tp4655467.html
Sent from the Batik - Users mailing list archive at Nabble.com.

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


Re: PDF pagination

Posted by DeWeese Thomas <th...@gmail.com>.
The FOP library supports pagination with SVG but you need to create an FO document.
The underlying PDFGraphics2D that is used when going to PDF also has some support 
but you will need to write your own code around it.

On Feb 15, 2013, at 1:07 AM, acarrascal <al...@gmail.com> wrote:

> Hi all,
> 
> I'm trying to export pdf reports by converting original SVG documents. This
> is the code I'm using to do it:
> 
> public static void renderReport(Document document, File file) throws
> IOException, TranscoderException,
>           TransformerException {
>       OutputStream outputStream = new FileOutputStream(file);
>       try {
>           TransformerFactory transformerFactory =
> TransformerFactory.newInstance();
>           Transformer transformer = transformerFactory.newTransformer();
>           transformer.setOutputProperty(OutputKeys.INDENT, "yes");
> 
> transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount",
> "4");
>           DOMSource domSource = new DOMSource(document);
>           StreamResult streamResult = new StreamResult(System.out);
>           transformer.transform(domSource, streamResult);
>           TranscoderInput transcoderInput = new TranscoderInput(document);
>           TranscoderOutput transcoderOutput = new
> TranscoderOutput(outputStream);
>           Transcoder transcoder = new PDFTranscoder();
>           transcoder.transcode(transcoderInput, transcoderOutput);
>           outputStream.flush();
>       } finally {
>           outputStream.close();
>       }
>   }
> 
> 
> The question is: is there any supported batik feature to paginate final pdf
> reports? any idea?
> 
> Thanks
> 
> 
> 
> --
> View this message in context: http://batik.2283329.n4.nabble.com/PDF-pagination-tp4655467.html
> Sent from the Batik - Users mailing list archive at Nabble.com.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
> 


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