using IronPdf;
using IronSoftware.Drawing;
using System;
PdfDocument pdf = PdfDocument.FromFile("sample.pdf");
// Convert PDF to HTML string
string html = pdf.ToHtmlString();
Console.WriteLine(html);
// Convert PDF to HTML file
pdf.SaveAsHtml("myHtml.html");
// PDF to HTML configuration options
HtmlFormatOptions htmlformat = new HtmlFormatOptions();
htmlformat.BackgroundColor = Color.White;
htmlformat.H1Color = Color.Blue;
htmlformat.H1FontSize = 25;
htmlformat.H1TextAlignment = TextAlignment.Center;
htmlformat.PdfPageMargin = 10;
// Convert PDF to HTML file
pdf.SaveAsHtml("myHtmlConfigured.html", true, "Hello World", htmlFormatOptions: htmlformat);
Imports IronPdf
Imports IronSoftware.Drawing
Imports System
Dim pdf As PdfDocument = PdfDocument.FromFile("sample.pdf")
' Convert PDF to HTML string
Dim html As String = pdf.ToHtmlString()
Console.WriteLine(html)
' Convert PDF to HTML file
pdf.SaveAsHtml("myHtml.html")
' PDF to HTML configuration options
Dim htmlformat As New HtmlFormatOptions()
htmlformat.BackgroundColor = Color.White
htmlformat.H1Color = Color.Blue
htmlformat.H1FontSize = 25
htmlformat.H1TextAlignment = TextAlignment.Center
htmlformat.PdfPageMargin = 10
' Convert PDF to HTML file
pdf.SaveAsHtml("myHtmlConfigured.html", True, "Hello World", htmlFormatOptions:=htmlformat)
Imports IronPdf
Imports IronSoftware.Drawing
Imports System
Dim pdf As PdfDocument = PdfDocument.FromFile("sample.pdf")
' Convert PDF to HTML string
Dim html As String = pdf.ToHtmlString()
Console.WriteLine(html)
' Convert PDF to HTML file
pdf.SaveAsHtml("myHtml.html")
' PDF to HTML configuration options
Dim htmlformat As New HtmlFormatOptions()
htmlformat.BackgroundColor = Color.White
htmlformat.H1Color = Color.Blue
htmlformat.H1FontSize = 25
htmlformat.H1TextAlignment = TextAlignment.Center
htmlformat.PdfPageMargin = 10
' Convert PDF to HTML file
pdf.SaveAsHtml("myHtmlConfigured.html", True, "Hello World", htmlFormatOptions:=htmlformat)