Skip to content

Instantly share code, notes, and snippets.

@aspose-com-gists
Last active December 23, 2021 05:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aspose-com-gists/b4f7d3d35bcf8bc8de43294ef3b80a97 to your computer and use it in GitHub Desktop.
Save aspose-com-gists/b4f7d3d35bcf8bc8de43294ef3b80a97 to your computer and use it in GitHub Desktop.
Convert Publisher file PUB to HTML webpage in Java
// Initialize ByteArrayOutputStream to hold intermediary PDF file.
final ByteArrayOutputStream os = new ByteArrayOutputStream();
// Load input PUB file
IPubParser parser = PubFactory.createParser("Sample.pub");
// Parse the input publisher file
com.aspose.pub.Document doc = parser.parse();
// Convert the PUB file to PDF and save result in a ByteArrayOutputStream
PubFactory.createPdfConverter().convertToPdf(doc, os);
// Load input PDF file from the ByteArrayOutputStream
com.aspose.pdf.Document document = new com.aspose.pdf.Document(os.toByteArray());
// Initialize HtmlSaveOptions class object
HtmlSaveOptions options = new HtmlSaveOptions();
// Convert PUB file to HTML webpage
document.save("Output.html", options);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment