Skip to Content

Migrating from Adobe C/C++ to the APDFL Modern C++ SDK

Estimated Reading Time: 3 Minutes
Overview

The Adobe PDF Library (APDFL) Modern C++ SDK provides a C++17 interface with automatic resource management, C++ exceptions, and strongly typed flags. It uses the same APDFL runtime as the Adobe C/C++ interface, but exposes a different API.

Adopting Modern C++ is a source-code port. It is separate from upgrading the existing Adobe C/C++ interface from APDFL v18 to v21. Adobe C/C++ remains supported, so applications can upgrade to v21 before evaluating a Modern C++ migration. Refer to the knowledgebase article: What is Modern C++

Before You Begin

Confirm that your application can use C++17 and a supported 64-bit platform. Modern C++ does not support 32-bit applications or AIX. Windows development requires Visual Studio 2022 with the `v143` toolset; Linux and macOS also have newer toolchain requirements. Check the [Modern C++ Supported Environments](https://dev.datalogics.com/adobe-pdf-library-21/modern-c-plus-plus/supported-environments) for the SDK release you plan to deploy.

Inventory the APDFL functionality your application uses before beginning the port. Include document operations, low-level PDF objects, forms, plug-ins, and licensing. Confirm that the Modern C++ API provides the operations you need; do not assume every Adobe C/C++ function has a direct equivalent.

What Changes?
Area Adobe C/C++ Modern C++ SDK
API C-style functions and HFT dispatch Classes in `datalogics_interface`
Headers Headers such as `PDCalls.h` and `CosCalls.h` Headers under `include/datalogics_interface`
Windows import library `DL210PDFL.lib` `datalogics_interface_api.lib`, or the Debug equivalent
Resource handling Explicit acquire/release calls RAII and documented smart-pointer ownership
Error handling `DURING` / `HANDLER` / `ERRORCODE` C++ exceptions


Migrate the Application

1. Build a Supplied Sample

Install the Modern C++ SDK separately and build a sample that resembles your workflow. Use its project configuration as the starting point for include paths, library paths, runtime dependencies, and resource discovery.

The sample `Directory.Build.props` selects the appropriate Debug or Release library and configures shared project settings. Carry those settings into your project rather than changing only the Adobe C/C++ library name. On Windows, the Debug import library is `datalogics_interface_apid.lib`.

2. Port One Workflow First

Start with a small operation, such as opening and saving a document. Map the existing API calls to the corresponding Modern C++ classes and methods, then expand to page processing and conversion.

Keep the initial port focused on reproducing the existing behavior. Use the supplied examples and API documentation to confirm method parameters, ownership, and object lifetimes. A successful build of the old application against APDFL v21 does not establish compatibility with this separate interface.

3. Update Resource and Error Handling

Replace manual release calls with the ownership model documented for each Modern C++ object. Avoid retaining old cleanup code that releases an object already managed by RAII or a smart pointer.

Replace `DURING` / `HANDLER` blocks around migrated operations with C++ exception handling. Review cleanup and error-reporting paths as part of the change: ordinary C++ stack unwinding differs from the Adobe C/C++ error mechanism.

4. Review Low-Level PDF Operations

Modern C++ exposes low-level PDF objects through headers such as `pdf_object.hpp`, `pdf_dict.hpp`, `pdf_array.hpp`, and `pdf_stream.hpp`. These provide an object-oriented approach to work previously performed through the Cos API.

Check your specific operations against the SDK's available methods. For specialized Cos manipulation or form-field creation, confirm coverage with Datalogics Support before committing to the port.

5. Configure Licensing and Deployment

Modern C++ exposes licensing through the `Library` class, including `Library::set_license_key(...)`, rather than the Adobe C/C++ functions in `DLLicense.h`. Follow the sample initialization sequence for your distribution and licensing model.

Deploy the matching Modern C++ interface libraries, APDFL runtime, required plug-ins, and resources. Verify resource discovery from the application's actual working directory and deployment location.

Verify the Migration

Compare the ported workflow with the Adobe C/C++ implementation using representative documents. Check output, error handling, and object lifetimes before migrating additional functionality.

How to Get Additional Help

Contact Datalogics Tech Support 

Fetch the answers quickly using our AI assistant Scout, available for any language. Scout also opens access to our MCP server, connecting APDFL with your favorite AI tools for faster and easier coding. 

Migrating from Adobe C/C++ to the APDFL Modern C++ SDK
  • COMMENT