package jPDFWebSamples; import java.io.File; import java.io.IOException; import java.io.PrintWriter; import com.qoppa.pdf.PDFException; import com.qoppa.pdfWeb.PDFWeb; public class ConvertPDFToHTML { public static void main (String [] args) { try { PDFWeb pdfWeb = new PDFWeb("C:\\mydoc.pdf", null); // create a writer for the output file File outputFile = new File("mydoc.html"); PrintWriter outWriter = new PrintWriter(outputFile, "UTF-8"); writeHTML(pdfWeb, outWriter); System.out.println("Done! Look at file " + outputFile.getAbsolutePath()); } catch (Throwable t) { t.printStackTrace(); } } // Write pages as HTML public static void writeHTML(PDFWeb pdfweb, PrintWriter outWriter) throws PDFException, IOException { // Start HTML page outWriter.println( "\n" + "\n" + "\n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " "); // Convert pages for(int i = 0; i < pdfweb.getPageCount(); i++) { pdfweb.savePageAsSVG(i, outWriter); outWriter.println("
"); } // End HTML page outWriter.println(""); outWriter.println(""); } }