Skip to content

Instantly share code, notes, and snippets.

@aspose-com-gists
Last active June 26, 2022 11:15
Show Gist options
  • Save aspose-com-gists/a09a0078f81a15a27e425b1cd1e5484b to your computer and use it in GitHub Desktop.
Save aspose-com-gists/a09a0078f81a15a27e425b1cd1e5484b to your computer and use it in GitHub Desktop.
C# Manage Metadata and Convert Microsoft® Publisher Formats | Aspose.PUB for .NET

Get Metadata and Convert PUB Files using .NET Publisher API

C# codes listed below demonstrating how to convert Microsoft® Publisher Documents PUB to PDF using C#. Developers can easily use for their viewer and modify these as of their application requirement.

More details of Publisher files conversion code using .NET Publisher Library at https://products.aspose.com/pub/net/conversion/

More details of Publisher files Metadata code at https://products.aspose.com/pub/net/metadata/pub/

For code integration there few prerequisite listed in installation section below.

Installation

Install from command line as nuget install Aspose.Pub or via Package Manager Console of Visual Studio with Install-Package Aspose.Pub.

Alternatively, get the offline MSI installer or DLLs in a ZIP file from downloads.

More About .NET Publisher API

Home | Product Page | Docs | Demos | API Reference | Examples | Blog | Search | Free Support | Temporary License

string pubFile = dataDir + "flyer.pub";
var parser = PubFactory.CreateParser(pubFile);
var pubtopdf = parser.Parse();
Aspose.Pub.PubFactory.CreatePdfConverter().ConvertToPdf(pubtopdf, dataDir + "publisher_to.pdf");
// Load PUB file
var parser = PubFactory.CreateParser("sample.pub");
// Parse file
var doc = parser.Parse();
// Edit company metadata
document.DocumentSummaryInfo.SetCompany("company");
// Load PUB file
var parser = PubFactory.CreateParser("sample.pub");
// Parse file
var doc = parser.Parse();
// Convert PUB to PDF
Aspose.Pub.PubFactory.CreatePdfConverter().ConvertToPdf(doc, "output.pdf");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment