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

Free Support Forum - aspose.com

How to one html file one page when i save to html files

we want to pages the pdf when we convert pdf to html.
one pdf page to one html file.How to do? like ppt conversion in newest slides version.and we want to control the gernerated html file name.

Hi Xu,


Thanks for contacting support.

In order to accomplish your requirement, please follow the instructions specified over Save to multi-page HTML.

i used aspose.pdf for java,but you showed me .net.when i view your api.i find i can accomplish my requirement below:but it tells me when i save to stream i must set customcsssavingstrategy…,but i set embbedallresource in html, it shouldn’t set.my requirement is all resource in one html.but i only can save to stream.How do solve this problem?
License license = new License();
license.setLicense(“C:\Users\Lixp\Desktop\Aspose\Aspose.Total.Java.lic”);
Document pdfDocument = new Document(System.getProperty(“user.dir”)
+ “\1.pdf”);
HtmlSaveOptions saveOptions = new HtmlSaveOptions();

// Enable option to embed all resources inside the HTML
saveOptions.PartsEmbeddingMode = HtmlSaveOptions.PartsEmbeddingModes.EmbedAllIntoHtml;

// This is just optimization for IE and can be omitted
saveOptions.LettersPositioningMethod = LettersPositioningMethods.UseEmUnitsAndCompensationOfRoundingErrorsInCss;
saveOptions.RasterImagesSavingMode = HtmlSaveOptions.RasterImagesSavingModes.AsEmbeddedPartsOfPngPageBackground;
saveOptions.FontSavingMode = HtmlSaveOptions.FontSavingModes.SaveInAllFormats;
// saveOptions.setSplitIntoPages(true);
// saveOptions.setSplitCssIntoPages(true);
// saveOptions.CustomCssSavingStrategy = null;
// saveOptions.CustomResourceSavingStrategy = null;
// saveOptions.CustomStrategyOfCssUrlCreation = null;
for (int i = 1; i < pdfDocument.getPages().size(); i++) {
Document pageDocument = new Document();
pageDocument.getPages().add(pdfDocument.getPages().get_Item(i));
pageDocument.save(
new FileOutputStream(System.getProperty(“user.dir”) + “\”
+ i + “.html”), saveOptions);
}

Hi Xu,


Thanks for sharing the details.

In your first post, you did not specify the platform for which you need the information and I shared the link for Aspose.Pdf for .NET. However in order to convert individual page of PDF file to separate HTML file, please try using following code snippet.

[Java]

//Open the PDF file<o:p></o:p>

Document doc = new Document("c:/pdftest/Original (1).pdf");

//Instantiate HTML SaveOptions object

HtmlSaveOptions htmlOptions = new HtmlSaveOptions();

//Specify to split the output into multiple pages

htmlOptions.setSplitIntoPages(true);

//Save the document

doc.save("c:/pdftest/Original_output.html", htmlOptions);


Besides this, please share some further details regarding your other requirement stated in previous post. Do you need to convert PDF pages to HTML format and embed all the resources (Font, Image, CSS etc) in resultant HTML or you need to save the resultant HTML files to Stream object. Please share some details, so we may reply accordingly.