I’ve written a small package (1500 lines). But with this package you can generate a PDF-document with a few lines of PL/SQL code. It’s small because it lacks some functionality. It can only use the standard PDF fonts, and that means that it can only use the WINDOWS-1252 encoding/characterset. But besides that it’s fairly complete.

For instance.

begin
  as_pdf_mini.init;
  as_pdf_mini.write( 'Some text with a newline-character included at this "
" place.' );
  as_pdf_mini.write( 'Normally text written with as_pdf_mini.write() is appended after the previous text. But the text wraps automaticly to a new line.' );
  as_pdf_mini.write( 'But you can place your text at any place', -1, 700 );
  as_pdf_mini.write( 'you want', 100, 650 );
  as_pdf_mini.write( 'You can even align it, left, right, or centered', p_y => 600, p_alignment => 'right' );
  as_pdf_mini.save_pdf;
end;

Some text

And

begin
  as_pdf_mini.init;
  for i in 1 .. 10
  loop
    as_pdf_mini.horizontal_line( 30, 700 - i * 15, 100, i );
  end loop;
  for i in 1 .. 10
  loop
    as_pdf_mini.vertical_line( 150 + i * 15, 700, 100, i );
  end loop;
  for i in 0 .. 255
  loop
    as_pdf_mini.horizontal_line( 330, 700 - i, 100, p_line_color =>  to_char( i, 'fm0x' ) || to_char( i, 'fm0x' ) || to_char( i, 'fm0x' ) );
  end loop;
  as_pdf_mini.save_pdf;
end;

Some lines

And jpg and png images, from a url, the file-system or from a database blob can be included:

Example of an image

And to show the standard PDF fonts

begin
  as_pdf_mini.init;
  as_pdf_mini.write( 'The mini version of AS_PDF is restricted to the 14 standard PDF-fonts and the WINDOWS-1252 encoding.' );
  as_pdf_mini.set_font( 'helvetica' );
  as_pdf_mini.write( 'helvetica, normal: ' || 'The quick brown fox jumps over the lazy dog. 1234567890', -1, 700 );
  as_pdf_mini.set_font( 'helvetica', 'I' );
  as_pdf_mini.write( 'helvetica, italic: ' || 'The quick brown fox jumps over the lazy dog. 1234567890', -1, -1 );
  as_pdf_mini.set_font( 'helvetica', 'b' );
  as_pdf_mini.write( 'helvetica, bold: ' || 'The quick brown fox jumps over the lazy dog. 1234567890', -1, -1 );
  as_pdf_mini.set_font( 'helvetica', 'BI' );
  as_pdf_mini.write( 'helvetica, bold italic: ' || 'The quick brown fox jumps over the lazy dog. 1234567890', -1, -1 );
  as_pdf_mini.set_font( 'times' );
  as_pdf_mini.write( 'times, normal: ' || 'The quick brown fox jumps over the lazy dog. 1234567890', -1, 625 );
  as_pdf_mini.set_font( 'times', 'I' );
  as_pdf_mini.write( 'times, italic: ' || 'The quick brown fox jumps over the lazy dog. 1234567890', -1, -1 );
  as_pdf_mini.set_font( 'times', 'b' );
  as_pdf_mini.write( 'times, bold: ' || 'The quick brown fox jumps over the lazy dog. 1234567890', -1, -1 );
  as_pdf_mini.set_font( 'times', 'BI' );
  as_pdf_mini.write( 'times, bold italic: ' || 'The quick brown fox jumps over the lazy dog. 1234567890', -1, -1 );
  as_pdf_mini.set_font( 'courier' );
  as_pdf_mini.write( 'courier, normal: ' || 'The quick brown fox jumps over the lazy dog. 1234567890', -1, 550 );
  as_pdf_mini.set_font( 'courier', 'I' );
  as_pdf_mini.write( 'courier, italic: ' || 'The quick brown fox jumps over the lazy dog. 1234567890', -1, -1 );
  as_pdf_mini.set_font( 'courier', 'b' );
  as_pdf_mini.write( 'courier, bold: ' || 'The quick brown fox jumps over the lazy dog. 1234567890', -1, -1 );
  as_pdf_mini.set_font( 'courier', 'BI' );
  as_pdf_mini.write( 'courier, bold italic: ' || 'The quick brown fox jumps over the lazy dog. 1234567890', -1, -1 );
--
  as_pdf_mini.set_font( 'courier' );
  as_pdf_mini.write( 'symbol:', -1, 475 );
  as_pdf_mini.set_font( 'symbol' );
  as_pdf_mini.write( 'The quick brown fox jumps over the lazy dog. 1234567890', -1, -1 );
  as_pdf_mini.set_font( 'courier' );
  as_pdf_mini.write( 'zapfdingbats:', -1, -1 );
  as_pdf_mini.set_font( 'zapfdingbats' );
  as_pdf_mini.write( 'The quick brown fox jumps over the lazy dog. 1234567890', -1, -1 );
--
  as_pdf_mini.set_font( 'times', 'N', 20 );
  as_pdf_mini.write( 'times, normal with fontsize 20pt', -1, 400 );
  as_pdf_mini.set_font( 'times', 'N', 6 );
  as_pdf_mini.write( 'times, normal with fontsize 5pt', -1, -1 );
  as_pdf_mini.save_pdf;
end;

Fonts

Or you can write a procedure: refcursor in, pdf out

Refcursor

The package: as_pdf_mini
But see also it successor as_pdf3