Gestione pagine PDF 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:
<%
Set Pdf = Server.CreateObject("Persits.Pdf")
' Open blank PDF form from file
Set Doc = Pdf.OpenDocument( Server.MapPath("TwoPageDoc.pdf") )
' insert page before 1st
Set Page1 = Doc.Pages.Add(, , 1)
' insert page after 2nd
Set Page2 = Doc.Pages.Add(, , 3)
' Remove page 4 (page 2 in original doc)
Doc.Pages.Remove 4
' Draw background image on all 3 remaining pages
Set Image = Doc.OpenImage( Server.MapPath("exclam.gif") )
For Each Page in Doc.Pages
Page.Background.DrawImage Image, "x=70, y=220; scalex=2; scaley=2"
Next
' Save document, the Save method returns generated file name
Filename = Doc.Save( Server.MapPath("/public/pages-asp.pdf"), False )
Response.Write "Fatto, scarica <A HREF=/public/" & Filename & ">qui</A>"
%>
|