As of v2016R2.05 of jPDFWeb, when converting a page to SVG, there are multiple zoom / sizing options for the output SVG file. These options determine how the SVG element will fit into a parent container:

  • Normal zoom mode (this is the default mode) means that the scale remains the same when the viewer is resized
  • FitPage zoom mode changes the scale when the viewer is resized so that the page is displayed using the maximum available space
  • FitWidth zoom mode changes the scale when the viewer is resized so that the full width of the page is displayed using the maximum available space. (Not compatible with FireFox).

Sample Java code to change zoom option using the SVGOptions class:

// Load the document
PDFWeb svg = new PDFWeb ("test.pdf", null);			
SVGOptions options = new SVGOptions();			
System.out.println("Current Setting:" + options.getZoomMode());
// Convert to SVG
svg.savePageAsSVG(0, options, "output" + options.getZoomMode() + ".svg");
System.out.println("Conversion complete!");		
System.out.println("-----------------------------------------------");		
// Set fit Page
options.setZoomMode(SVGOptions.ZoomMode.FitPage);
System.out.println("New Setting:" + options.getZoomMode());
// Convert to SVG
svg.savePageAsSVG(0, options, "output" + options.getZoomMode() + ".svg");
System.out.println("Conversion complete!");
System.out.println("-----------------------------------------------");		
// Set fit Width
options.setZoomMode(SVGOptions.ZoomMode.FitWidth);
System.out.println("New Setting:" + options.getZoomMode());
// Convert to SVG
svg.savePageAsSVG(0, options, "output" + options.getZoomMode() + ".svg");
System.out.println("Conversion complete!");