Skip to main content

PDF semantic import

Convert PDF content to semantic HTML

Project readable PDF content into reviewable HTML, retain structured warnings, and distinguish semantic output from a pixel-perfect page clone.

Practical steps

Project PDF logical content into HTML

Read supported page structures, create semantic HTML, and retain conversion diagnostics.

  1. SelectChoose a readable PDF or load the built-in sample.
  2. ConvertProject logical headings, paragraphs, lists, tables, links, and supported resources into HTML.
  3. ReviewPreview or download the HTML and inspect the companion warning report.

Semantic HTML is useful for review, publishing, search ingestion, accessibility remediation, and content pipelines that need meaningful structure rather than a screenshot of each page.

Convert from .NET

using OfficeIMO.Html.Pdf;
using OfficeIMO.Pdf;

PdfDocument pdf = PdfDocument.Open("policy.pdf");
PdfHtmlConversionResult result = pdf.ToHtmlResult();

File.WriteAllText("policy.html", result.Value);
foreach (PdfConversionWarning warning in result.Report.Warnings) {
    Console.WriteLine($"{warning.Code}: {warning.Message}");
}

The browser displays the generated HTML for review and downloads the same content with a JSON report describing the source, output, conversion profile, timing, and warnings.

Semantic output versus visual reproduction

This route does not wrap a page image in HTML or promise identical browser layout. PDF reading order, positioned text, unusual fonts, drawings, and scanned pages may require approximation or separate handling. Use visual PDF rendering when fixed appearance matters; use this conversion when meaningful, editable web content is the goal.