Skip to content

Instantly share code, notes, and snippets.

How to Convert XLSX to PDF using Java. For more information, please follow link: https://kb.groupdocs.com/conversion/java/how-to-convert-xlsx-to-pdf-using-java/
import com.groupdocs.conversion.Converter;
import com.groupdocs.conversion.licensing.License;
import com.groupdocs.conversion.options.convert.ConvertOptions;
public class ConvertXLSXtoPDFusingJava {
public static void main(String[] args) {
// Set License to avoid the limitations of Conversion library
License license = new License();
license.setLicense("GroupDocs.Conversion.lic");
// Import XLSX document
Converter converter = new Converter("input.xlsx");
// Get conversion option for final output document
ConvertOptions xlsxtopdfconvertoptions = converter.getPossibleConversions("pdf")
.getSource().getConvertOptions();
// Save the PDF to disk
converter.convert("ConvertXLSXtoPDFusingJava.pdf", xlsxtopdfconvertoptions);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment