DynaPDF Manual - Page 42

Previous Page 41   Index   Next Page 43

Language Bindings
Page 42 of 839
application on a 64 bit Windows version then copy the 32 bit version of the dynapdf.dll into
Windows/SysWow64 and the 64 bit version into Windows/System32. Yes, this is correct!
Both versions can be used simultaneously. Windows loads automatically the right version if
you have copied the DLLs into the right directories.
Note that the DLL should be copied into the system folder on your development machine only
so that Visual Studio is able to load it. The installer of your application should copy the DLL
into the application directory instead.
General Note:
Visual Studio .Net copies the interface file CPDF.cs into your project directory if the option
“Link file” is not selected when adding the file to your project. Make sure that you always link
the files to your project. Otherwise you must update the interface manually whenever you
install a newer version of DynaPDF.
All DynaPDF functions are encapsulated in the wrapper class CPDF. This class makes sure that
the DynaPDF functions can be used without limitations and programming with DynaPDF
becomes more comfortable. You don't need to consider specific return values of the DLL; the
class converts API data types automatically to C# data types.
However, C# uses a very restrictive data type handling that causes that already signed integers
cannot be passed to unsigned integer variables of the same type without explicit conversion.
To make the usage of DynaPDF less complicated most function parameters which would
normally declared as unsigned integer, e.g. PDF object handles, are declared as signed integer
to get rid of permanent explicit data type conversions.
The usage of DynaPDF with C# is nearly identical in comparison to C++. The interface does
generally not use events like in VB .Net because callback functions work very well in C#.
Data types in C#
All structures and enums used by DynaPDF are declared in the namespace DynaPDF. Because
it is not possible to declare constants in a namespace, such constants are declared in the class
CPDF. All data types, structures, and constants are defined in the file CPDF.cs. No further files
are required to use DynaPDF.
Example (Visual C#):
using System;
using DynaPDF;
using System.Runtime.InteropServices.Marshal;
namespace hello_world
class Hello_World
// Error callback function.
static int PDFError(IntPtr Data, int ErrCode, IntPtr ErrMessage,

Previous topic: Visual C#, .Net Core compatibility, Using DynaPDF with Visual Studio, 64 Bit Applications

Next topic: Embarcadero Delphi, 64 Bit Applications, General Usage