Batik SVG to PDF - PDFTranscoder - missing Labels

82 Views Asked by At

I was converting an SVG File into PDF using Apache Batik but labels are missing in the PDF

The following code is used to generate PDF:

import org.apache.batik.transcoder.TranscoderInput;
import org.apache.batik.transcoder.TranscoderOutput;
...

File svgFile = new File("./target/test.svg");
...

PDFTranscoder transcoder = new PDFTranscoder();
try (FileInputStream fileInputStream = new FileInputStream(svgFile); FileOutputStream fileOutputStream = new FileOutputStream(new File("./target/test-batik.pdf"))) {
    TranscoderInput transcoderInput = new TranscoderInput(fileInputStream);
    TranscoderOutput transcoderOutput = new TranscoderOutput(fileOutputStream);
    transcoder.transcode(transcoderInput, transcoderOutput);
}

Dependency

   <dependency>
     <groupId>org.apache.xmlgraphics</groupId>
     <artifactId>batik-transcoder</artifactId>
     <version>1.10</version>
   </dependency>

How can I convert svg to PDF with labels?

0

There are 0 best solutions below