GroupDocs.Conversion allows you to get default load options for the source document format. This will allow you to get default load options runtime, knowing the source format.
Call the Convert method of the Converter class instance and pass filename for the converted document and the instance of ConvertOptions from the previous step.
The following code snippet shows how to get default load options for a Word processing document:
importcom.groupdocs.conversion.Converter;importcom.groupdocs.conversion.contracts.PossibleConversions;importcom.groupdocs.conversion.options.convert.PdfConvertOptions;importcom.groupdocs.conversion.options.load.WordProcessingLoadOptions;publicclassGetDefaultLoadOptions{publicstaticvoidgetDefaultLoadOptions(){// Step 1: Retrieve possible conversions for a DOCX extension
PossibleConversionspossibleConversions=Converter.getPossibleConversions("docx");// Step 2: Use the default load options
WordProcessingLoadOptionsloadOptions=(WordProcessingLoadOptions)possibleConversions.getLoadOptions();loadOptions.setPassword("12345");// Step 3: Specify source file path and load options
Converterconverter=newConverter("password_protected.docx",()->loadOptions);// Step 4: Specify output file location and convert options
PdfConvertOptionsconvertOptions=newPdfConvertOptions();// Step 5: Convert and save to output path
converter.convert("outputFile.pdf",convertOptions);}publicstaticvoidmain(String[]args){getDefaultLoadOptions();}}
Was this page helpful?
Any additional feedback you'd like to share with us?
Please tell us how we can improve this page.
Thank you for your feedback!
We value your opinion. Your feedback will help us improve our documentation.
Ask AI
Ask anything about this page — the answer is based on its content.
Searching the docs and writing an answer…
Something went wrong while getting an answer. Please try again in a moment.