> -----Original Message-----
> From: kathy [SMTP:[EMAIL PROTECTED]
> Sent: Friday, November 21, 2003 1:58
> To:   iText-FAQ
> Subject:      [iText-questions] About SVG
> 
> Hi,
> 
>     Can we use a column text to output  the svg file being  transcode 
> from batik?
> 
        Why would you want to do that?

>      The following is my algorithm to render a svg in pdf but what i get 
> is a blank page, can someone tell me what is going wrong?
> 
        Probably the dimensions. The svg is probably being rendered outside
the template. Render directly to the page with the full page size in width
and height.

        Best Regards,
        Paulo Soares

>      Thanks.
> 
> public static void renderSVG() {
>         try {
>             PdfWriter writer = null;
>             PdfContentByte cb = null;
>             Document doc = new Document(new Rectangle(576, 792), 30, 30, 
> 30, 30);
>             if (doc != null) {
>                 writer = PdfWriter.getInstance(doc, new 
> FileOutputStream("D:/Temp/SVG.pdf"));
>                 doc.open(); // opem document
>             }
>             if (writer != null) {
>                 cb = writer.getDirectContent();
>                 DefaultFontMapper mapper = new DefaultFontMapper();
>                 mapper.insertDirectory("c:\\winnt\\fonts");
>                 PdfTemplate template = cb.createTemplate(width, height);
>                 Graphics2D g2 = template.createGraphics(width, height);
>                 PrintTranscoder prm = new PrintTranscoder();
>                 TranscoderInput ti = new 
> TranscoderInput("file:///D:/TestMe/images/circle.svg");
>                 prm.transcode(ti, null);
>                 PageFormat pg = new PageFormat();
>                 Paper pp= new Paper();
>                 pp.setSize((double)width, (double)height);
>                 pp.setImageableArea(0, 0, (double)width, (double)height);
>                 pg.setPaper(pp);
>                 prm.print(g2, pg, 0);
>                 g2.dispose();
>                 ImgTemplate img = new ImgTemplate(template);
>                 img.setAbsolutePosition(100, 400);
>                 Chunk chk = new Chunk(img, 0, 0);
>                 ColumnText ct = new ColumnText(cb);
>                 ct.addText(chk);
>                 ct.setSimpleColumn(30, 30+(2*height), 30+width, 
> 30+height, 0, 0);
>                 ct.go();
>                 doc.close(); // close document
>             }
>         } catch (Exception ex) {
>             System.out.println("Rendering SVG exception:
> "+ex.getMessage());
>         }
>     }
> 
> 
> 
> -------------------------------------------------------
> This SF.net email is sponsored by: SF.net Giveback Program.
> Does SourceForge.net help you be more productive?  Does it
> help you create better code?  SHARE THE LOVE, and help us help
> YOU!  Click Here: http://sourceforge.net/donate/
> _______________________________________________
> iText-questions mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/itext-questions


-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?  SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to