Suppprt Barcode Generation in PDF Form Filler SDK product

#ifndef __PDFFORMFUNC_H__
#define __PDFFORMFUNC_H__

#include <windows.h>

#ifdef __cplusplus
extern "C" {
#endif

#define EXTERN __declspec(dllexport)

//PDFForm_SetLicenseKey
//Parameters:
//  lpLicenseKey: a License Key which issued by VeryPDF
EXTERN void WINAPI PDFForm_SetLicenseKey(LPCTSTR lpLicenseKey);

//PDFForm_MergeFDFIntoPDF
//  Merge FDF file into an existing PDF file and generate a new filled PDF file.
//Parameters:
//  lpInPDF: input PDF file
//  lpInFDF: input FDF file
//  lpOutPDF: merged PDF file
//Return value:
//  TRUE is success, FALSE is fail
EXTERN BOOL WINAPI PDFForm_MergeFDFIntoPDF(LPCTSTR lpInPDF, LPCTSTR lpInFDF, LPCTSTR lpOutPDF);
EXTERN BOOL WINAPI PDFForm_MergeXFDFIntoPDF(LPCTSTR lpInPDF, LPCTSTR lpInFDF, LPCTSTR lpOutPDF);

//PDFForm_ExtractFDFFromPDF
//  Extract FDF file from a filled PDF file.
//Parameters:
//  lpInPDF: input PDF file
//  lpOutFDF: output FDF file
//Return value:
//  TRUE is success, FALSE is fail
EXTERN BOOL WINAPI PDFForm_ExtractFDFFromPDF(LPCTSTR lpInPDF, LPCTSTR lpOutFDF);
//PDFForm_FlattenPDF
//  Flatten a form filled PDF file
//Parameters:
//  lpInPDF: input PDF file
//  lpOutPDF: output PDF file
//Return value:
//  TRUE is success, FALSE is fail
EXTERN BOOL WINAPI PDFForm_FlattenPDF(LPCTSTR lpInPDF, LPCTSTR lpOutPDF);

//PDFForm_EncryptPDF
//  Encrypt a PDF file.
//Parameters:
//  lpInPDF: input PDF file
//  lpUserPwd: user password
//  lpOwnerPwd: owner password
//  lpPermissions: permissions, it can be following values,
//     Printing // top quality printing
//     ModifyContents = ModifyContents | Assembly
//     Copy = Copy | ScreenReaders
//     ModifyAnnotations = ModifyAnnotations | FillIn
//     FillIn
//     ScreenReaders
//     Assembly
//     DegradedPrinting
//  nKeyLen: 128 or 40 bits
//  lpOutPDF: output PDF file
//Return value:
//  TRUE is success, FALSE is fail
EXTERN BOOL WINAPI PDFForm_EncryptPDF(LPCTSTR lpInPDF, LPCTSTR lpUserPwd, LPCTSTR lpOwnerPwd, LPCTSTR lpPermissions,
int nKeyLen, LPCTSTR lpOutPDF);

//PDFForm_Alloc
//Return value:
// 0 is an error, other values are valid ID.
EXTERN long WINAPI PDFForm_Alloc();
//PDFForm_Free
//Parameters:
//  id: a valid ID returned by PDFForm_Alloc() function
//
//Return value:
//  0 is success, other values are indicate an error
EXTERN long WINAPI PDFForm_Free(long id);

//PDFForm_SetTextField
//Parameters:
//  id: a valid ID returned by PDFForm_Alloc() function
//  lpFieldName: form field name
//  lpFieldValue: form field value
//
//Return value:
//  if return value less than zero, it is indicate an error,
//  if return value large than zero, it is the number of form fields in the list
EXTERN long WINAPI PDFForm_SetTextField(long id, LPCTSTR lpFieldName, LPCTSTR lpFieldValue);

//PDFForm_SetCheckBox
//Parameters:
//  id: a valid ID returned by PDFForm_Alloc() function
//  lpFieldName: form field name
//  lpFieldValue: form field value
//
//Return value:
//  if return value less than zero, it is indicate an error,
//  if return value large than zero, it is the number of form fields in the list
EXTERN long WINAPI PDFForm_SetCheckBox(long id, LPCTSTR lpFieldName, LPCTSTR lpFieldValue);

//PDFForm_Apply
//Parameters:
//  id: a valid ID returned by PDFForm_Alloc() function
//  lpInFile: input PDF file
//  lpOutFile: output PDF file
//  bFlatten: make the output file flatten or not
//
//Return value:
//  0 is success, other values are indicate an error
//  -6: create FDF file error
//  -7: import form data into PDF file error
//  -8: flatten filled PDF file error
EXTERN long WINAPI PDFForm_Apply(long id, LPCTSTR lpInFile, LPCTSTR lpOutFile, LONG bFlatten);

//PDFForm_ClearFields
//Parameters:
//  id: a valid ID returned by PDFForm_Alloc() function
//
//Return value:
//  0 is success, other values are indicate an error
EXTERN long WINAPI PDFForm_ClearFields(long id);

//PDFForm_RepairFormFonts
//Repair fonts layout in PDF forms
//Parameters:
//  lpInPDF: input PDF file
//  lpOutFDF: output FDF file
//Return value:
//  TRUE is success, FALSE is fail
EXTERN BOOL WINAPI PDFForm_RepairFormFonts(LPCTSTR lpInPDF, LPCTSTR lpOutPDF);
//PDFForm_InsertDataMatrixImageIntoPDF
//Insert DataMatrix Image Into PDF file
//Parameters:
//  lpInPDF: input PDF file
//  lpOutFDF: output FDF file
//  lpFormName: DataMatrix form name
//  lpBarcodeText: Barcode text
//Return value:
//  TRUE is success, FALSE is fail
//
//int bRet = PDFForm_InsertDataMatrixImageIntoPDF("C:\\test.pdf", "C:\\out.pdf", "Datamatrix", "01034009377771791712073110BXBWWW22");
EXTERN BOOL WINAPI PDFForm_InsertDataMatrixImageIntoPDF(LPCTSTR lpInFile, LPCTSTR lpOutFile, LPCTSTR lpFormName, LPCTSTR lpBarcodeText);

//PDFForm_InsertBarcodeIntoPDF
//Insert Barcode into PDF file
//Parameters:
//  lpInPDF: input PDF file
//  lpOutFDF: output FDF file
//  lpFormName: Barcode form name
//  lpFormType: Barcode type, lpFormType supports following CodeType:
//   private enum CodeType
//   {
//    Code128,
//    Code39,
//    Codabar,
//    Datamatrix,
//    EAN,
//    Inter25,
//    PDF417,
//    Postnet
//   }
//  lpFormValue: Barcode text
//Return value:
//  TRUE is success, FALSE is fail
//
EXTERN BOOL WINAPI PDFForm_InsertBarcodeIntoPDF(LPCTSTR lpInFile, LPCTSTR lpOutFile, LPCTSTR lpFormName, LPCTSTR lpFormType, LPCTSTR lpFormValue);

//PDFForm_InsertBarcodeIntoPDF2
//Insert Barcode into PDF file
//Parameters:
//  lpInPDF: input PDF file
//  lpOutFDF: output FDF file
//  lpFormValues: Parameters FieldIdBarcode, TypeBarcode, FieldValueBarcode as a string-list (separated by for example newline).
//   Then we would do ONE call instead of n-times calling the proc with
//   the n as the number of special fields
//  Barcode type supports following CodeType:
//   private enum CodeType
//   {
//    Code128,
//    Code39,
//    Codabar,
//    Datamatrix,
//    EAN,
//    Inter25,
//    PDF417,
//    Postnet
//   }
//Return value:
//  TRUE is success, FALSE is fail
//
//e.g.,
//
//string strFormValues;
//strFormValues += "BarCode1[0]=>Code128=>1234567890";
//strFormValues += "\n";
//strFormValues += "BarCode2[0]=>Code39=>1234567890";
//strFormValues += "\n";
//strFormValues += "BarCode3[0]=>Codabar=>A1234567890A";
//PDFForm_InsertBarcodeIntoPDF2("C:\\test.pdf", "C:\\out.pdf", strFormValues.c_str());
//
EXTERN BOOL WINAPI PDFForm_InsertBarcodeIntoPDF2(LPCTSTR lpInFile, LPCTSTR lpOutFile, LPCTSTR lpFormValues);

#ifdef __cplusplus
}
#endif

#endif

//Example code 1:

#include <windows.h>
#include "../vc++/pdfformfunc.h"
#include <io.h>
#include <stdio.h>

void GetModulePath(char *out_path,char *in_name)
{
char *p;
GetModuleFileName(NULL,out_path,256);
p =strrchr(out_path,'\\');
p[1]=0;
strcat(out_path,in_name);
}

void main(int argc, char *argv[])
{
char szBarcodeTemp[MAX_PATH];
GetModulePath(szBarcodeTemp, "Barcode-temp.pdf");
char szBarcodeNew[MAX_PATH];
GetModulePath(szBarcodeNew, "_Barcode-out.pdf");
CopyFile(szBarcodeTemp, szBarcodeNew, FALSE);

BOOL bRet = FALSE;
PDFForm_SetLicenseKey("XXXXXXXXXXXXXXXXXXXXX");
bRet = PDFForm_InsertBarcodeIntoPDF(szBarcodeNew, szBarcodeNew, "BarCode1[0]", "Code128", "1234567890");
bRet = PDFForm_InsertBarcodeIntoPDF(szBarcodeNew, szBarcodeNew, "BarCode2[0]", "Code39", "1234567890");
bRet = PDFForm_InsertBarcodeIntoPDF(szBarcodeNew, szBarcodeNew, "BarCode3[0]", "Codabar", "A1234567890A");
bRet = PDFForm_InsertBarcodeIntoPDF(szBarcodeNew, szBarcodeNew, "BarCode4[0]", "Datamatrix", "01034009377771791712073110BXBWWW22");
bRet = PDFForm_InsertBarcodeIntoPDF(szBarcodeNew, szBarcodeNew, "BarCode5[0]", "EAN", "01234567890100");
bRet = PDFForm_InsertBarcodeIntoPDF(szBarcodeNew, szBarcodeNew, "BarCode6[0]", "Inter25", "123456789");
bRet = PDFForm_InsertBarcodeIntoPDF(szBarcodeNew, szBarcodeNew, "BarCode7[0]", "PDF417", "1234567890");
bRet = PDFForm_InsertBarcodeIntoPDF(szBarcodeNew, szBarcodeNew, "BarCode8[0]", "Postnet", "1234567890");
printf("Return value is: %d\n", bRet);
return;
}

===================================

Example code 2:

#include <windows.h>
#include "../vc++/pdfformfunc.h"
#include <io.h>
#include <stdio.h>
#include <string>
using namespace std;

void GetModulePath(char *out_path,char *in_name)
{
char *p;
GetModuleFileName(NULL,out_path,256);
p =strrchr(out_path,'\\');
p[1]=0;
strcat(out_path,in_name);
}

void main(int argc, char *argv[])
{
char szBarcodeTemp[MAX_PATH];
GetModulePath(szBarcodeTemp, "Barcode-temp.pdf");
char szBarcodeNew[MAX_PATH];
GetModulePath(szBarcodeNew, "_Barcode-out2.pdf");

BOOL bRet = FALSE;
PDFForm_SetLicenseKey("XXXXXXXXXXXXXXXXXXXXX");

string strFormValues;
strFormValues += "BarCode1[0]=>Code128=>1234567890";
strFormValues += "\n";
strFormValues += "BarCode2[0]=>Code39=>1234567890";
strFormValues += "\n";
strFormValues += "BarCode3[0]=>Codabar=>A1234567890A";
strFormValues += "\n";
strFormValues += "BarCode4[0]=>Datamatrix=>01034009377771791712073110BXBWWW22";
strFormValues += "\n";
strFormValues += "BarCode5[0]=>EAN=>01234567890100";
strFormValues += "\n";
strFormValues += "BarCode6[0]=>Inter25=>123456789";
strFormValues += "\n";
strFormValues += "BarCode7[0]=>PDF417=>1234567890";
strFormValues += "\n";
strFormValues += "BarCode8[0]=>Postnet=>1234567890";
bRet = PDFForm_InsertBarcodeIntoPDF2(szBarcodeTemp, szBarcodeNew, strFormValues.c_str());

printf("Return value is: %d\n", bRet);
return;
}
============================================

I tried the new dll but had a problem to call the function, although I do exactly the same (I think so)
as I did with using BarcodeIntoPDF when I got it in the first release.
In the document I screenshoted the message and the .dll and .lib version info. I think PDFFom.dll / PDFform.lib are the only changed files ?!

And that is the .NET-program-source I'm using.
================================
Sorry for the mistake, the new pdfform.dll file does contain “_PDFForm_InsertBarcodeIntoPDF2@12” function name, this is wrong, we have corrected this problem in the new pdfform.dll file just now, please download new DLL file from following URL to try again,

XXXXXXXXXXXXXXXX

VeryPDF
VN:F [1.9.20_1166]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.20_1166]
Rating: 0 (from 0 votes)

Related Posts

This entry was posted in PDF Form Filler, VeryPDF Blog and tagged . Bookmark the permalink.

One Response to Suppprt Barcode Generation in PDF Form Filler SDK product

  1. Pingback: Affixed a Barcode on a PDF file | VeryPDF Knowledge Base

Leave a Reply

Your email address will not be published. Required fields are marked *


Verify Code   If you cannot see the CheckCode image,please refresh the page again!