Xojo Developer Conference
25/27th April 2018 in Denver.
MBS Xojo Conference
6/7th September 2018 in Munich, Germany.

DynaPDF Manual - Page 38

Previous Page 37   Index   Next Page 39

Language Bindings
Page 38 of 750
Visual C#
The usage of DynaPDF with Visual C# is essentially the same as with C or C++ except that the
exported DLL functions are encapsulated in the wrapper class CPDF to make the usage easier.
The instance pointer IPDF that is used by every DynaPDF function is hidden for the user in C#.
The instance pointer is controlled by the wrapper class so that you must not create PDF
instances manually.
To use DynaPDF with Visual C# proceed as follows:
Add the file /include/Visual_C#/CPDF.cs to your project (menu Project/Add Existing
Element…).
Make sure that the dynapdf.dll can be found; just copy the DLL into the
Windows/System32 directory, finished!
64 Bit Applications
With C# you can develop 32 bit and 64 bit applications. One thing that must be considered is
that the target CPU type in Visual Studio must not be set to UseAny. This is impossible since
you can either link the 32 bit dynapdf.dll or the 64 bit version but not both.
So, a 32 bit and 64 bit version must be compiled separately. Another thing that is often
misunderstood is the right system directory for the dynapdf.dll. If you develop a 32 bit
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 files 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.
 

Previous topic: The DoEvents problem

Next topic: Data types in C#