Convert PUB to HTML

In different scenarios, you can need to convert Microsoft Publisher (PUB) files to an HTML webpage. You may customize the output HTML file with different properties as per your requirements. In this article, you will learn how to convert a PUB file to an HTML webpage in HTML5 or XHTML format programmatically using C#:

PUB to HTML Webpage Converter – C# APIs Installation

Aspose.PUB for .NET API can convert a Microsoft Publisher file to PDF and that PDF file can be exported as an HTML webpage. It is helpful when you manage Microsoft Publisher files in a web application because these files are usually not supported in internet browsers. You can configure the APIs by downloading the DLL files from the Downloads section, or with the following NuGet installation commands:

PM> Install-Package Aspose.PUB
PM> Install-Package Aspose.PDF

Convert PUB to HTML file Programmatically using C#

You can convert a PUB file to an HTML file with the following steps:

  1. Load and parse the input PUB file with the CreateParser method.
  2. Convert the PUB file to PDF and save the result in a MemoryStream.
  3. Load data from MemoryStream and initialize the HtmlSaveOptions class object.
  4. Save output HTML webpage.

The following code shows how to convert a PUB file to an HTML webpage with C#:

Convert PUB to HTML in XHTML Format Programmatically using C#

You can convert a Publisher document to an HTML file in Xhtml format programmatically using C#. HtmlSaveOptions class exposes different properties which can be set to create different types of HTML files. The following steps explain PUB to HTML conversion in Xhtml format:

  1. Load input PUB file and parse it with the Parse method.
  2. Convert PUB to PDF document and store result in a MemoryStream instance.
  3. Initialize HtmlSaveOptions class object and set the DocumenType property.
  4. Save output HTML webpage in XHTML format.

The code below explains how to convert a PUB file to HTML webpage in XHTML format programmatically with C#:

Get Free Temporary License

You can evaluate Aspose APIs in full capacity by requesting a Free Temporary License.

Conclusion

In this article, you have learned how to convert a Microsoft Publisher file to an HTML webpage in HTML5 or XHTML format programmatically using C#. You can render the PUB files while setting different other options as per your requirements. Moreover, you can refer to the Documentation of Aspose.PUB for .NET API or contact us at the Free Support Forum for any queries.

See Also