#liste_articles {display:block}


Monday 7 July 2008


Free PL/SQL library to generate PDF from Oracle Database


The free PL/SQL library to generate PDF are very hard to find.
As I could not find one, I’ve written it from the well known PHP library FPDF which was written by Olivier Plathey.

I propose you the last release of the PL_FPDF library (0.9.3).
I already use it on our production site laclasse.com.

download it on github

This code gives you the same functions than FPDF, except that it converts all the images you need in PNG.

Required Environment

 Oracle en version 10g ( and above).
 Installation ofOracle Web Tool Kit required (owa, htp and htf packages).
 OrdSys.OrdImage required (Oracle cartridge for images).
 Installation of package URIFactory required.

 0.9.2 -> 0.9.3 :

  • Added Sample on setHeaderProc and setFooterProc procedures.
  • Added parameter implementation to thes procedures.
  • Modify Header and footer procedure behaviour to get parameter values
  • declared subtype ’word’ ans type ’tv4000a’ in the specs.

 0.9.1 -> 0.9.2 :

  • Added procedure helloword Example.
  • Added procedure testImg Example.

 0.9.1 First Stable Version !
- Minor bugs (thanks to Josh Burroughs)

  • Corrections on p_parseimage procedure (better reading of image files)
  • Corrections on p_escape procedure

- Minor bugs (thanks to Rudy Winter)

  • Corrections on Image procedure
  • Corrections on header and Footer procedures

- Multiple images on the same page works, but only with png Format.

Known bugs on this version

 GIF images are not supported, because of a PNG conversion problem.

 No PDF file compression. (This not a bug but a lack of feature).
 Write procedure which allows to put a flow of text dealing with the page height and width, don’t run as well.

Asked Features

 Dynamique SQL execution procedure that generates aPDF table.

Download, Test, and code !

I’m very interessted in having back your codes, bugs corrections and evolutions.

code examples

Here are some online examples :

hello world

Test with an image

Here are some simple code samples with PL_FPDF.

Note that the "output" procedure calls automatically "ClosePdf".

procedure helloworld is
	pdf.Cell(0,1.2,'Hello World',0,1,'C');
end helloworld;

Put an image

procedure testImg is
  img varchar2(2000);
       img := 'http://www.laclasse.com/v2/images/picto_laclassev2.png'; 
       pdf.Image(img,1, 1, 10);
end testImg;

Documents :

par Pierre-Gilles Levallois