Introduction
This post shows how to convert a PDF to an Excel workbook or a Markdown document, and back again, with the new conversion APIs in Aspose.PDF FOSS for Java 26.9.0. Both directions are supported — a PDF can be exported to an editable workbook or a Markdown document, and an edited workbook or Markdown file can be converted back into PDF.
This is useful whenever a PDF is the wrong format for the next step in a workflow: a reviewer who needs to edit tabular data in a spreadsheet, or a writer who needs the text content in a plain-text, version-control-friendly format.
Aspose.PDF FOSS for Java is MIT-licensed and has no external dependencies.
What’s Included
Export to Excel
Document.save with SaveFormat.Xlsx converts a PDF to a workbook. ExcelSaveOptions
controls the shape of the output — most importantly, whether pages are merged onto
fewer worksheets or kept one-per-sheet:
import org.aspose.pdf.Document;
import org.aspose.pdf.ExcelSaveOptions;
try (Document doc = new Document("report.pdf")) {
ExcelSaveOptions options = new ExcelSaveOptions();
options.setFormat(ExcelSaveOptions.ExcelFormat.XLSX); // default
options.setMinimizeTheNumberOfWorksheets(true); // merge pages onto fewer sheets
options.setInsertBlankColumnAtFirst(false); // no leading spacer column
options.setUniformWorksheets(false); // allow per-sheet column widths
options.setStructuralHeuristics(true); // recover tables on untagged PDFs
options.setSuppressRunningHeadersFooters(true); // drop repeated page furniture
doc.save("report.xlsx", options);
}
Export to Markdown
MarkdownSaveOptions controls the Markdown export in a similar way, with options for
recovering document structure and handling embedded graphics:
import org.aspose.pdf.Document;
import org.aspose.pdf.MarkdownSaveOptions;
try (Document doc = new Document("article.pdf")) {
MarkdownSaveOptions options = new MarkdownSaveOptions();
options.setStructuralHeuristics(true); // recover headings/lists/tables
options.setSuppressRunningHeadersFooters(true); // drop repeated page furniture
options.setRasterizeVectorGraphics(true); // charts/shapes -> referenced images
doc.save("article.md", options);
}
Convert Back to PDF
ExcelLoadOptions and MarkdownLoadOptions are passed to the Document constructor
to load a workbook or Markdown file and convert it back to PDF:
import org.aspose.pdf.Document;
import org.aspose.pdf.ExcelLoadOptions;
try (Document doc = new Document("book.xlsx", new ExcelLoadOptions())) {
doc.save("book.pdf");
}
Quick Start
<dependency>
<groupId>org.aspose</groupId>
<artifactId>aspose-pdf-foss</artifactId>
<version>26.9.0</version>
</dependency>Add the dependency above, then convert a PDF to XLSX in a few lines using
SaveFormat.Xlsx — no extra options needed for a basic export:
import org.aspose.pdf.Document;
import org.aspose.pdf.SaveFormat;
try (Document doc = new Document("report.pdf")) {
doc.save("report.xlsx", SaveFormat.Xlsx); // SaveFormat.Excel is an alias
}
Supported Formats
| Format | Extension | Read | Write |
|---|---|---|---|
| ✓ | ✓ | ||
| Excel | xlsx | ✓ | ✓ |
| Markdown | md | ✓ | ✓ |
Open Source & Licensing
Aspose.PDF FOSS for Java is MIT-licensed and available at
https://github.com/aspose-pdf-foss/Aspose.PDF-FOSS-for-Java. Commercial use is
permitted under the MIT license terms. If your project requires enterprise-grade
support, extended format coverage, or cloud integration, the
Aspose.PDF — Enterprise Product Family is a
separate commercial offering.
Getting Started
- Convert PDF to Excel and Markdown (Developer Guide)
- How to Convert a PDF to an Editable Excel Workbook
- Getting Started
- API Reference