Skip to content

Instantly share code, notes, and snippets.

@conholdate-gists
Last active March 31, 2021 08:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save conholdate-gists/232e09604ed755b11d02e1c025524ac3 to your computer and use it in GitHub Desktop.
Save conholdate-gists/232e09604ed755b11d02e1c025524ac3 to your computer and use it in GitHub Desktop.
Convert PDF to XLS or XLSX using GroupDocs.Conversion for .NET API
// PDF Load Options
GroupDocs.Conversion.Contracts.Func<LoadOptions> getLoadOptions = () => new PdfLoadOptions
{
FlattenAllFields = true, // all fields in the source document will be flatten during conversion
Password = "123" // provide password if document is password protected
};
// Excel Convert Options
SpreadsheetConvertOptions options = new SpreadsheetConvertOptions
{
PageNumber = 1, // Starting page number
PagesCount = 1, // Total pages to convert
Format = SpreadsheetFileType.Xlsx, // Conversion format
Password = "password", // Set password for converted file
Zoom = 110 // Zoom level
};
// Convert PDF to XLSX
Converter converter = new Converter("C:\\Files\\sample.pdf", getLoadOptions);
converter.Convert("C:\\Files\\converted.xlsx", options);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment