Dypso Backoffice
Dypso Backoffice

Développement Web


Download Products


DypsWebCapture : Capture Web page as thumbnail image

Documentation
Example
Download
Buy

New release with embed IE and Firefox rendering engine !



DypsFTP : Manage a FTP site from your script

Documentation
Buy


DypsImg2SWF : Protect and save your image as SWF/Flash format!

Documentation
Example
Download
Buy


DypsXLS for ASP: Générateur de fichier Excel

New features!
Documentation
Exemple d'utilisation
Download
Buy


DypsMetaGrabber : get Meta Tag from any web page!

Documentation
Example
Download
Buy


DypsAntiSpam for ASP

Features
Exemple d'utilisation
Download
Buy

DypsoPRank for ASP

Features
Exemple d'utilisation
Download
Buy

Pop3 Checker for ASP

Features
Exemple d'utilisation
Download
Buy

SVG Pie chart Maker for ASP

Features
Exemple d'utilisation
Download

DypsRTF for ASP

Features
Exemple d'utilisation
Download
Buy

What's New ?


Mise en ligne du premier outil gratuit pour générer des fichiers Excel depuis ASP : DypsXLS !
[Lire la suite]

Et un forum Le site se dote d'un forum pour vous permettre de partager toujours plus.
[Rejoigner nous]

Annuaire de scripts ! Un annuaire de scripts et de liens utiles vers des ressources pour le développement
[Lire la suite]

Création d'un outil gratuit pour retrouver ses mails : Pop3 Checker for free !
[Lire la suite]

Création d'un outil gratuit pour générer des graphiques vectoriels à la volée: Free SVG Pie chart Maker !
[Lire la suite]



Print the script

Create PDF Files with asp and a stored procedure

Techniques

This section makes it possible to gather a whole of techniques or scripts which have the originality to manage to solve a difficulty with the least effort or which are particularly effective...


Techniques / PDF : Create a PDF from a stored procedure
Original version from Masar Ivica - Visit our sponsors

Part II : Launch the procedure and generate a PDF report on the fly

  •  Summary

This article explains how to create a stored procedure and to call it from ASP or directly from SQL Server. The stored procedure will in turn create a simple column based report in PDF without using any external tools or libraries (and their associated licensing costs!).

  •  How to call the stored procedure from ASP with ADO :

The stored procedure is called SQL2PDF, in order to execute it from ASP the simple way but not the best is to create a connection object to your database and then called the Execute method of this objec, just as follow :

'a var to fill argument to the stored procedure
filename = "myPDF"

'Create ADODB connection object
Set cn = Server.CreateObject("ADODB.Connection")

'open db with the connection string
cn.Open "data source name", "userid", "password"

'Execute the procedure in order to create
'the pdf file with no argument
'cn.Execute("SQL2PDF")


'The same by passing argument:
cn.Execute("SQL2PDF '" & filename & "'")

cn.Close

'Clean memory
Set cn = Nothing


SQL2PDF makes a PDF report from text inserted in the table psopdf ( nvarchar(80) ). First a table named psopdf should be created.

	CREATE TABLE psopdf (code NVARCHAR(80)) 

After that create the stored procedure SQL2PDF.

And table psopdf has to be filled with your data as shown in examples below. At the end the stored procedure is called using the file name only (not extension).


Here is the script in order to create the sql2pdf procedure :

Launch the procedure and generate a PDF report on the fly
Comment the article