Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save aspose-com-gists/0cc8b59bf7871f087bfbd2bdde926d4a to your computer and use it in GitHub Desktop.

Select an option

Save aspose-com-gists/0cc8b59bf7871f087bfbd2bdde926d4a to your computer and use it in GitHub Desktop.
Convert PUB documents to PDF and JPEG files with Aspose.PUB for .NET.

PUB Conversion Examples

Convert PUB documents to PDF and JPEG files with Aspose.PUB for .NET.

Examples

  • Convert a PUB document to PDF: Example-ConvertPubToPdf.cs.
  • Convert a PUB document to JPEG: Example-ConvertPubToJpeg.cs.

Both examples use tests-data/Aspose.PUB/halloween-flyer.pub and save results under tests-out/Aspose.PUB.Net/ConvertPUB/.

Related Documentation

Related Resources

Requirements

  • .NET 5.0+, .NET Core, or .NET Framework
  • Aspose.PUB for .NET library
Aspose.PUB for .NET – PUB Conversion Examples
// Convert a PUB document to JPEG
// Learn more: https://docs.aspose.com/pub/net/convert-pub-files/
// Parse the input Publisher document.
string fileName = Path.Combine(DataDir, "halloween-flyer.pub");
IPubParser parser = PubFactory.CreateParser(fileName);
Document doc = parser.Parse();
// Convert the document to JPEG and save the result.
string outPath = Path.Combine(OutputDir, "halloween-flyer_out.jpg");
PubFactory.CreatePubConverter().ConvertToFormat(doc, outPath, PubExportFormats.Jpg);
// Convert a PUB document to PDF
// Learn more: https://docs.aspose.com/pub/net/convert-pub-files/
// Parse the input Publisher document.
string fileName = Path.Combine(DataDir, "halloween-flyer.pub");
IPubParser parser = PubFactory.CreateParser(fileName);
Document doc = parser.Parse();
// Convert the document to PDF and save the result.
string outPath = Path.Combine(OutputDir, "halloween-flyer_out.pdf");
PubFactory.CreatePdfConverter().ConvertToPdf(doc, outPath);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment