danfickle/openhtmltopdf

Unable to use SVG Image in PDF using PdfRendererBuilder

kiranduba opened this issue · 0 comments

Im trying to add SVG image in HTML which will be later converted to HTML using PdfRendererBuilder class. But SVG image is not getting added in PDF.

Code :

    final PdfRendererBuilder builder = new PdfRendererBuilder();

    builder.withHtmlContent(content, null);
    builder.useSVGDrawer(new BatikSVGDrawer());

    try {
        builder.toStream(
                new FileOutputStream("C:\\Codebase\\spring\\pdf\\src\\main\\java\\pdfbox\\FinalSVG.pdf"));
        builder.run();
    } catch (final Exception e) {
        e.printStackTrace();
    }

HTML Code - is attached
Im using openhtmltopdf-pdfbox 1.0.5 & openhtmltopdf-svg-support 1.0.6 libraries.
Please any guidance would be of great help
testhtmlcode.txt