Hi,
Hi Prasanna,
Thanks for your inquiry. You can use the following code to meet this requirement.
Document doc = new Document(MyDir + @"input.docx");
HtmlFixedSaveOptions opts = new HtmlFixedSaveOptions
{
PageCount = 1
};
for (int i = 0; i < doc.PageCount; i++)
{
opts.PageIndex = i;
doc.Save(MyDir + $"16.2.0_{i}.html", opts);
}
Hope, this helps.
Best regards,
Hi Awais,
Hi Prasanna,
Hi Prasanna,
Thanks for contacting support.
In order to accomplish your requirement, please split PDF file to individual page documents and then convert the files to HTML with all resources embedded. Please take a look over following code snippet.
[C#]
Document doc = new Document("c:/pdftest/Deforestation.pdf");
foreach (Page page in doc.Pages)
{
// Create a temporary document for each page
Document tempDoc = new Document();
tempDoc.Pages.Add(page);
// Instantiate HTML Save options object
HtmlSaveOptions newOptions = new HtmlSaveOptions
{
// Enable option to embed all resources inside the HTML
PartsEmbeddingMode = HtmlSaveOptions.PartsEmbeddingModes.EmbedAllIntoHtml,
// Optimization for IE (optional)
LettersPositioningMethod = HtmlSaveOptions.LettersPositioningMethods.UseEmUnitsAndCompensationOfRoundingErrorsInCss,
// Embed raster images as parts of the PNG page background
RasterImagesSavingMode = HtmlSaveOptions.RasterImagesSavingModes.AsEmbeddedPartsOfPngPageBackground,
// Save fonts in all formats
FontSavingMode = HtmlSaveOptions.FontSavingModes.SaveInAllFormats
};
// Output file path for each page
string outHtmlFile = @"c:\pdftest\Deforestation_Page" + page.Number + ".html";
// Save the page as HTML
tempDoc.Save(outHtmlFile, newOptions);
}