How to stamp unicode characters to PDF pages using pdfstamp.dll from VB6?

hi, when I try to use the examples I get "pdfstamp.dll" not found. i did copy the pdfstamp.dll to the example directory. but still it doesnt work.
also do you have more examples:

I am trying to add text (an address line in hebrew) into a pdf.

Would be nice if i could get an example on how to position the text to a specific position on the pdf (not centered, top, bottom)

I am running windows 10.

Customer
--------------------------------
Please copy the following DLL files to system32 or syswow64 folder to try again, your application will able to load "pdfstamp.dll" properly,

cimage.dll
imgconv.dll
Interop.PDFStampCom.dll
pdf2any.dll
pdflayerdll.dll
pdfsdk.dll
PdfStamp.dll
PDFStampOcx.dll
pdftoolsdk.dll

You can use PDFStampWriteTextExW() function to place text to anywhere on the PDF pages, for example,

if(!LoadVeryWDll())
    return;

GetModulePath(szPDFFile,"example.pdf");
GetModulePath(szOutFile,"textstamp_unicode_out.pdf");

//Register PDFStamp SDK with your License Key
VeryStampReg ("XXXXXXXXXXXXXXXXXXXXX");

id = PDFStampOpen(szPDFFile);
if (id > 0)
{
    for(int i = 1; i <= PDFStampGetPageCount(id); i++)
    {
        if(PDFStampEditPage(id,i) == 1)
        {
            long nFont = PDFStampSetFontA(id, "Arial Unicode MS", 0, 12, 1, 39);
            PDFStampSetFillColor(id, 0x000000FF);
            double dbTextLen = PDFStampGetTextWidthExW(
                     id, (unsigned short *)lpData, nLength/2);
            BOOL bRet = PDFStampWriteTextExW(id, 100, 200,
                     (unsigned short *)lpData, nLength/2);
            PDFStampEndPage(id);
        }
    }
    PDFStampClose(id, szOutFile);
}

FreeVeryWDll();

VeryPDF
--------------------------------
Thanks for the reply.

1. I was able to run a program with pdfstamp.dll (loading ok after putting all dll in system dir)

2. Thanks for the example but i do not have those function declared anywhere:

PDFStampWriteTextExW
PDFStampGetTextWidthExW
GetModulePath

etc,

do you have a VISUAL BASIC demo project with those functions.
Visual Basic 6 (not .net), thanks.

Customer
--------------------------------

You can use following VB6 code to use Unicode functions easily,

Private Declare Function VeryStampReg Lib "PdfStamp.dll" (ByVal strReg As String) As Long
Private Declare Function PDFStampOpen Lib "PdfStamp.dll" (ByVal lpInPDF As String) As Long
Private Declare Function PDFStampClose Lib "PdfStamp.dll" (ByVal hPDF As Long, ByVal lpOutPDF As String) As Long
Private Declare Function PDFStampSetFontA Lib "PdfStamp.dll" (ByVal hPDF As Long, ByVal fontName As String, ByVal fontStyle As Long, ByVal fontSize As Double, ByVal isEmbed As Long, ByVal nCodePage As Long) As Long
Private Declare Function PDFStampSetFillColor Lib "PdfStamp.dll" (ByVal hPDF As Long, ByVal nColor As Long) As Long
Private Declare Function PDFStampWriteTextA Lib "PdfStamp.dll" (ByVal hPDF As Long, ByVal x As Double, ByVal y As Double, ByVal lpText As String) As Long
Private Declare Function PDFStampWriteTextW Lib "PdfStamp.dll" (ByVal hPDF As Long, ByVal x As Double, ByVal y As Double, ByVal lpWText As Long) As Long
Private Declare Function PDFStampWriteTextExA Lib "PdfStamp.dll" (ByVal hPDF As Long, ByVal x As Double, ByVal y As Double, ByVal lpText As String, ByVal nLen As Long) As Long
Private Declare Function PDFStampWriteTextExW Lib "PdfStamp.dll" (ByVal hPDF As Long, ByVal x As Double, ByVal y As Double, ByVal lpWText As Long, ByVal nLen As Long) As Long
Private Declare Function PDFStampEditPage Lib "PdfStamp.dll" (ByVal hPDF As Long, ByVal nPageIndex As Long) As Long
Private Declare Function PDFStampEndPage Lib "PdfStamp.dll" (ByVal hPDF As Long) As Long
Private Declare Function PDFStampGetPageCount Lib "PdfStamp.dll" (ByVal hPDF As Long) As Long
Private Declare Function PDFStampGetTextWidthA Lib "PdfStamp.dll" (ByVal hPDF As Long, ByVal lpText As String) As Double
Private Declare Function PDFStampGetTextWidthW Lib "PdfStamp.dll" (ByVal hPDF As Long, ByVal lpWText As Long) As Double
Private Declare Function PDFStampGetTextWidthExA Lib "PdfStamp.dll" (ByVal hPDF As Long, ByVal lpText As String, ByVal nLen As Long) As Double
Private Declare Function PDFStampGetTextWidthExW Lib "PdfStamp.dll" (ByVal hPDF As Long, ByVal lpWText As Long, ByVal nLen As Long) As Double

Private Sub PDFStamper_Click()

    VeryStampReg ("XXXXXXXXXXXXXXXXXXXXX")

    id = PDFStampOpen("D:\downloads\Sample_4.pdf")
    If (id > 0) Then
        nPage = 1
        pagecount = PDFStampGetPageCount(id)
        Do While nPage <= pagecount

            If (PDFStampEditPage(id, nPage) = 1) Then

                nFont = PDFStampSetFontA(id, "Arial Unicode MS", 0, 12, 1, 39)
                nRet = PDFStampSetFillColor(id, RGB(255, 0, 0))

                strUnicode = StrConv("VeryPDF", vbUnicode)
                dbTextLen = PDFStampGetTextWidthExW(id,
                           ByVal StrPtr(strUnicode), Len(strUnicode))
                nRet = PDFStampWriteTextExW(id, 100, 200,
                           ByVal StrPtr(strUnicode), Len(strUnicode))
                PDFStampEndPage (id)
            End If
            nPage = nPage + 1
        Loop
        nRet = PDFStampClose(id, "D:\downloads\Sample_4_Stamped.pdf")
    End If
End Sub

We have released a new version today, please download the new version from this URL,

http://www.verypdf.com/pdfstamp/pdfstamp_sdk.zip
http://www.verypdf.com/app/pdf-stamp/try-and-buy.html#buy-sdk

The new version is contain a "example_for_vb_unicode" folder, this is a VB6 example, you can compile and run it easily.

VeryPDF

VN:F [1.9.20_1166]
Rating: 10.0/10 (1 vote cast)
VN:F [1.9.20_1166]
Rating: 0 (from 0 votes)
How to stamp unicode characters to PDF pages using pdfstamp.dll from VB6?, 10.0 out of 10 based on 1 rating

Related Posts

This entry was posted in PDF Stamp and tagged . Bookmark the permalink.

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!