May be this isn't what you search exactly, but you can fill fields in pdf programmatically:
, which is free for personnal use, you can add comments programmatically.
Code: Select all
CompilerIf #PB_Compiler_IsMainFile
EnableExplicit
CompilerEndIf
Structure cpdf_position
cpdf_anchor.i; /* Position anchor */
cpdf_coord1.d; /* Parameter one */
cpdf_coord2.d; /* Parameter two */
EndStructure
Global pos.cpdf_position
#kk=28.346457
Enumeration cpdf_anchor
#cpdf_posCentre; /* Absolute centre */
#cpdf_posLeft ; /* Absolute left */
#cpdf_posRight ; /* Absolute right */
#cpdf_top ; /* Top top centre of the page */
#cpdf_topLeft ; /* The top left of the page */
#cpdf_topRight ; /* The top right of the page */
#cpdf_left ; /* The left hand side of the page, halfway down */
#cpdf_bottomLeft; /* The bottom left of the page */
#cpdf_bottom ; /* The bottom middle of the page */
#cpdf_bottomRight; /* The bottom right of the page */
#cpdf_right ; /* The right hand side of the page, halfway down */
#cpdf_diagonal ; /* Diagonal, bottom left To top right */
#cpdf_reverseDiagonal; /* Diagonal, top left To bottom right */
EndEnumeration
Enumeration cpdf_font
#cpdf_timesRoman ; /* Times Roman */
#cpdf_timesBold ; /* Times Bold */
#cpdf_timesItalic ; /* Times Italic */
#cpdf_timesBoldItalic ; /* Times Bold Italic */
#cpdf_helvetica ; /* Helvetica */
#cpdf_helveticaBold ; /* Helvetica Bold */
#cpdf_helveticaOblique ; /* Helvetica Oblique */
#cpdf_helveticaBoldOblique ; /* Helvetica Bold Oblique */
#cpdf_courier ; /* Courier */
#cpdf_courierBold ; /* Courier Bold */
#cpdf_courierOblique ; /* Courier Oblique */
#cpdf_courierBoldOblique ; /* Courier Bold Oblique */
EndEnumeration
Enumeration cpdf_justification
#cpdf_leftJustify ; /* Left justify */
#cpdf_CentreJustify ; /* Centre justify */
#cpdf_RightJustify ; /* Right justify */
EndEnumeration
PrototypeC.i prototype_cpdf_version()
PrototypeC prototype_cpdf_startup(*argv)
PrototypeC.i prototype_cpdf_fromFile(filename.p-utf8, userpw.p-utf8)
PrototypeC prototype_cpdf_clearError()
PrototypeC.i prototype_cpdf_mergeSimple(*pdfs, length.l)
PrototypeC prototype_cpdf_toFile(pdf.l, filename.p-utf8, linearize.l, make_id.l)
PrototypeC prototype_cpdf_pages(pdf.l)
PrototypeC.l prototype_cpdf_range(n1.l, n2.l)
PrototypeC prototype_cpdf_addText(flag_add.l, pdf.l, page.l, txt.p-utf8, *position.cpdf_position, linespacing.d,
stbates.l, font.i, size.d, red.d, green.d, blue.d, flagunder.l, flagcrop.l, flagoutline.l, opacity.d,
justification.i, flag_midline.l, flag_topline.l, fname.p-utf8, linewidth.d, embed.l)
PrototypeC prototype_cpdf_addTextSimple(pdf.l, page.l, txt.p-utf8, *position.cpdf_position, font.i, size.d)
Global cpdf_library.i
Global cpdf_version_.prototype_cpdf_version
Global cpdf_startup.prototype_cpdf_startup
Global cpdf_fromFile.prototype_cpdf_fromFile
Global cpdf_clearError.prototype_cpdf_clearError
Global cpdf_mergeSimple.prototype_cpdf_mergeSimple
Global cpdf_toFile.prototype_cpdf_toFile
Global cpdf_pages.prototype_cpdf_pages
Global cpdf_range.prototype_cpdf_range
Global cpdf_addText.prototype_cpdf_addText
Global cpdf_addTextSimple.prototype_cpdf_addTextSimple
Global.i cpdf_lastError_
Global.i cpdf_lastErrorString_
Macro cpdf_version()
PeekS(cpdf_version_(), -1, #PB_UTF8)
EndMacro
Macro cpdf_lastError
PeekI(cpdf_lastError_)
EndMacro
Macro cpdf_lastErrorString
PeekS(cpdf_lastErrorString_, -1, #PB_UTF8)
EndMacro
Procedure cpdf_addTextSimple2(pdf.l, page.l, txt.s, posx.f, posy.f, font.i, size.d)
pos\cpdf_coord1=#kk*posx ; /* Parameter one */
pos\cpdf_coord2=#kk*(29.7-posy) ; /* Parameter two */
cpdf_addTextSimple(pdf, page, txt, @pos, font.i, size.d)
EndProcedure
Procedure.i OpenCPDF()
If Not IsLibrary(cpdf_library)
CompilerIf #PB_Compiler_Processor = #PB_Processor_x86
cpdf_library = OpenLibrary(#PB_Any, "E:\install\dvd2\PDF utilities\sdk\cpdf\win32\libcpdf.dll")
CompilerElseIf #PB_Compiler_Processor = #PB_Processor_x64
cpdf_library = OpenLibrary(#PB_Any, "E:\install\dvd2\PDF utilities\sdk\cpdf\win64\libcpdf.dll")
CompilerEndIf
If cpdf_library
cpdf_version_ = GetFunction(cpdf_library, "cpdf_version")
cpdf_startup = GetFunction(cpdf_library, "cpdf_startup")
cpdf_fromFile = GetFunction(cpdf_library, "cpdf_fromFile")
cpdf_clearError = GetFunction(cpdf_library, "cpdf_clearError")
cpdf_mergeSimple = GetFunction(cpdf_library, "cpdf_mergeSimple")
cpdf_toFile = GetFunction(cpdf_library, "cpdf_toFile")
cpdf_pages = GetFunction(cpdf_library, "cpdf_pages")
cpdf_range = GetFunction(cpdf_library, "cpdf_range")
cpdf_addText = GetFunction(cpdf_library, "cpdf_addText")
cpdf_addTextSimple = GetFunction(cpdf_library, "cpdf_addTextSimple")
cpdf_lastError_ = GetFunction(cpdf_library, "cpdf_lastError")
cpdf_lastErrorString_ = GetFunction(cpdf_library, "cpdf_lastErrorString")
Else
MessageRequester("Error","no libcpdf.dll present")
EndIf
EndIf
ProcedureReturn cpdf_library
EndProcedure
Procedure CloseCPDF()
If IsLibrary(cpdf_library)
CloseLibrary(cpdf_library)
cpdf_library = #Null
EndIf
EndProcedure
CompilerIf #PB_Compiler_IsMainFile
Define *argv
Define.i orig_pdf, output, i
Dim pdfs.l(2)
Define range.l
;1pt = 1/72 inch = 0.0352777 cm 1cm=28.346457
pos\cpdf_anchor=#cpdf_posLeft ; /* Position anchor */
pos\cpdf_coord1=#kk*6 ; /* Parameter one */
pos\cpdf_coord2=#kk*10 ; /* Parameter two */
If OpenCPDF()
; Initialise cpdf
cpdf_startup(@*argv)
;Debug cpdf_version()
; We will take the input hello.pdf And Repeat it three times
orig_pdf = cpdf_fromFile("toto.pdf", "")
; Check the error state
If cpdf_lastError = 1
Debug cpdf_lastErrorString
End 1
EndIf
; Clear the error state
cpdf_clearError()
; The Array of PDFs To merge
pdfs(0) = orig_pdf
pdfs(1) = orig_pdf
pdfs(2) = orig_pdf
; Merge them
output = cpdf_mergeSimple(pdfs(), 1)
; Check the error state
If cpdf_lastError = 1
Debug cpdf_lastErrorString
End 1
EndIf
cpdf_clearError()
range=cpdf_range(1, 1)
cpdf_addText(#False, output, range, "hahaha!!!", @pos, 1, 0, #cpdf_timesBold, 14, 1, 0.0, 0.0, #False, #False,
#False, 1, #cpdf_CentreJustify, #False, #False, "xxx", 5, #False)
For i=1 To 5
cpdf_addTextSimple2(output, range, "Hello!!!"+Str(i), 5, i, #cpdf_timesBold, 14)
Next
; Write output
cpdf_toFile(output, "output.pdf", #False, #False)
Debug cpdf_pages(output)
; Check the error state
If cpdf_lastError = 1
Debug cpdf_lastErrorString
End 1
EndIf
CloseCPDF()
EndIf
CompilerEndIf
RunProgram("output.pdf")