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 Robert Lummert <ro...@lummert.net> on 2007/05/11 02:57:16 UTC

pdf issues

I've got two problems when transforming my svg to pdf.

1. when I pass my (dynamic) svg document to the transcoder

 input = new TranscoderInput(ustva.document);
            //Do the transformation
            try {
                transcoder.transcode(input, output);
            } catch (Exception e) {
                e.printStackTrace();
            }

the document is broken afterwards.

2. I would like to have multiple pages transformed into a single pdf,
but don't know, how.

Any idea? TIA,

    Robert

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


Re: pdf issues

Posted by Robert Lummert <ro...@lummert.net>.
> 
>> 2. I would like to have multiple pages transformed into a single pdf,
>> but don't know, how.
>>
>> Any idea? TIA,
> I use itext for that.
> 
> http://itextdocs.lowagie.com/tutorial/
> 
> see the concatenate-example.
> 
> <dirk />

thanks, that could be a workaround. but in the first place i'm looking
for a way to directly generate a multipaged pdf with the packages i
allready use with my application, as batik and fop.
but a simple style="page-break-before:always;" on the group that holds
the contents of the second page, or passing two different svg-documents
after another to the transcoder with the same transcoder-output ... that
all didn't work.

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


Re: pdf issues

Posted by Dirk Tschentscher <oe...@gmx.de>.
> 2. I would like to have multiple pages transformed into a single pdf,
> but don't know, how.
>
> Any idea? TIA,
I use itext for that.

http://itextdocs.lowagie.com/tutorial/

see the concatenate-example.

<dirk />


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


Re: pdf issues

Posted by Robert Lummert <ro...@lummert.net>.
Manuel Strehl wrote:
> Robert Lummert wrote:
> 
>> 2. I would like to have multiple pages transformed into a single pdf,
>> but don't know, how.
>>  
>>
> I don't know, if this is of any use for you:
> 
> If you have installed the ImageMagick lib and can do it outside Java,
> I'd recommend
> 
> $ convert infiles*.pdf outfile.pdf
> 
> Works fine from the command line.
> 
thanks but i need sth portable as it is the problem of my java/batik
apllication.


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


Re: pdf issues

Posted by Manuel Strehl <ma...@physik.uni-regensburg.de>.
Robert Lummert wrote:

>2. I would like to have multiple pages transformed into a single pdf,
>but don't know, how.
>  
>
I don't know, if this is of any use for you:

If you have installed the ImageMagick lib and can do it outside Java,
I'd recommend

$ convert infiles*.pdf outfile.pdf

Works fine from the command line.

Regards
Manuel


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


Re: pdf issues

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
On 14.05.2007 11:47:00 thomas.deweese wrote:
<snip/>
> > 2. I would like to have multiple pages transformed into a single pdf,
> > but don't know, how.
> 
>    The simplest way to do this would be to construct a FO document
> that references your SVG documents.  The simplest way to do that
> is to write the documents to disk as temp files that the FO document
> refs.
> 
>    I think it would also be possible to do this in a variant of 
> the PDFTranscoder but I don't know the details.

Yes, the class PDFDocumentGraphics2D (which PDFTranscoder uses) has a
public method called nextPage(). So if the PDFTranscoder would be
modified to somehow call that method, it could be done. But I haven't
checked if that would fit into the Transcoder framework.


Jeremias Maerki


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


Re: pdf issues

Posted by th...@kodak.com.
Hi Robert.

Robert Lummert <ro...@lummert.net> wrote on 05/10/2007 08:57:16 PM:

> I've got two problems when transforming my svg to pdf.
> 
> 1. when I pass my (dynamic) svg document to the transcoder
> 
>  input = new TranscoderInput(ustva.document);
>  transcoder.transcode(input, output);
> the document is broken afterwards.

    Yes, this is because the transcoder associates a new Graphics
tree with the document breaking the association with the old tree.
Due to the construction of the SVGDom it's difficult to have one
DOM used for multiple graphics tree.
    I see two potential solutions:
        1) Clone the document before you transcode it, probably by 
         using importNode on a new SVGDocument.
        2) Pass "your own" PDFGraphics2D to the paint method of the
         existing Graphics Tree.

    Both of these have some draw backs, #1 has the problem that
you end up with two copies of the document in memory.  #2 has
the problem that the PDF Transcoder overrides some of the standard
graphics nodes to optimize the generated PDF.  In particular it
replaces the standard ImageNode with one that in the case of JPEG
simply stores the compressed stream into the PDF, and in the case
of text it replaces 'simple' text with a TextNode that does a 
'drawString' (rather than our normal drawGlyphVector).

> 2. I would like to have multiple pages transformed into a single pdf,
> but don't know, how.

   The simplest way to do this would be to construct a FO document
that references your SVG documents.  The simplest way to do that
is to write the documents to disk as temp files that the FO document
refs.

   I think it would also be possible to do this in a variant of 
the PDFTranscoder but I don't know the details.

   Hope that helps...


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