I am trying to use a 'dll' file from a third party to modify an existing pdf file. The code examples they provide are in visual basic appear to work fine. See the following example:
Private Declare Function VeryStampOpen Lib "verywrite.dll" (ByVal sIn As String, ByVal sOut As String) As Long
Private Declare Sub VeryStampClose Lib "verywrite.dll" (ByVal id As Long)
Private Declare Function VeryStampAddText Lib "verywrite.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 Sub Command1_Click()
Dim szPDFFile As String
Dim id As Long
Dim code As Long
Dim lFile As Long
Dim NullString As String
szPDFFile = "Before.PDF"
'//%text stamp%
'//%page header and page footer%
'//%Stamps are placed in the duplicate file, leaving the original copy unchanged%
id = VeryStampOpen(szPDFFile, "1.pdf")
If (id > 0) Then
code = VeryStampAddText(id, 7, "\d\n\t", 255, 0, 50, -30, 0, 0, 0, 0, NullString, 10, 0, NullString, 0)
VeryStampClose (id)
End If
End Sub
However, when I try this same example after converting to foxpro coding, the modified pdf file is corrupted. Below is the foxpro code I am using:
WAIT 'Stamping Drawing. Please wait...' WINDOW NOWAIT noclear
DECLARE INTEGER VeryStampOpen IN 'verywrite.dll' ;
STRING sIn,;
STRING sOut
DECLARE INTEGER VeryStampClose IN 'verywrite.dll' ;
INTEGER id
DECLARE INTEGER VeryStampAddText IN 'verywrite.dll' ;
INTEGER id,;
INTEGER position,;
STRING sstring,;
INTEGER color,;
INTEGER alignment,;
INTEGER shift_lr,;
INTEGER shift_tb,;
INTEGER rotate,;
INTEGER layer,;
INTEGER hollow,;
INTEGER fontcode,;
STRING fontname,;
INTEGER fontsize,;
INTEGER action,;
STRING link,;
INTEGER pageno
szPDFFile = "Before.PDF"
id = veryStampOpen(szPDFFile,"1.pdf")
IF id > 0
code = veryStampAddText(id,7,"\d\n\t",255,0,50,-30,0,0,0,0,NULL,10,0,NULL,0)
IF code = 0
RETURN .F.
ENDIF
veryStampClose(id)
WAIT CLEAR
ELSE
RETURN .F.
ENDIF
RETURN .T.
Can anyone see anything wrong with my foxpro code? Any advice would be greatly appreciated!
Thanks,