Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Convert PUB to HTML XHTML HTML5 Programmatically using C#
string fileName = "1.pub";
MemoryStream stream = new MemoryStream();
// Load input PUB file
Aspose.Pub.IPubParser parser = Aspose.Pub.PubFactory.CreateParser(fileName);
// Parse the input publisher file
Aspose.Pub.Document doc = parser.Parse();
// Convert the PUB file to PDF and save result in a MemoryStream
Aspose.Pub.PubFactory.CreatePdfConverter().ConvertToPdf(doc, stream);
// Load input PDF file from the MemoryStream
Aspose.Pdf.Document document = new Document(stream);
// Initialize HtmlSaveOptions class object
Aspose.Pdf.HtmlSaveOptions options = new HtmlSaveOptions();
// Save output HTML webpage
document.Save("Output.html", options);
string fileName = "1.pub";
MemoryStream stream = new MemoryStream();
// Load input PUB file
Aspose.Pub.IPubParser parser = Aspose.Pub.PubFactory.CreateParser(fileName);
// Parse the input publisher file
Aspose.Pub.Document doc = parser.Parse();
// Convert the PUB file to PDF and save result in a MemoryStream
Aspose.Pub.PubFactory.CreatePdfConverter().ConvertToPdf(doc, stream);
// Load input PDF file from the MemoryStream
Aspose.Pdf.Document document = new Document(stream);
// Initialize HtmlSaveOptions class object
Aspose.Pdf.HtmlSaveOptions options = new HtmlSaveOptions();
// Set Html document type
options.DocumentType = HtmlDocumentType.Xhtml;
// Save output 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