Copiare proprietà di un PDF esistente in nuovo 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")
' Create empty document
Set Doc = Pdf.CreateDocument
' Open document to apply security to
Set Doc1 = Pdf.OpenDocument( Server.MapPath("doc1.pdf") )
' Copy properties
Doc.Title = Doc1.Title
Doc.Creator = Doc1.Creator
Doc.Producer = Doc1.Producer
Doc.CreationDate = Doc1.CreationDate
Doc.ModDate = Doc1.ModDate
' Apply security to Doc
Doc.Encrypt "abc", "", 128
' Append doc1 to doc
Doc.AppendDocument Doc1
' Save document, the Save method returns generated file name
Filename = Doc.Save( Server.MapPath("/public/applicasicurezza-asp.pdf"), False )
Response.Write "Fatto, il file generato e' <A HREF=/public/" & Filename & ">qui</A>"
%>
|