Package com.compdfkit.core.convert
Class CPDFGeneration
java.lang.Object
com.compdfkit.core.convert.CPDFGeneration
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumstatic enumstatic interfacestatic interface -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionhtmlToPdfConvert(String htmlPath, String outputPdf, String baseUrl, int width, int height, CPDFGeneration.HtmlToPdfFontListener fontListner) Convert HTML file to PDFhtmlToPdfConvertBatch(CPDFHtmlToPdfTask[] tasks, int width, int height, CPDFGeneration.HtmlToPdfFontListener fontListner, CPDFGeneration.HtmlToPdfProgressListener progressCallback) Multithreaded batch conversion of JSON and HTML templates to PDFhtmlToPdfConvertFromString(String htmlContent, String outputPdf, String baseUrl, int width, int height, CPDFGeneration.HtmlToPdfFontListener fontListner) Convert HTML string to PDFhtmlToPdfConvertTemplate(String templateFile, String jsonFile, String outputPdf, String baseUrl, int width, int height, CPDFGeneration.HtmlToPdfFontListener fontListner) Combine the JSON file with the HTML template and convert it to PDFstatic StringhtmlToPdfGetErrorString(int id) Get the description string corresponding to the error codestatic StringhtmlToPdfRenderTemplate(String templateFile, String jsonFile) Combine the JSON file with the HTML template to generate HTML contentLicenseVerify(String license)
-
Constructor Details
-
CPDFGeneration
public CPDFGeneration()
-
-
Method Details
-
LicenseVerify
-
htmlToPdfConvert
public static CPDFGeneration.HtmlToPdfErrorCode htmlToPdfConvert(String htmlPath, String outputPdf, String baseUrl, int width, int height, CPDFGeneration.HtmlToPdfFontListener fontListner) Convert HTML file to PDF- Parameters:
htmlPath- HTML file pathoutputPdf- Output PDF file pathbaseUrl- base URL path(Used for parsing relative path resources)width- Page width(Pixel)height- Page height(Pixel)fontListner- Font callback,Pass NULL to use the default font- Returns:
- Html2PdfErrorCode Error code,HTML2PDF_SUCCESS is success.
-
htmlToPdfConvertFromString
public static CPDFGeneration.HtmlToPdfErrorCode htmlToPdfConvertFromString(String htmlContent, String outputPdf, String baseUrl, int width, int height, CPDFGeneration.HtmlToPdfFontListener fontListner) Convert HTML string to PDF- Parameters:
htmlContent- HTML content stringoutputPdf- Output PDF file pathbaseUrl- Base URL path(Used for parsing relative path resources)width- Page width(Pixel)height- Page height(Pixel)fontListner- Font callback,Pass NULL to use the default font- Returns:
- Html2PdfErrorCode Font callback,HTML2PDF_SUCCESS is success.
-
htmlToPdfRenderTemplate
Combine the JSON file with the HTML template to generate HTML content- Parameters:
templateFile- HTML template file pathjsonFile- JSON data file path- Returns:
- String HTML content
-
htmlToPdfConvertTemplate
public static CPDFGeneration.HtmlToPdfErrorCode htmlToPdfConvertTemplate(String templateFile, String jsonFile, String outputPdf, String baseUrl, int width, int height, CPDFGeneration.HtmlToPdfFontListener fontListner) Combine the JSON file with the HTML template and convert it to PDF- Parameters:
templateFile- HTML template file pathjsonFile- JSON data file pathoutputPdf- Output PDF file pathbaseUrl- Base URL path(Used for parsing relative path resources)width- Page width(Pixel)height- Page height(Pixel)fontListner- Font callback,Pass NULL to use the default font- Returns:
- Html2PdfErrorCode Error,HTML2PDF_SUCCESS is success
-
htmlToPdfConvertBatch
public static CPDFGeneration.HtmlToPdfErrorCode htmlToPdfConvertBatch(CPDFHtmlToPdfTask[] tasks, int width, int height, CPDFGeneration.HtmlToPdfFontListener fontListner, CPDFGeneration.HtmlToPdfProgressListener progressCallback) Multithreaded batch conversion of JSON and HTML templates to PDF- Parameters:
tasks- Task arraywidth- Page width(Pixel)height- Page height(Pixel). Pass 0 to use the default heightfontListner- Font callback. Pass NULL to use the default fontprogressCallback- Progress callback. Pass NULL to avoid callback- Returns:
- Html2PdfErrorCode Error code,HTML2PDF_SUCCESS is success
-
htmlToPdfGetErrorString
Get the description string corresponding to the error code- Parameters:
id- Error code- Returns:
- Error description string
-