It has been a while but I've done this before. I'm having trouble with this one because of the CHAR data type (e.g. DSSPDF_New). From what I can tell this would be byte in vb but I know that I need to pass strings. ByVal varname As String doesn't work - Bad DLL Calling Convention. As byte doesn't work either. If I declare a variable As Byte and try and pass it it crashes.
Any help is appreciated.
This is a link to some C code making the API calls. The DLL is free from dreamsyssoft. I've asked if they have VB API calls, but no response yet.
DreamSys Free PDF Library (Text and Image to PDF)
Any help is appreciated.
This is a link to some C code making the API calls. The DLL is free from dreamsyssoft. I've asked if they have VB API calls, but no response yet.
DreamSys Free PDF Library (Text and Image to PDF)
VB.NET:
#pragma once
#ifdef PDF_DLL_EXPORT
#define PDFAPI _declspec(dllexport)
#else
#define PDFAPI _declspec(dllimport)
#endif
#ifdef __cplusplus
extern "C" {
#endif
typedef unsigned char byte;
typedef int (*GetTiff)(void *, byte **, int *);
typedef void (*FreeTiff)(void *);
typedef void * PDF_HANDLE;
typedef void * SECTION_HANDLE;
#define TYPE_TIFF 0
#define TYPE_BMP 1
typedef struct _TIFF_DATA
{
GetTiff getTiff;
FreeTiff freeTiff;
void *data;
int type;
} TIFF_DATA;
PDFAPI PDF_HANDLE DSSPDF_New(char *title, char *producer);
PDFAPI SECTION_HANDLE DSSPDF_AddSection(PDF_HANDLE hPdf, char *sectionName);
PDFAPI void DSSPDF_AddPage(SECTION_HANDLE hSection, TIFF_DATA *page);
PDFAPI void DSSPDF_AddFilePage(SECTION_HANDLE hSection, char *fileName); //, int type);
PDFAPI void DSSPDF_Save(PDF_HANDLE hPdf, char *fileName);
PDFAPI void DSSPDF_Free(PDF_HANDLE hPdf);
#ifdef __cplusplus
}
#endif