GroupDocs.Conversion provides PdfLoadOptions to give you control over how the source PDF document will be processed. The following options could be set:
setFormat allows you to specify explicitly the type of the source document. Available options are: Pdf, Epub, Xps, Tex, Ps, Pcl.
setRemoveEmbeddedFiles whether to remove the embedded files from the source document during the conversion.
setPassword specifies a password to unlock the protected document.
setHidePdfAnnotations specifies that annotations in the source document should be hidden.
setFlattenAllFields specifies that all fields in the source document should be flattened during the conversion.
Flatten all fields
The following code snippet shows how to convert a PDF document and flatten all fields:
constloadOptions=newgroupdocs.conversion.PdfLoadOptions()loadOptions.setFlattenAllFields(true)constconverter=newgroupdocs.conversion.Converter("sample.pdf",loadOptions)constoutputPath="ConvertPdfAndFlattenAllFields.docx"constconvertOptions=newgroupdocs.conversion.WordProcessingConvertOptions()console.log(`Pdf document converted successfully to ${outputPath} (pdf & flatten all fields)`)converter.convert(outputPath,convertOptions)
Hide annotations
The following code snippet shows how to convert a PDF document and hide annotations:
constloadOptions=newgroupdocs.conversion.PdfLoadOptions()loadOptions.setHidePdfAnnotations(true)constconverter=newgroupdocs.conversion.Converter("sample.pdf",loadOptions)constoutputPath="ConvertPdfAndHideAnnotations.docx"constconvertOptions=newgroupdocs.conversion.WordProcessingConvertOptions()console.log(`Pdf document converted successfully to ${outputPath} (pdf & hide annotations)`)converter.convert(outputPath,convertOptions)
Remove embedded files
The following code snippet shows how to convert a PDF document and remove embedded files: