Creare un documento PDF con asp salvandolo in memoria e quindi nel database
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
Richiede database
CODICE:
<%
Set Pdf = Server.CreateObject("Persits.Pdf")
' Create empty document
Set Doc = Pdf.CreateDocument
' Set various document properties
Doc.Title = "TITOLO DEL NUOVO DOCUMENTO PDF "
Doc.Creator = "CONTENUTO DEL DOCUMENTO PDF "
' Add a new page
Set Page = Doc.Pages.Add
' Select one of the standard PDF fonts
Set Font = Doc.Fonts("Helvetica")
' Param string
Params = "x=0; y=650; width=612; alignment=center; size=50"
' Draw text on page
Page.Canvas.DrawText "..POPOLARE.. ", Params, Font
' Connect to the database
Connect = "Driver={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("/mdb-database/asppdf.mdb")
' If you use SQL Server, the connecton string must look something like this:
' Connect = "Provider=SQLOLEDB;Server=MYSRV;Database=master;UID=sa;PWD=xxx"
' Use ADO Recordset object
Set rs = Server.CreateObject("adodb.recordset")
rs.Open "PDFFILES", Connect, 2, 3
rs.AddNew
rs("FileBlob").Value = Doc.SaveToMemory
rs.Update
Response.Write "fatto, salvato in memoria e poi nel db."
%>
|