aspose-pdf / Aspose.PDF-for-Java

Aspose.PDF for Java examples, plugins and showcases
https://products.aspose.com/pdf/java
MIT License
128 stars 134 forks source link

convert pdf to html but no title #38

Open ZCHWorld opened 5 years ago

ZCHWorld commented 5 years ago

convert pdf to html but no title,how can i insert?

farhan-raza commented 5 years ago

@ZCHWorld,

Thank you for contacting support.

Would you please share source and generated files as ZIP via Google Drive, Dropbox etc. along with narrowed down code snippet so that we may try to reproduce and investigate it in our environment.

PS: I work with Aspose as Developer Evangelist.

ZCHWorld commented 5 years ago

look here github demo. I'm looking forward to your reply. Thank you!

farhan-raza commented 5 years ago

Thank you for sharing requested data.

We are afraid that the API does not support setting Title of generated HTML file. However, we have logged a feature request with ID PDFJAVA-38661 in our issue management system for further investigations. We will let you know as soon as some significant updates will be available in this regard.

asadalikhan90 commented 4 years ago

@ZCHWorld

We have investigated the earlier logged ticket and found that the subsequent work with HTML after the conversion is not a target of PDF library. For this purpose some HTML library could be used. For example it could be done with Aspose.HTML library via code:

com.aspose.html.HTMLDocument htmlDoc = new com.aspose.html.HTMLDocument("fileName.html");
htmlDoc.setTitle("This is a Title");
htmlDoc.save("Output.html");

Or you could just edit the output HTML as a string by using Apache Commons library:

FileUtils.writeStringToFile(new File("fileName.html"), FileUtils.readFileToString(new File("Output.html"), "UTF-8").replace("<title>", "<title>This is a Title"), "UTF-8");