title: convert pdf to svg
body: <p>I want to convert PDF to SVG please suggest some libraries/executable that will be able to do this efficiently. I have written my own java program using the apache PDFBox and Batik libraries - </p>
  
  <pre><code>PDDocument document = PDDocument.load( pdfFile );
  DOMImplementation domImpl =
      GenericDOMImplementation.getDOMImplementation();
  
  // Create an instance of org.w3c.dom.Document.
  String svgNS = "http://www.w3.org/2000/svg";
  Document svgDocument = domImpl.createDocument(svgNS, "svg", null);
  SVGGeneratorContext ctx = SVGGeneratorContext.createDefault(svgDocument);
  ctx.setEmbeddedFontsOn(true);
  
  // Ask the test to render into the SVG Graphics2D implementation.
  
      for(int i = 0 ; i &lt; document.getNumberOfPages() ; i++){
          String svgFName = svgDir+"page"+i+".svg";
          (new File(svgFName)).createNewFile();
          // Create an instance of the SVG Generator.
          SVGGraphics2D svgGenerator = new SVGGraphics2D(ctx,false);
          Printable page  = document.getPrintable(i);
          page.print(svgGenerator, document.getPageFormat(i), i);
          svgGenerator.stream(svgFName);
      }
  </code></pre>
  
  <p>This solution works great but the size of the resulting svg files in huge.(many times greater than the pdf). I have figured out where the problem is by looking at the svg in a text editor. it encloses every character in the original document in its own   block even if the font properties of the characters is the same. For example the word hello will appear as 6 different text blocks. Is there a way to fix the above code? or please suggest another solution that will work more efficiently.</p>