Hello Team, currently we hold ASPOSE 23.10 version and now we are looking for PDF to markdown conversion can you help.
we also tried 25.08 version, and we need to pdf to markdown conversion without images can you help some code snippet or link also we do not want any extra text or image url etc in markdown file like blow we get [ref1]: Aspose.Words.64a06089-9855-486f-af1a-370ebda6bdba.001.png
@shri123
Hello,
Aspose.PDF can export to Markdown directly via SaveFormat.Markdown / MarkdownSaveOptions. First, a quick note: the [ref1]: Aspose.Words..png line in your example is
produced by Aspose.Words, not Aspose.PDF — could you confirm whether your pipeline is PDF→Markdown with Aspose.PDF, or going through Aspose.Words? The answer below is for
Aspose.PDF; if you’re using Aspose.Words we’ll point you to the equivalent there.
There isn’t a single “no images” switch on MarkdownSaveOptions, so the reliable way to get image-free Markdown is to drop the images from the document before converting:
static void convert_to_markdown()
{
string input = InputFolder + "input.pdf";
string output = OutputFolder + "output.pdf";
var doc = new Document(input);
// Remove embedded raster images (XImageCollection is 1-based)
foreach (Page page in doc.Pages)
{
for (int i = page.Resources.Images.Count; i >= 1; i--)
page.Resources.Images.Delete(i);
}
var options = new MarkdownSaveOptions
{
ExtractVectorGraphics = false, // also skip vector graphics
};
doc.Save(output, options);
}
We’d also recommend running this on the current Aspose.PDF release rather than 23.10/25.08, as the Markdown exporter has had ongoing improvements.
If you can share a sample PDF, we’ll tailor the snippet (e.g. heading detection) to your documents.