public class PDFtoHTML5Converter
extends org.jpedal.examples.BaseConverter
The following set of examples demonstrates some of the most common uses of PDFtoHTML5Converter
This example includes a fully-featured HTML5 document viewer the converted PDF file is displayed within. This mode is recommended for users who would like a configurable viewer solution with minimal setup.
HTMLConversionOptions conversionOptions = new HTMLConversionOptions();//Set conversion options here
conversionOptions.setDisableComments(true);
IDRViewerOptions viewerOptions = new IDRViewerOptions();//Set viewer options here
File pdfFile = new File("C:/MyDocument.pdf");
File outputDir = new File("C:/MyOutputDirectory/");
//Alternative constructor exists for converting from byte array
PDFtoHTML5Converter converter = new PDFtoHTML5Converter(pdfFile, outputDir, conversionOptions, viewerOptions);
try {
converter.convert();
} catch (PdfException e) {
e.printStackTrace();
}
This example converts PDF files in a simple way that allows the output to be built upon, for example for to build a custom viewer solution around the content or to use within a CMS/ERP system. Also included in the output is a properties.json file that includes information that could help build your viewing solution such as the page count, page bounds, title/author (if set), as well as any bookmarks the PDF file contains.
HTMLConversionOptions conversionOptions = new HTMLConversionOptions();//Set conversion options here
conversionOptions.setDisableComments(true);
ContentOptions contentOptions = new ContentOptions();//Set content options here
File pdfFile = new File("C:/MyDocument.pdf");
File outputDir = new File("C:/MyOutputDirectory/");
//Alternative constructor exists for converting from byte array
PDFtoHTML5Converter converter = new PDFtoHTML5Converter(pdfFile, outputDir, conversionOptions, contentOptions);
try {
converter.convert();
} catch (PdfException e) {
e.printStackTrace();
}
The following set of examples demonstrates some of the most common uses of PDFFormtoHTML5Converter
This example converts PDF Forms using our fully featured forms viewer
HTMLConversionOptions conversionOptions = new HTMLConversionOptions();//Set conversion options here
FormViewerOptions formViewerOptions = new FormViewerOptions();//Set viewer options here
File pdfFile = new File("C:/MyDocument.pdf");
File outputDir = new File("C:/MyOutputDirectory/");
//Alternative constructor exists for converting from byte array
PDFtoHTML5Converter converter = new PDFtoHTML5Converter(pdfFile, outputDir, conversionOptions, formViewerOptions);
try {
converter.convert();
} catch (PdfException e) {
e.printStackTrace();
}
Constructor | Description |
---|---|
PDFtoHTML5Converter(byte[] pdfFileAsBytes,
File outputDirectory,
HTMLConversionOptions htmlConversionOptions,
OutputModeOptions outputModeOptions) |
Constructs a new PDFtoHTML5Converter.
|
PDFtoHTML5Converter(File pdfFile,
File outputDirectory,
HTMLConversionOptions htmlConversionOptions,
OutputModeOptions outputModeOptions) |
Constructs a new PDFtoHTML5Converter.
|
Modifier and Type | Method | Description |
---|---|---|
void |
convert() |
Start converting the PDF file.
|
public PDFtoHTML5Converter(byte[] pdfFileAsBytes, File outputDirectory, HTMLConversionOptions htmlConversionOptions, OutputModeOptions outputModeOptions)
pdfFileAsBytes
- The PDF file you wish to convert in a byte[] array.outputDirectory
- The directory you would like the converted PDF output to.htmlConversionOptions
- The HTMLConversionOptions
object containing the settings to use in the conversion.outputModeOptions
- The OutputModeOptions
object containing the output mode settings to use in the conversion.public PDFtoHTML5Converter(File pdfFile, File outputDirectory, HTMLConversionOptions htmlConversionOptions, OutputModeOptions outputModeOptions)
pdfFile
- The PDF file you wish to convert.outputDirectory
- The directory you would like the converted PDF output to.htmlConversionOptions
- The HTMLConversionOptions
object containing the settings to use in the conversion.outputModeOptions
- The OutputModeOptions
object containing the output mode settings to use in the conversion.public void convert() throws PdfException
org.jpedal.examples.BaseConverter
convert
in class org.jpedal.examples.BaseConverter
PdfException
- When the PDF is corrupt, the password is incorrect, or a JVM option used an unknown value.Copyright 2021 IDRsolutions ltd. All rights reserved.