Loading License MS PUB

Get the license of MS Publisher from a file or stream C++

 

Microsoft Publisher is a software that specializes in page layout and design. It supports various file formats, including MS Publisher 2.0 or later, .txt, RTF, MS Word, HTML, Unicode text, and more. The .pub file format in Publisher is versatile, as it can include a mix of text, images, and graphics, making it ideal for creating promotional materials like flyers, brochures, and postcards. These files can be opened, edited, and printed using Microsoft Publisher, but they cannot be opened or edited in other software programs, such as Microsoft Word or Adobe InDesign, unless they are first converted to another file format.

Aspose.PUB for C++ is a library that is designed to work with .pub files. It allows for the loading, editing, and conversion of .pub files to PDF, HTML, XLSX, DOC, and other image formats. The library can be integrated into C++ projects or used to create cross-platform applications for opening, merging, and converting Microsoft Publisher files. With this solution, you can efficiently convert .pub files without the need for additional software or subscriptions. Examples of the library's implementation in various applications can be found and tested.

On this page, you will learn how to set a license for using the Aspose.Pub library for C++. The license file is required to use the library and provides access to its features and capabilities and will also provide the user with access to support and upgrades. To learn other code examples and data files, please go to Aspose Github Project .

To load the license you will need to install the Aspose.PUB API. You can do it either by searching for it in the NuGet package manager or by using the Install-Package Aspose.PUB command in the Package Manager Console.

Package Manager Console Command


    PM> Install-Package Aspose.PUB

This code explains loading the Aspose.PUB license from a file. For this, the next steps should be taken:

  1. Initialize the license object of type Aspose::Pub::License. The System::MakeObject() Method is used to dynamically create an instance of the License Class.
  2. Call the SetLicense() Method on the license object and pass the path to the license file as an argument.

Steps to Load the PUB license from a file C++

    using Aspose::PUB;
    using System;
    // Initialize the license object
	auto license = System::MakeObject<Aspose::Pub::License>();
	// Set the license
	license->SetLicense(dataDir() + u"License\\Aspose.PUB.C++.lic");

To load the Aspose.PUB license from a stream the next steps should be taken:

  1. Create an instance of the License Class and assign it to the License variable.
  2. To load the license create an instance of the FileStream Class, which represents a stream of bytes and is used to read from and write to files.
  3. Call the SetLicense() Method on the license object and passes it the myStream object. This method sets the license for the Aspose.Pub library using the contents of the license file represented by the FileStream object.

Steps to Load the PUB license from a stream C++

    // Initialize a license object
    intrusive_ptr<License>license = new License();
    // Load the license in FileStream
    intrusive_ptr<FileStream> myStream = new FileStream(new String("Aspose.PUB.Cpp.lic"), FileMode_Open);(u"License\\Aspose.Total.C++.lic", System::IO::FileMode::Open);
    // Set the license
    license->SetLicense(myStream);



FAQ

1. How can I obtain a license for Aspose.PUB API Solution?

The easiest way to apply a license is to put the license file in the same folder as the Aspose.PUB.dll file and specify just the file name without a path. Another option is to load a license from a stream.

2. Are there any limitations in the evaluation version of Aspose.PUB?

The trial version of Aspose.PUB offers complete product functionality, with the only difference being the presence of an evaluation version warning displayed prominently at the top of the converted document.

3. Can I evaluate Aspose.PUB API Solution before purchasing a license?

Absolutely, Aspose offers a free evaluation version of Aspose.PUB API Solution for developers to test its functionalities and compatibility with their applications. The evaluation version allows you to explore the capabilities of the API and ensure it meets your requirements before making a purchase decision. Simply download the evaluation version from the Aspose website and start evaluating it in your development environment.