Hello,

I don't know batik very well but I use a similar technique to render 
barcodes using Barcode4J (instead of iText's native barcode renderer), 
and can confirm I get vector graphics in the resulting PDF as expected.
So, the problem probably lies either with Batik's output or with the 
PrintTranscoder/TranscoderInput.
Here is the code I use :

// Render the barcode to a PdfTemplate via the template's Graphics2D facade
// 
-----------------------------------------------------------------------------
PdfContentByte cb = writer.getDirectContent();
PdfTemplate tp = cb.createTemplate(width, height);
Graphics2D g2 = tp.createGraphics(width, height, new DefaultFontMapper());

// Barcode4J uses mm, iText uses points, so we have to scale the Graphics2D
g2.scale(UnitConv.mm2pt(1), UnitConv.mm2pt(1));

// Let Barcode4J draw the barcode to our Graphics2D object
// --------------------------------------------------------
Java2DCanvasProvider provider = new Java2DCanvasProvider(g2);
gen.generateBarcode(provider, barcodeMessage);

g2.dispose();

// Wrap the PdfTemplate holding our barcode into an Image
// --------------------------------------------------------
Image barcodeImg = Image.getInstance(tp);

Then the PdfTemplate or Image can be added to a Document, 
PdfContentByte, etc.

Jörn Stuphorn a écrit :
> Hello.
>
> I have a graph as SVG and want to save it as a PDF file using itext.
> The graph is rather large so I don't want to convert the graph into
> bitmap graphics.
>
> Has anyone hints how to achieve this?
> I have tried the code Paulo Soares mentioned in
> http://sourceforge.net/mailarchive/message.php?msg_id=6886596
>
> This does however does not maintain the text and vector characteristics
> (at least here with me). On my computer (Linux, Java 1.4, batik 1.6,
> itext 1.4) the svg graph is converted into a bitmap and embedded in the
> pdf file. [...]



-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to