Home   
   Domini   
   Siti   
   Indicizzazione   
   Contatto   
   Specials   
   Games   

 


 
Grafica 3D in PDF con ASP Grafica 3D in PDF con ASP NET Convertire JPEG in PDF con ASP Convertire JPEG in PDF con ASP NET Creare PDF con ASP Proprietà PDF a nuovo PDF Creare PDF con ASP via HTTP Aggiungere commento a PDF con ASP
Creare PDF con Form via ASP Gestire PDF via ASP Aggiungere grafica a PDF con ASP HTML da file TXT via ASP Importare da URL in PDF con ASP PDF Bookmark con ASP Da PDF in JPEG via ASP Lettura MDB con PDF via ASP
Moduli PDF via ASP Creare PDF con ASP NET Creare PDF con ASP NET via HTTP Aggiungere commento a PDF con ASP NET Creare PDF con Form via ASP NET Gestire PDF via ASP NET HTML da file TXT via ASP NET Importare da URL in PDF con ASP NET
Maschera PDF con ASP NET Creare PDF con ASP NET e MDB Da PDF a PNG via ASP NET Estrarre testo da PDF via ASP NET Unire documenti PDF via ASP NET Da PDF a PNG via ASP Estrarre testo da PDF via ASP Unire documenti PDF via ASP
Inserire commento in PDF Maschera PDF con ASP PDF Bookmark con ASP NET Convertire TIFF in PDF con ASP Compilare PDF con Form via ASP Creare PDF con ASP e MDB Lettura MDB con PDF via ASP NET Convertire TIFF in PDF con ASP NET

Leggere un database con un documento 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
RICHIEDE DATABASE

CODICE:

<h3>leggo contenuto da database, in asp</h3>
<%
Set PDF = Server.CreateObject("Persits.Pdf")

' Create empty param objects to be used across the app
Set Param = PDF.CreateParam
Set TextParam = PDF.CreateParam

' Create document
Set Doc = PDF.CreateDocument

' Create table with one row (header), and 5 columns
Set Table = Doc.CreateTable("width=500; height=20; Rows=1; Cols=5; Border=1; CellSpacing=-1; cellpadding=2 ")

' Set default table font
Table.Font = Doc.Fonts("Helvetica")

Set HeaderRow = Table.Rows(1)
Param.Set("alignment=center")
With HeaderRow
.BGColor = &H90F0FE
.Cells(1).AddText "Category", Param
.Cells(2).AddText "Description", Param
.Cells(3).AddText "Billable", Param
.Cells(4).AddText "Date", Param
.Cells(5).AddText "Amount", Param
End With

' Set column widths
With Table.Rows(1)
.Cells(1).Width = 80
.Cells(2).Width = 160
.Cells(3).Width = 50
.Cells(4).Width = 70
.Cells(5).Width = 60
End With


' Populate table with data
Set Conn = Server.CreateObject("ADODB.Connection")
Connect = "Driver={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("/mdb-database/asppdf.mdb")
Conn.Open Connect

Set rs = Server.CreateObject("adodb.recordset")
rs.Open "select * from report order by expensedate", Conn

param.Set "expand=true" ' expand cell vertically to accomodate text

Do While Not rs.EOF
Set Row = Table.Rows.Add(20) ' row height

param.Add "alignment=left"
Row.Cells(1).AddText rs("Category"), param
Row.Cells(2).AddText rs("Description"), param

param.Add "alignment=center"
If rs("Billable") Then Billable = "Yes" Else Billable = "No"
Row.Cells(3).AddText Billable, param
Row.Cells(4).AddText pdf.FormatDate( rs("ExpenseDate"), "%d %b %Y" ), param

param.Add "alignment=right"
Row.Cells(5).AddText pdf.FormatNumber(rs("Amount"), "precision=2, delimiter=true"), param

rs.MoveNext
Loop

' Render table on document
Set Page = Doc.Pages.Add(612, 150) ' small pages to demonstrate paging functionality

Param.Clear
Param("x") = (Page.Width - Table.Width) / 2 ' center table on page
Param("y") = Page.Height - 20
Param("MaxHeight") = 100

FirstRow = 2 ' use this to print record count on page
Do While True
' Draw table. This method returns last visible row index
LastRow = Page.Canvas.DrawTable( Table, Param )

' Print record numbers
TextParam("x") = (Page.Width - Table.Width) / 2
TextParam("y") = Page.Height - 5
TextParam.Add("color=darkgreen")
TextStr = "Records " & FirstRow - 1 & " to " & LastRow - 1 & " of " & Table.Rows.Count - 1
Page.Canvas.DrawText TextStr, TextParam, doc.fonts("Courier-Bold")

if LastRow >= Table.Rows.Count Then Exit Do ' entire table displayed

' Display remaining part of table on the next page
Set Page = Page.NextPage
Param.Add( "RowTo=1; RowFrom=1" ) ' Row 1 is header - must always be present.
Param("RowFrom1") = LastRow + 1 ' RowTo1 is omitted and presumed infinite

FirstRow = LastRow + 1
Loop

' Save document, the Save method returns generated file name
Filename = Doc.Save( Server.MapPath("/public/report-db_Asp.pdf"), False )

Response.Write "Fatto, scarica il file <A HREF=/public/" & Filename & ">qui</A>"

%>





fonte accreditata aruba.it