Zahid Karim
Recent Posts
1.Draw plus and cross sign into PDF via PLSQL using PL_FPDF
2.Draw Triangle directly into PDF via PLSQL using PL_FPDF
3.Write fast and efficient PLSQL - DBMS_PROFILER
4.Fix physically corrupt data blocks using PLSQL - DBMS_REPAIR
5.Encrypt or Decrypt sensitive data using PLSQL - DBMS_CRYPTO
Find me on
Draw Triangle directly into PDF via PLSQL using PL_FPDF

Draw plus and cross sign into PDF via PLSQL using PL_FPDF

Posted by Zahid Kareem on January 10, 2016.

PL_FPDF is a very powerful open source PL/SQL library. It can generate PDF files directly from PL/SQL and is very useful with the web applications developed in Oracle Application Express.

For details on PL_FPDF please see: http://www.erasme.org/PL-FPDF,1337

But As I have explained in my previous article, it may not suit you 100% according to your requirements. Like triangle, I once needed to draw a plus sign ( + ) and cross sign ( x ) of my own width and height. Since, drawing both of these symbols were not possible in standard PL_FPDF library, so I went ahead and developed my own procedures to draw these symbols into my PDF reports.

The following procedure is for drawing a plus sign ( + ):

PROCEDURE drawplussign (
   px    NUMBER, -- The X position of the plus sign
   py    NUMBER, -- The Y position of the plus sign
   psize NUMBER  --The size of the sign
   )
IS
   halfsize   NUMBER := ROUND (psize / 2, 2);
BEGIN
   line (px - halfsize, py, px + halfsize, py);
   line (px, py - halfsize, px, py + halfsize);
END drawplussign;


Following is the procedure for drawing a cross sign ( x ):

PROCEDURE drawcrosssign (
   px    NUMBER, -- The X position of the cross sign
   py    NUMBER, -- The Y position of the cross sign
   psize NUMBER  --The size of the sign
  )
IS
   halfsize   NUMBER := ROUND (psize / 2, 2);
BEGIN
   line (px - halfsize, py - halfsize, px + halfsize, py + halfsize);
   line (px + halfsize, py - halfsize, px - halfsize, py + halfsize);
END drawcrosssign;


Add the header of this procedure i.e. name and arguments in the PL_FPDF package and then include the code above into the PL_FPDF package body and then use it where ever you want.

Enjoy!