Convert PUB files

Microsoft® Publisher converter functionality to build cross-platform .NET applications.

 

Microsoft® Publisher document file format is used for creating various publication types such as newsletters, brochures, flyers, and postcards and is used in Emails and Websites. Pub files contain text as well as bitmap and vector graphics data.

Even though the format is quite popular it is not as popular as such formats as PDF or DOCX. MS Publisher application is not free itself. So it is often required to convert files with .pub extension to another, well-spread and comfortable-to-use format. Here is the conversion functionality for .NET. This C# library includes the needed conversion functionality that can be used for the creation of your own project. Aspose.PUB API Solution supports PUB to PDF, TIFF, PNG, JPEG, GIF, BMP, DOC, DOCX, XLS, XLXL, CSV, PPTX, XPS, EPU, TEX, HTML, MHTML, and SVG conversion.

Convert Publisher .pub files

Let’s look at the functionality through the PUB to JPEG conversion.

This code snippet is written in C# to demonstrate how to work with Microsoft Publisher (.pub) files using Aspose.PUB. The purpose of the code is to convert a Publisher file into a JPG and save the result as a file. Here is an explanation of the code:

  1. Retrieve the path to the documents directory.
  2. Construct the full path to a specific Publisher file using the PubFactory Class.
  3. Creates and use a parser to parse the Publisher file into a document object using the Parse() Method of IPubParser Interface.
  4. Convert the document to a JPG image and save it to a file using ConvertToFile() Method.

C# Code for Publisher PUB to JPEG Conversion

    using Aspose.Pub;
    using System;
    using System.Collections.Generic;
    using System.IO;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    // The path to the documents directory.
    string dataDir = RunExamples.GetDataDir_Data();

    string fileName = dataDir + "halloween-flyer.pub";

    var parser = PubFactory.CreateParser(fileName);

    var doc = parser.Parse();

    //Convert to jpg and save the result as file "halloween-flyer_out.jpg"
    ConvertToFile(doc, PubExportFormats.Jpg, dataDir + "halloween-flyer_out.jpg");

Conversion of PUB to any other format is possible in the same way.

You can also try Publisher Converter cross-platform application . It has a very simple interface and the process will take only a few seconds. The solution allows:

  • Transform multiple Publisher files.
  • Convert PUB to to PDF, TIFF, PNG, JPEG, GIF, BMP, DOC, DOCX, XLS, XLXL, CSV, PPTX, XPS, EPU, TEX, HTML, MHTML, and SVG conversion.
  • Save converted documents on your device or to a stream.



FAQ

1. How do I convert a PUB files?

To convert PUB files with this API solution, use the PubFactory Class. Parse files and start the conversion. To convert .pub files online go to cross-platform Converters where you can transform files to images, PDF, and many more formats.

2. Can I convert an MS Publisher file to PDF?

If you need to convert PUB to PDF with this API solution, use the PubFactory Class. Parse files and start the conversion. For an online pub to pdf conversion, go to cross-platform Converter .

3. Is the functionality free?

The cross-platform Converters are free when for the API solution you can get a free Trial and then buy the product if needed.

4. What program can open .PUB files?

By now files with .pub extension can be opened by little software, apart from MS Publisher itself and it is not free. But to see the content of the file you can use a cross-platform Viewer application which is online and free.

 
  

Support and Learning Resources