Our Powerbuilder application is uses a file-copy deployment, what is needed to deploy your PDFstamp.dll?
I meant if I deploy my application with PDFStamp.dll in the application folder is that sufficient or does your dll need to be registered or any registry settings need to be added? I didn't see anything in your user manual about deployment and I can't get the VB code example to work.
Thanks,
Customer
------------------------------------
You can call veryReg() function from your VB code to register "PdfStamp.dll" library, please refer to following sample VB source code,
Private Declare Function veryReg Lib "PdfStamp.dll" (ByVal reg As String) As Long
Private Declare Function veryOpen Lib "PdfStamp.dll" (ByVal sIn As String, ByVal sOut As String) As Long
Private Declare Sub veryClose Lib "PdfStamp.dll" (ByVal id As Long)
Private Declare Function verySetFunction Lib "PdfStamp.dll" (ByVal id As Long, ByVal func_code As Long, ByVal Para1 As Long, ByVal Para2 As Long, ByVal szPara3 As String, ByVal szPara4 As String) As Long
Private Declare Function veryGetFunction Lib "PdfStamp.dll" (ByVal id As Long, ByVal func_code As Long, ByVal Para1 As Long, ByVal Para2 As Long, ByVal szPara3 As String, ByVal szPara4 As String) As Long
Private Declare Function veryAddImage Lib "PdfStamp.dll" (ByVal id As Long, ByVal position As Long, ByVal filename As String, ByVal shift_lr As Long, ByVal shift_tb As Long, ByVal rotate As Long, ByVal layer As Long, ByVal zoomW As Long, ByVal zoomH As Long, ByVal action As Long, ByVal link As String, ByVal pageno As Long) As Long
Private Declare Function veryAddText Lib "PdfStamp.dll" (ByVal id As Long, ByVal position As Long, ByVal sstring As String, ByVal color As Long, ByVal alignment As Long, ByVal shift_lr As Long, ByVal shift_tb As Long, ByVal rotate As Long, ByVal layer As Long, ByVal hollow As Long, ByVal fontcode As Long, ByVal fontname As String, ByVal fontsize As Long, ByVal action As Long, ByVal link As String, ByVal pageno As Long) As Long
Private Declare Function veryAddLine Lib "PdfStamp.dll" (ByVal id As Long, ByVal position As Long, ByVal line_width As Long, ByVal color As Long, ByVal shift_lr As Long, ByVal shift_tb As Long, ByVal rotate As Long, ByVal layer As Long, ByVal zoomW As Long, ByVal zoomH As Long) As Long
Private Declare Function veryAddRect Lib "PdfStamp.dll" (ByVal id As Long, _
ByVal sx_ As Long, ByVal sy_ As Long, ByVal ex_ As Long, _
ByVal ey_ As Long, ByVal side_width As Long, ByVal side_color As Long, _
ByVal flagFill As Long, ByVal fill_color As Long) As Long
Private Declare Function veryAddRectWithLayer Lib "PdfStamp.dll" (ByVal id As Long, _
ByVal sx_ As Long, ByVal sy_ As Long, ByVal ex_ As Long, _
ByVal ey_ As Long, ByVal side_width As Long, ByVal side_color As Long, _
ByVal flagFill As Long, ByVal fill_color As Long, _
ByVal layer As Long) As Long
'define for VerySetFunction
Const Very_Set_Range = 131
Const Very_Set_Opacity = 240
Const Very_Get_Opacity = 240
Const Very_Get_PdfPageCount = 206
Const Very_Get_PageBoxForStamp = 260
Private Sub StampIntoPDFFile()
Dim szInputPDFFile As String
Dim szOutPDFFile As String
Dim id As Long
Dim code As Long
Dim NullString As String
Dim nRet As Long
szInputPDFFile = "C:\example.pdf"
szOutPDFFile = "C:\out.pdf"
page = 1
strStamp = ""
nRet = veryReg("XXXXXXXXXXXXXXXXXXXXXX")
id = veryOpen(szInputPDFFile, szOutPDFFile)
If (id > 0) Then
pagecount = veryGetFunction(id, Very_Get_PdfPageCount, 0, 0, 0, 0)
Do While page <= pagecount
strStamp = strStamp + "*"
code = verySetFunction(id, Very_Set_Range, page, 1, 0, 0)
code = veryAddText(id, 6, "page " & strStamp, RGB(255, 200, 100), 0, 0, 0, 0, 0, 0, 0, NullString, 0, 0, NullString, 0)
page = page + 1
Loop
veryClose(id)
End If
End Sub
Private Sub Command1_Click()
Dim szPDFFile As String
Dim id As Long
Dim code As Long
Dim lFile As Long
Dim NullString As String
Dim page As Long
Dim pagecount As Long
Dim iRet As Long
Dim nRet As Long
szPDFFile = "example.pdf"
nRet = veryReg("XXXXXXXXXXXXXXXXXXXXXX")
'id = veryOpen(szPDFFile, "")
'pagecount = veryGetFunction(id, 206, 0, 0, 0, 0)
'veryClose (id)
id = veryOpen(szPDFFile, "_001.pdf")
If (id > 0) Then
page = 1
pagecount = veryGetFunction(id, Very_Get_PdfPageCount, 0, 0, 0, 0)
MsgBox("Page Count = " + Str(pagecount))
For page = 1 To pagecount
Dim strStampBuf As String
Dim left As Long
Dim top As Long
Dim pagewidth As Long
Dim pageheight As Long
left = veryGetFunction(id, Very_Get_PageBoxForStamp, page, 0, "left", 0)
top = veryGetFunction(id, Very_Get_PageBoxForStamp, page, 0, "top", 0)
pagewidth = veryGetFunction(id, Very_Get_PageBoxForStamp, page, 0, "width", 0)
pageheight = veryGetFunction(id, Very_Get_PageBoxForStamp, page, 0, "height", 0)
iRet = verySetFunction(id, Very_Set_Range, page, 1, 0, 0)
strStampBuf = "Page:" + Str(pagecount - page + 1) + ", Page Box: [" + Str(left) + " " + Str(top) + " " + Str(pagewidth) + " " + Str(pageheight) + "]"
iRet = veryAddText(id, 2, strStampBuf, 255, 0, 0, 0, 0, 0, 0, 300, 0, 10, 1, "https://www.verypdf.com", 0)
Next page
code = veryAddText(id, 7, "\d\n\t", 255, 0, 50, -30, 0, 0, 0, 0, NullString, 10, 0, NullString, 0)
code = veryAddText(id, 5, "Page \P3+1 of \c", 255, 0, -50, -30, 0, 0, 0, 0, NullString, 10, 0, NullString, 0)
code = veryAddText(id, 3, "2003 verypdf.com Inc.", 2666666, 0, -30, 30, 0, 0, 0, 300, NullString, 10, 0, NullString, 0)
code = verySetFunction(id, Very_Set_Range, 2, 2, 0, 0)
iRet = verySetFunction(id, Very_Set_Opacity, 30, 0, 0, 0)
code = veryAddImage(id, 7, "logo.jpg", 30, -30, 0, 0, 0, 0, 0, 0, 0)
code = veryAddImage(id, 3, "logo.jpg", -30, 30, 0, 0, 0, 0, 0, 0, 0)
code = veryAddRect(id, 100, 100, 150, 150, 2, RGB(255, 0, 0), 0, RGB(255, 0, 0))
code = veryAddRect(id, 100, 300, 150, 350, 2, RGB(255, 0, 0), 1, RGB(255, 0, 0))
code = veryAddRect(id, 100, 400, 150, 450, 4, RGB(255, 255, 0), 0, RGB(255, 0, 0))
code = veryAddRect(id, 100, 500, 150, 550, 4, RGB(255, 255, 0), 1, RGB(255, 0, 255))
code = veryAddLine(id, 2, 1, RGB(255, 0, 0), 0, 80, 0, 0, 80, 0)
code = veryAddLine(id, 6, 1, RGB(0, 255, 0), 0, -80, 0, 0, 80, 0)
iRet = verySetFunction(id, Very_Set_Opacity, 80, 0, 0, 0)
code = veryAddRectWithLayer(id, 200, 100, 250, 150, 2, RGB(255, 0, 0), 0, RGB(255, 0, 0), 1)
code = veryAddRectWithLayer(id, 200, 300, 250, 350, 2, RGB(255, 0, 0), 1, RGB(255, 0, 0), 1)
code = veryAddRectWithLayer(id, 200, 400, 250, 450, 4, RGB(255, 255, 0), 0, RGB(255, 0, 0), 1)
code = veryAddRectWithLayer(id, 200, 500, 250, 550, 4, RGB(255, 255, 0), 1, RGB(255, 0, 255), 1)
veryClose(id)
End If
'//%text stamp%
'//%page header and page footer%
'//%Stamps are placed in the duplicate file, leaving the original copy unchanged%
id = veryOpen(szPDFFile, "1.pdf")
If (id > 0) Then
code = veryAddText(id, 7, "\d\n\t", 255, 0, 50, -30, 0, 0, 0, 0, NullString, 10, 0, NullString, 0)
code = veryAddText(id, 5, "Page \P3+1 of \c", 255, 0, -50, -30, 0, 0, 0, 0, NullString, 10, 0, NullString, 0)
code = veryAddText(id, 3, "2003 verypdf.com Inc.", 2666666, 0, -30, 30, 0, 0, 0, 300, NullString, 10, 0, NullString, 0)
veryClose(id)
End If
'//%.Supports Font Style, Font Size, Text Modes (solid, outline), Grayscale and RGB Color (0-255 RGB color values supported) %
'//%.Top, bottom, vertical center, diagonal-top left and diagonal-bottom left. %
'//%·¡èSupports multiple line text stamps within one stamp item %
id = veryOpen(szPDFFile, "2.pdf")
If (id > 0) Then
code = veryAddText(id, 3, "Sample File\nLambkin", 0, 0, 0, 0, 0, 0, 0, 300, NullString, 0, 0, NullString, 0)
code = veryAddText(id, 6, "Copyright verypdf.com, Inc.", RGB(255, 200, 100), 0, 0, 0, 0, 0, 0, 0, NullString, 0, 0, NullString, 0)
code = veryAddText(id, 9, "www.verypdf.com\n Demo", 255, 0, 0, 0, -45, 0, 1, 200, NullString, 48, 0, NullString, 0)
veryClose(id)
End If
'//%.Grayscale Color (0-255 RGB color values supported) %
'//%.diagonal-top left and diagonal-bottom left. %
'//%·¡èStamp on Top of or Underneath the original PDF document page contents %
'//·¡èJustification (when multi text)- Left, right, or center
id = veryOpen(szPDFFile, "3.pdf")
If (id > 0) Then
code = veryAddText(id, 5, "Page \p of \c", 0, 0, 0, 0, 0, 0, 0, 0, NullString, 10, 0, NullString, 0)
code = veryAddText(id, 9, "www.verypdf.com\n Demo", RGB(200, 200, 200), 18, 0, 0, -45, 1, 0, 301, NullString, 48, 0, NullString, 0)
veryClose(id)
End If
'//%·¡èSupports Font Style, Font Size, Text Modes (solid, outline), Grayscale and RGB Color (0-255 RGB color values supported) %
'//%·¡èStamp on Underneath the original PDF document page contents %
'//%·¡èText and Image can be stamped on any angle. Any positive or negative numbers, including decimal numbers may be used to specify an angle in degrees %
id = veryOpen(szPDFFile, "4.pdf")
If (id > 0) Then
code = veryAddText(id, 9, "www.verypdf.com", RGB(200, 200, 200), 0, 0, 0, -20, 1, 1, 202, NullString, 60, 0, NullString, 0)
veryClose(id)
End If
'//%·¡èStamps can be placed in the exact vertical center of a page (or the exact vertical center within a individual stamping space) %
id = veryOpen(szPDFFile, "5.pdf")
If (id > 0) Then
code = veryAddText(id, 9, "www.verypdf.com", RGB(255, 255, 0), 0, 0, 0, 0, 0, 0, 101, NullString, 48, 0, NullString, 0)
code = veryAddText(id, 8, "www.verypdf.com", RGB(0, 255, 255), 0, 0, 0, 90, 0, 0, 0, NullString, 48, 0, NullString, 0)
code = veryAddText(id, 4, "www.verypdf.com", RGB(0, 255, 255), 0, 0, 0, -90, 0, 0, 0, NullString, 48, 0, NullString, 0)
veryClose(id)
End If
'//tridimensional effect
id = veryOpen(szPDFFile, "6.pdf")
If (id > 0) Then
code = veryAddText(id, 9, "www.verypdf.com", RGB(64, 64, 64), 0, 1, 1, 45, 0, 0, 0, NullString, 64, 0, NullString, 0)
code = veryAddText(id, 9, "www.verypdf.com", RGB(255, 0, 0), 0, 0, 0, 45, 0, 0, 0, NullString, 64, 0, NullString, 0)
veryClose(id)
End If
'//hollow tridimensional effect
id = veryOpen(szPDFFile, "7.pdf")
If (id > 0) Then
code = veryAddText(id, 9, "www.verypdf.com", RGB(64, 64, 64), 0, 1, 2, 45, 1, 1, 0, NullString, 64, 0, NullString, 0)
code = veryAddText(id, 9, "www.verypdf.com", RGB(255, 0, 0), 0, 0, 0, 45, 0, 1, 0, NullString, 64, 0, NullString, 0)
veryClose(id)
End If
'//%·¡èSupports image stamp (JPEG/TIFF images) %
id = veryOpen(szPDFFile, "8.pdf")
If (id > 0) Then
code = veryAddImage(id, 7, "logo.jpg", 30, -30, 0, 0, 0, 0, 0, NullString, 0)
code = veryAddImage(id, 3, "logo.jpg", -30, 30, 0, 0, 0, 0, 0, NullString, 0)
veryClose(id)
End If
'//% image stamp %
'//%·¡èvertical center.%
id = veryOpen(szPDFFile, "9.pdf")
If (id > 0) Then
code = veryAddImage(id, 4, "logo.jpg", -10, 0, 90, 0, 0, 0, 0, NullString, 0)
code = veryAddImage(id, 8, "logo.jpg", 10, 0, -90, 0, 0, 0, 0, NullString, 0)
veryClose(id)
End If
'//%·¡è Wrap text to a new line if it would otherwise be too long to fit in its margined area%
id = veryOpen(szPDFFile, "10.pdf")
If (id > 0) Then
code = veryAddText(id, 9, "Wrap text to a new line if it would otherwise be too long to fit in its margined area.", 2666666, 16, 0, 0, 0, 1, 0, 0, NullString, 64, 0, NullString, 0)
veryClose(id)
End If
'//%·¡èSupports web links%
'//%·¡èEnabling you to easily position the stamp in any location on the page %
id = veryOpen(szPDFFile, "11.pdf")
If (id > 0) Then
code = veryAddText(id, 2, "Supports web links", RGB(255, 11, 0), 0, -50, 200, 0, 1, 0, 0, NullString, 48, 1, "http:'//www.verypdf.com", 0)
code = veryAddText(id, 4, "Enabling you to easily position the stamp\n in any location on the page", RGB(255, 11, 22), 17, -50, 200, 0, 0, 0, 0, NullString, 10, 1, "http:'//www.verypdf.com", 0)
veryClose(id)
End If
'//%text rotate and position%
id = veryOpen(szPDFFile, "12.pdf")
If (id > 0) Then
code = veryAddText(id, 1, "verypdf.com Inc.", 65296, 0, 0, 0, -45, 0, 0, 0, NullString, 48, 0, NullString, 0)
code = veryAddText(id, 3, "verypdf.com Inc.", 65296, 0, 0, 0, 45, 0, 0, 0, NullString, 48, 0, NullString, 0)
code = veryAddText(id, 5, "verypdf.com Inc.", 65296, 0, 0, 0, -45, 0, 0, 0, NullString, 48, 0, NullString, 0)
code = veryAddText(id, 7, "verypdf.com Inc.", 65296, 0, 0, 0, 45, 0, 0, 0, NullString, 48, 0, NullString, 0)
veryClose(id)
End If
'//%image rotate and position%
id = veryOpen(szPDFFile, "13.pdf")
If (id > 0) Then
code = veryAddImage(id, 9, "logo.jpg", -70, -70, -45, 0, 0, 0, 0, NullString, 0)
code = veryAddImage(id, 9, "logo.jpg", 70, -70, 225, 0, 0, 0, 0, NullString, 0)
code = veryAddImage(id, 9, "logo.jpg", 70, 70, 135, 0, 0, 0, 0, NullString, 0)
code = veryAddImage(id, 9, "logo.jpg", -70, 70, 45, 0, 0, 0, 0, NullString, 0)
veryClose(id)
End If
id = veryOpen(szPDFFile, "14.pdf")
If (id > 0) Then
code = veryAddText(id, 7, "verypdf.com Inc.", 165296, 0, 0, -100, -45, 0, 0, 0, NullString, 48, 0, NullString, 0)
code = veryAddText(id, 7, "verypdf.com Inc.", 1652962, 0, 50, -200, -45, 0, 0, 0, NullString, 48, 0, NullString, 0)
code = veryAddText(id, 7, "verypdf.com Inc.", 16529621, 0, 100, -300, -45, 0, 0, 0, NullString, 48, 0, NullString, 0)
code = veryAddText(id, 7, "verypdf.com Inc.", 165296210, 0, 150, -400, -45, 0, 0, 0, NullString, 48, 0, NullString, 0)
code = veryAddText(id, 7, "verypdf.com Inc.", 165210, 0, 200, -500, -45, 0, 0, 0, NullString, 48, 0, NullString, 0)
veryClose(id)
End If
'//%image zoom%
id = veryOpen(szPDFFile, "15.pdf")
If (id > 0) Then
code = veryAddImage(id, 2, "logo.jpg", 80, 200, -45, 1, 300, 300, 0, NullString, 0)
veryClose(id)
End If
'//%·¡èSupports line stamp %
id = veryOpen(szPDFFile, "16.pdf")
If (id > 0) Then
code = veryAddText(id, 7, "\d\n\t", 255, 0, 70, -50, 0, 0, 0, 0, NullString, 10, 0, NullString, 0)
code = veryAddText(id, 5, "Page \p of \c ", 255, 0, -70, -50, 0, 0, 0, 0, NullString, 10, 0, NullString, 0)
code = veryAddText(id, 3, "2003 verypdf.com Inc.", 255, 0, -60, 60, 0, 0, 0, 300, NullString, 10, 0, NullString, 0)
code = veryAddLine(id, 2, 1, 0, 0, 80, 0, 0, 80, 0)
code = veryAddLine(id, 6, 1, 0, 0, -80, 0, 0, 80, 0)
veryClose(id)
End If
'//%·¡èSupports links (web links, page link, open file, remote page link).%
id = veryOpen(szPDFFile, "17.pdf")
If (id > 0) Then
code = veryAddText(id, 2, "Supports web links", 255, 0, -50, 200, 15, 0, 0, 0, NullString, 32, 1, "http:'//www.verypdf.com", 0)
code = veryAddText(id, 4, "Supports page links", 255, 0, -50, 200, 0, 0, 0, 0, NullString, 32, 2, NullString, 3)
code = veryAddImage(id, 9, "logo.jpg", 0, 0, 15, 1, 0, 0, 3, "openlink.txt", 0)
veryClose(id)
End If
'//%·¡èSet which pages to stamp on by selecting a predefined range.%
'//% Every even page%
id = veryOpen(szPDFFile, "18.pdf")
If (id > 0) Then
'//% Every even page%
code = verySetFunction(id, 131, -2, -2, 0, 0)
code = veryAddText(id, 2, "Set which pages to stamp on by selecting a predefined range.", 2666666, 17, 0, 200, 0, 0, 0, 0, NullString, 32, 0, NullString, 0)
veryClose(id)
End If
End Sub
VeryPDF
------------------------------------
This is the same code I have. When I run the app, click on Test for PDFStamp button, I get error "run-time error '53': file not found: PDFstamp.dll" I have put the full path of PDFstamp.dll in and it still can't find it. Do I need to register the dll with regsvr32? I can't add it as a reference to the project.
I have tried to register the dll and get this error: "loadlibrary("c:\PDFstamp.dll") failed - the specified module could not be found" If I register it from the BIN folder I get "...\bin\PDFstamp.dll was loaded, but the DLLRegisterServer entry point was not found. This file can not be registered"
Customer
------------------------------------
You may put PDFstamp.dll and other DLL files to system32 folder and run your EXE again, your EXE will able to load pdfstamp.dll properly.
You can also put PDFstamp.dll and other DLL files and your EXE file into same folder, run your EXE from this folder, your EXE will able to load pdfstamp.dll properly.
PDFstamp.dll is a 32bit DLL Library, it is not a COM, so you can't register it by regsvr32.exe application, you can use LoadLibrary() function to load PDFstamp.dll library and use GetProcAddress() function to get the address for each function, then you can call these functions easily.
If you wish call PDFstamp.dll from a 64bit EXE application, please refer to following web page for more information,
https://www.verypdf.com/wordpress/201107/use-pdfstamp-dll-on-windows-2008-64-bit-system-1553.html
VeryPDF
------------------------------------
ok got it working. I didn't realize I needed all the dlls in the bin. Thanks for your help!
Customer