Hi all,

 

Problem solved, by using the latest version of Batik (1.5)

--------

David

 

-----Mensaje original-----
De: Carmona Perez, David
En
viado el: viernes, 08 de agosto de 2003 11:43
Para: Itext-Questions (E-mail)
Asunto: RV: [iText-questions] SVG graphics

 

I’ve tried the same code with a simple SVG, and it works.

Does someone know if scaling and translation of the input data is done automatically?

--------

David

 

-----Mensaje original-----
De: Carmona Perez, David
Enviado el: viernes, 08 de agosto de 2003 11:19
Para: Itext-Questions (E-mail)
Asunto: [iText-questions] SVG graphics

 

Hi all,

 

I’ve tried this example of Paolo that I’ve found in the archives to render a SVG file:

 

> There are a lot of misunderstandings here:
> 
> - the last iText version supports all the PNG types in the codec package.
> 
> - you don't have to convert the SVG drawings to raster. iText can read SVG
> with batik and maintain the vector and text characteristics of the
> original.
> Use the following code as a start:
> 
> PdfContentByte cb = writer.getDirectContent();
> Graphics2D g2 = cb.createGraphics(500, 500);
> PrintTranscoder prm = new PrintTranscoder();
> TranscoderInput ti = new TranscoderInput("file:///C:/mapWaadt.svg");
> prm.transcode(ti, null);
> PageFormat pg = new PageFormat();
> Paper pp= new Paper();
> pp.setSize(500, 500);
> pp.setImageableArea(0, 0, 500, 500);
> pg.setPaper(pp);
> prm.print(g2, pg, 0);
> g2.dispose();

 

I get PDF file with a blank page.

 

Probably is a problem related with coordinates.

 

The SVG file I’m trying to render is of the following form:

 

<svg viewBox="8.28 -2020 3860.88 2550.68">

</svg>

 

where 8.28 is the minimum X, -2020 the minimum y, 3860.88 the width and 2550.68 the height.

 

Do I need some translation for taking into account the negative minimum y?

 

Thanks in advance for any help.

--------

David

 

Reply via email to