creating pdf documents using pl/sql create pdf in pl/sql generate pdf in pl/sql
pdf by pl/sql pl/sql Oracle Sql PDF pl/sql pdf generate
tool develop oracle pl/sql download
creating html_db applications
spacer
plsql generate pdf
html_db spacer Home More info
printemail html_db printed report

More info

The data source for data prepared in a dynamically created PDF document is usually a database, often an Oracle RDBMS. On the other hand, it is a general requirement to store the conditions under which the dynamic generation took place as well as the generated document. It is practical to store these data in a database as well, for easy access in the future. If both the source and target of the generated document is in the database then it is best to actually generate the document in the database also. If the database we are talking about is an Oracle database, then the best tool to use for the dynamic generation is the PL/SQL language because:

  • It is integrated with the Oracle database; therefore it is the safest, quickest and most efficient way of interacting with the database
  • It is a well-known language for anyone who works in an Oracle environment; therefore there is no need for developers to learn a new programming language
  • There is no need for a separate server (physical or virtual i.e. separate software); therefore the cost of hardware and operation is reduced. Also, because of the simplicity of the infrastructure, the risks are reduced.

When creating the PL/PDF package, it was a basic goal to allow Oracle developers to develop without in depth knowledge of the structure of the PDF document. In a PDF document, elements are not automatically placed on the page as in an HTML document (e.g. in case of a table), so for each element the actual place where it is required to appear must be specified. To facilitate development, the following two concepts were introduced:

  • Actual position: the actual X and Y coordinate on a page, where the object will be placed
  • Cell: a rectangular area on the page, where text can be placed. The cell will have an actual coordinate, but the text will be placed automatically according to where the cell is. Using this method, the PDF document is a series of cells.

Here is a simple example:
...
-- header
plpdf.SetPrintFont('Arial','B',12);
plpdf.SetColor4Filling(200,220,255);
plpdf.PrintCell(20,10,'ROWNUM','1',0,'C',1);
plpdf.PrintCell(40,10,'OWNER','1',0,'C',1);
plpdf.PrintCell(100,10,'OBJECT NAME','1',1,'C',1);

-- the data
plpdf.SetPrintFont('Arial',null,12);
for f_obj in (select rownum, owner, object_name from all_objects where rownum < 100) loop
plpdf.PrintCell(20,10,to_char(f_obj.rownum),'1',0);
plpdf.PrintCell(40,10,f_obj.owner,'1',0);
plpdf.PrintCell(100,10,f_obj.object_name,'1',1);
end loop;
...

PL/PDF also provides tools that give further help in formatting the document, such as automatic page breaks. If necessary, the developer can directly specify where a certain text should be placed to achieve a required format.

Of course apart from text, a number of other objects can also be placed in a PDF document:

  • Line (thickness and color can be specified)
  • Ellipse, circle (line, color and fill can be specified)
  • Rectangle (line, color and fill can be specified)
  • JPEG picture (size can be specified)

Using PL/PDF not only the cost of hardware and operation, but also development timeframe and consequently the cost of implementation is reduced. 
 

spacer
pl/sql pdf
mod_plsql pdf