Frequently Asked Questions
What is the licensing model for Aspose.PDF FOSS for C++?
Aspose.PDF FOSS for C++ is MIT-licensed. It is free to use in commercial and non-commercial products, with no activation key, API call limits, or commercial agreement required.
How do I add Aspose.PDF FOSS for C++ to a CMake project?
Vendor or clone the repository into your project tree, add it as a subdirectory, and link the static library target:
add_subdirectory(aspose.pdf-foss-for-cpp)
target_link_libraries(your_app PRIVATE aspose_pdf_foss)What compiler and CMake versions are required?
A C++20 compiler — clang 16+, gcc 13+, or MSVC 2022 17.5+ — and CMake 3.22 or later. The build also requires Python 3 at build time only, to generate the bundled Standard-14 font outlines.
Does the library have any runtime dependencies?
No. Aspose.PDF FOSS for C++ links against nothing but the C++ standard library — no third-party PDF, image, or compression dependency is required at runtime.
Which formats can Aspose.PDF FOSS for C++ read and export?
It opens and saves native PDF documents. Rendered pages can be exported to
Bmp, Jpeg, and Tiff via BmpDevice, JpegDevice, and TiffDevice, and to
plain text via TextDevice. SVG content can be imported into a document via
SvgLoadOptions.
How do I open an existing PDF and check its page count?
#include <aspose/pdf/document.hpp>
Aspose::Pdf::Document doc("input.pdf");
std::size_t pages = doc.Pages().Count();How do I extract text from a PDF document?
Use TextAbsorber, visit the document, then read the collected text:
#include <aspose/pdf/document.hpp>
#include <aspose/pdf/text_absorber.hpp>
Aspose::Pdf::Document doc("input.pdf");
Aspose::Pdf::Text::TextAbsorber absorber;
absorber.Visit(doc);
std::string text = absorber.Text();How do I render a PDF page to an image?
Use a device class such as PngDevice with a target Resolution, then process
a single page to an output stream:
#include <aspose/pdf/document.hpp>
#include <aspose/pdf/png_device.hpp>
#include <aspose/pdf/resolution.hpp>
#include <fstream>
Aspose::Pdf::Document doc("input.pdf");
Aspose::Pdf::Devices::PngDevice png(Aspose::Pdf::Devices::Resolution(150));
std::ofstream out("page1.png", std::ios::binary);
png.Process(doc.Pages()[1], out);How do I encrypt a PDF document?
Call Document.Encrypt() with a user password, an owner password, a
Permissions value, and a CryptoAlgorithm:
#include <aspose/pdf/document.hpp>
Aspose::Pdf::Document doc("input.pdf");
doc.Encrypt("user-password", "owner-password",
Aspose::Pdf::Permissions(), Aspose::Pdf::CryptoAlgorithm::AESx256);
doc.Save("encrypted.pdf");RC4x40, RC4x128, AESx128, and AESx256 are all available through the
CryptoAlgorithm enum. Document.Decrypt() removes encryption from an
already-open document.
How do I read or fill AcroForm field values?
Iterate Form.Fields() from the document and read or set each field’s value
by its partial name:
#include <aspose/pdf/document.hpp>
#include <aspose/pdf/forms/form.hpp>
Aspose::Pdf::Document doc("application_form.pdf");
auto& form = doc.Form();
for (auto* field : form.Fields()) {
if (field->PartialName() == "applicant_name") {
field->Value("Jane Doe");
}
}
doc.Save("application_filled.pdf");Are there any known limitations in the current release?
Yes. XmpValue — the value type used for XMP metadata entries returned from
Document.Metadata() — exposes type-checking helpers IsDateTime(),
IsField(), IsNamedValue(), IsRaw(), IsNamedValues(), and
IsStructure() that are currently stubs and always return false. Code that
branches on these checks cannot distinguish those XMP value kinds. Use the
implemented checks instead — IsString(), IsInteger(), IsDouble(),
IsArray() — or call the matching accessor (ToStringValue(), ToInteger(),
ToDouble(), ToArray()) directly when the value’s kind is already known
from context. A small number of low-level internal types also contain stub
constructors that are not exercised by typical document-processing code.
Where is the source code and issue tracker?
The source code and issue tracker are available at
https://github.com/aspose-pdf-foss/Aspose.PDF-FOSS-for-Cpp.