Interazione in PDF con con moduli attraverso asp
nota bene: lo script nella versione "copia e incolla" che segue, presuppone permessi di scrittura lato server .. in paritcolare, è la root o cartella di destinazione del nuovo documento PDF che deve possedere i permessi di scrittura [chmod "666" - "777"] ..e l' utilizzo è di assoluta facilità: copia inclolla e salva come *.asp
CODICE:
<%
' Initialize coordinate and text arrays
Dim arrX
Dim arrY
Dim arrText
arrX = Array(100, 325, 455, 512, 550, 100, 100)
arrY = Array(660, 660, 660, 687, 687, 602, 577)
arrText = Array("Roberto.", "Zappoli", "123-56-7890", "1520",_
"00", "Via Bologna 30", "Bologna, Italia" )
Set Pdf = Server.CreateObject("Persits.Pdf")
' Open blank PDF form from file
Set Doc = Pdf.OpenDocument( Server.MapPath("1040es.pdf") )
' Create default font
Set Font = Doc.Fonts("Helvetica-Bold")
' Obtain the only page's canvas
Set Canvas = Doc.Pages(1).Canvas
' Create empty param object
Set Param = Pdf.CreateParam
' Fill out three copies of the 1040ES coupons
For i = 0 to 2
' Go over all items in arrays
For j = 0 to UBound(arrX)
Param("x") = arrX(j)
Param("y") = arrY(j) - 263 * i
' Draw text on canvas
Canvas.DrawText arrText(j), Param, Font
Next ' j
Next ' i
' Save document, the Save method returns generated file name
Filename = Doc.Save( Server.MapPath("/public/form-asp.pdf"), False )
Response.Write "Fatto, controlla il risultato <A HREF=/public/" & Filename & ">qui</A>"
%>
|