We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Convert each page of PDF document into Single HTML File with Embedded Resources using C#

When I try to convert a pdf document to html pages, with SplitIntoPages=true, a seperate folder is created for css, fonts and images, is there any way to add all resources into each pages rather than creating a seperate folder and saving in it?


Please try the conversion in a way like in the below code snippet in order to achieve your requirements:

Document doc = new Document(dataDir + "test问题.pdf");
foreach (Page page in doc.Pages)
 Document newDoc = new Document();
 HtmlSaveOptions newOptions = new HtmlSaveOptions();
 // this is usage of tested feature
 newOptions.PartsEmbeddingMode = HtmlSaveOptions.PartsEmbeddingModes.EmbedAllIntoHtml;
 // this is just optimozation for IE and can be omitted
 newOptions.LettersPositioningMethod = HtmlSaveOptions.LettersPositioningMethods.UseEmUnitsAndCompensationOfRoundingErrorsInCss;
 newOptions.RasterImagesSavingMode = HtmlSaveOptions.RasterImagesSavingModes.AsEmbeddedPartsOfPngPageBackground;
 newOptions.FontSavingMode = HtmlSaveOptions.FontSavingModes.SaveInAllFormats;
 newOptions.RemoveEmptyAreasOnTopAndBottom = true;
 string outHtmlFile = dataDir + DateTime.Now.Millisecond + @".html";
 newDoc.Save(outHtmlFile, newOptions);