Thursday, 28 December 2017

Convert Excel File to PDF in Java Example || ZeonPad

zeonpadpdf is library for coverting Excel file PDF. It works for both Desktop and Server application. It generates the high quality PDF file that are adobe Acrobat compatible. Supports both 32bit and 64 bit windows os.

you can download the latest version of zeonpadpdf library from
http://www.zeonpad.com/zeonpadpdf-download.html


ExcelToPdf Object Description

This object is used to convert Microsoft Excel to pdf. This object contains many Microsoft Excel related features. ExcelToPdf only works with Microsoft Excel 2007 or higher version.


Example Usage In Java

 
ExcelToPdf excelToPdf = new ExcelToPdf ();
excelToPdf.convert("C:\\Users\\Desktop\\input. xls","C:\\Users\\Desktop\\output.pdf");  



Properties
 
DocumentPassword Property
Sets a password for password protected Excel document.
 

Type
String


Usage
ExcelToPdf excelToPdf = new ExcelToPdf ();
excelToPdf.setDocumentPassword("12345");
excelToPdf.convert("C:\\Users\\Desktop\\input. xls","C:\\Users\\Desktop\\output.pdf");


PdfExportQuality Property
 
Specifies the quality of the exported pdf file. Default its set to PDFXlFixedFormatQuality.PDF_EXPORT_QUALITY_STANDARD.
 

Type
PDFXlFixedFormatQuality


PDF_EXPORT_QUALITY_MINIMUM =1  (Export pdf with lower quality)
PDF_EXPORT_QUALITY_STANDARD =0 (Export pdf,with higher quailty)


Usage
ExcelToPdf excelToPdf = new ExcelToPdf ();
excelToPdf.setPdfExportQuality(PDFXlFixedFormatQuality.PDF_EXPORT_QUALITY_STANDARD);
excelToPdf.convert("C:\\Users\\Desktop\\input. xls","C:\\Users\\Desktop\\output.pdf");



IncludeDocProps Property
To include document properties in pdf file. Default is set to false.
Set it to True to include document properties from the source document in the PDF.


Type
Boolean


Usage
ExcelToPdf excelToPdf = new ExcelToPdf ();
excelToPdf.setIncludeDocProps(true);
excelToPdf.convert("C:\\Users\\Desktop\\input. xls","C:\\Users\\Desktop\\output.pdf");


IgnorePrintAreas Property
true to ignore any print areas set when exporting; otherwise, false. Default is false.


Type
Boolean


Usage
ExcelToPdf excelToPdf = new ExcelToPdf ();
excelToPdf.setIgnorePrintAreas(true);
excelToPdf.convert("C:\\Users\\Desktop\\input. xls","C:\\Users\\Desktop\\output.pdf");



PrintAllSheets Property
Default is true to print all sheets.If set to false then need to set from and to


Type
Boolean


Usage
ExcelToPdf excelToPdf = new ExcelToPdf ();
excelToPdf.setPrintAllSheets(false);
excelToPdf.setFrom(1);
excelToPdf.setFrom(10);
excelToPdf.convert("C:\\Users\\Desktop\\input. xls","C:\\Users\\Desktop\\output.pdf");


ConversionTimeOut Property
Set the file coversion time out property. Default is 5 min.


Type
Int (minute)


Usage
ExcelToPdf excelToPdf = new ExcelToPdf ();
excelToPdf. setConversionTimeOut (10); //10 minute
excelToPdf.convert("C:\\Users\\Desktop\\input. xls","C:\\Users\\Desktop\\output.pdf");



1 comment:

  1. Very informative blog, If you want on Online Excel Database than use Turnao's service they offer free service for personal/ single user, Turnao is web-based application used to
    convert excel spreadsheets to online databases.

    ReplyDelete