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,
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,
//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.