AS_PDF, generating a PDF-document with some plsql

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

AS_PDF, generating a PDF-document with some plsql image51

Refcursor

The package: as_pdf_mini
But see also it successor as_pdf3

92 Comments

  1. amy.chan December 24, 2013
  2. Zakaria October 31, 2013
    • Anton Scheffer October 31, 2013
  3. kadi September 9, 2013
  4. Franco G. February 1, 2012
    • Anton Scheffer February 1, 2012
  5. Franco G. January 28, 2012
    • Anton Scheffer January 28, 2012
  6. Mike January 17, 2012
    • Anton Scheffer January 17, 2012
  7. Mohammed Haris January 11, 2012
    • Anton Scheffer January 11, 2012
  8. Tom January 11, 2012
    • Anton Scheffer January 11, 2012
  9. Tom January 10, 2012
  10. raoul January 6, 2012
  11. raoul January 4, 2012
    • Anton Scheffer January 4, 2012
  12. Naing December 8, 2011
    • Anton Scheffer December 8, 2011
  13. Michael Moore November 28, 2011
  14. francesco November 11, 2011
  15. francesco November 9, 2011
  16. francesco November 8, 2011
    • Anton Scheffer November 8, 2011
  17. francesco November 7, 2011
    • Anton Scheffer November 7, 2011
  18. francesco November 4, 2011
  19. francesco November 3, 2011
    • Anton Scheffer November 3, 2011
  20. Anton Scheffer October 26, 2011
  21. francesco October 26, 2011
  22. AJ GOLDEN September 28, 2011
    • Anton Scheffer September 28, 2011
  23. AJ GOLDEN September 27, 2011
    • Anton Scheffer September 28, 2011
  24. Brenda September 20, 2011
  25. Anton Scheffer September 20, 2011
  26. Brenda September 20, 2011
  27. Brenda September 20, 2011
    • Anton Scheffer September 20, 2011
  28. Alex Fatkulin September 12, 2011
    • Anton Scheffer September 12, 2011
  29. Alex Fatkulin September 12, 2011
    • Anton Scheffer September 12, 2011
  30. Alex Fatkulin September 9, 2011
    • Anton Scheffer September 11, 2011
  31. carsten August 31, 2011
  32. carsten August 30, 2011
    • Anton Scheffer August 30, 2011
  33. Brenda August 23, 2011
  34. Brenda August 23, 2011
    • Anton Scheffer August 23, 2011
  35. Anton Scheffer August 18, 2011
  36. Brenda August 18, 2011
  37. Reuben August 10, 2011
  38. Adolfo August 10, 2011
  39. Brenda August 8, 2011
  40. Brenda August 7, 2011
    • Anton Scheffer August 8, 2011
  41. Brenda August 7, 2011
  42. Sara August 7, 2011
    • Anton Scheffer August 7, 2011
  43. Anton Scheffer August 5, 2011
  44. sara August 5, 2011
  45. sara August 5, 2011
    • Prasanna May 5, 2014
  46. Anton Scheffer August 3, 2011
  47. brendaivett August 3, 2011
  48. miki April 8, 2011
  49. miki April 8, 2011
    • Anton Scheffer April 8, 2011
  50. miki April 8, 2011
    • Anton Scheffer April 8, 2011
  51. Anton Scheffer March 23, 2011
  52. Binepal March 23, 2011
  53. Anton Scheffer March 17, 2011
  54. António March 17, 2011
  55. Anton Scheffer March 3, 2011
  56. Mikhail Goncharov March 3, 2011
  57. HiAnton February 11, 2011
  58. tony miller February 7, 2011
    • Anton Scheffer February 7, 2011
  59. Erich January 21, 2011
    • Anton Scheffer January 22, 2011
  60. Anton Scheffer December 11, 2010
  61. Estevan December 10, 2010
  62. Anton Scheffer November 18, 2010
  63. Ino November 18, 2010
  64. Anon October 21, 2010
  65. Laurent Schneider October 21, 2010