DynaPDF Manual - Page 31
Previous Page 30 Index Next Page 32

Language Bindings
Page 31 of 860
Microsoft Visual C++
To use DynaPDF with Microsoft's Visual C++, proceed as follows:
1. Open a new project, or your favourite project, in Visual Studio.
2. Include the header file /include/C_CPP/dynapdf.h into the units which will use
DynaPDF functions.
3. Add the import library /mvs_lib/dynapdf.lib or /mvs_lib/dynapdfm.lib to your project.
4. Copy the dynapdf.dll or dynapdfm.dll into a Windows search path (e.g.
Windows/System32).
5. Finished!
DynaPDF was compiled and developed with Microsoft Visual Studio 2017 but the library can be
used with older version too. Two versions of the library are delivered:
• dynapdf.dll
// Compiled with Multithreaded
• dynapdfm.dll // Compiled with Multithreaded DLL
The dynapdfm.dll depends on the Visual Studio Redistributable package that can be
downloaded from our website. The latest version can also be downloaded from the Microsoft
website. Visual Studio 2015, 2017, 2019, and 2022 use all the same redistributable package.
If possible, use the dynapdf.dll since this version has no additional dependency.
If you want to use DynaPDF with a C++ project, add the line "using namespace DynaPDF;" after
including the header file dynapdf.h.
The usage in C is essentially the same as in C++, with the exception that the namespace
DynaPDF must not be declared.
A PDF instance can be used to create an arbitrary number of PDF files. All used resources are
automatically freed when the PDF file is closed (except when the PDF file was created in
memory, in this case FreePDF() must be called when finish). To improve processing speed, use
one instance as long as possible.
Most examples are written in C or C++.
Example (C++):
// Include the DynaPDF header file (change the path if necessary)
#include "dynapdf.h"
// All data types and functions are declared in the namespace DynaPDF.
using namespace DynaPDF;
// First, we declare an error callback function that is called by
// DynaPDF if an error occurred.
SI32 PDF_CALL PDFError(const void* Data, SI32 ErrCode, const char*
ErrMessage, SI32 ErrType)
Previous topic: Embarcadero C++ Builder
Next topic: Microsoft Visual Basic 6.0, Exception handling in Visual Basic