Skip to Main Content

Breadcrumb

Question and Answer

Connor McDonald

Thanks for the question, Dieter.

Asked: January 06, 2009 - 1:32 pm UTC

Last updated: September 08, 2023 - 7:13 am UTC

Version: 10.2.0

Viewed 50K+ times! This question is

You Asked

Hi Tom,

How would you recommend generating PDF documents from within "plain" PL/SQL?

Thank you,
Dieter

and Tom said...

I cannot - generating pdf is a non-trivial task.

You can use APEX and its directions/approach:

https://docs.oracle.com/en/database/oracle/application-express/20.1/htmdb/printing-report-regions.html#GUID-CB735DE1-2198-4BA8-A9E7-2521CBBA760B

Without endorsement or review, an AskTOM user Andreas Weiden also provided this:

There is an open source-tool called PL-jrxml2pdf ( https://sourceforge.net/projects/pljrxml2pdf/ ) with also generates PDF's from pure PL/SQL. Maybe its worth adding to the question as option.

Rating

  (10 ratings)

Is this answer out of date? If it is, please let us know via a Comment

Comments

pl/pdf

Manish, January 06, 2009 - 2:05 pm UTC

Another option would be something like http://www.plpdf.com/

But it's still tedious...

Third party plug in

MojoMark, January 06, 2009 - 2:07 pm UTC

You might also give http://www.plpdf.com/ a try. It is a wrapped PL/SQL package that will generate a PDF as a blob that you could store in the database and/or serve to the user via HTTP.

While somewhat limited, it works well and it's cheap.

How about XML Publisher?

Srini, January 30, 2009 - 1:07 pm UTC

Hey Tom:
With reference to generating PDF documents from oracle, wouldn't using XMLPUB be easier? Most of the oraapps reports are already getting converted into XMLPUB reports.
We can generate XML data from PLSQL and use this as a source for the XML Publisher.
What do you think?



Tom Kyte
January 30, 2009 - 4:19 pm UTC

that is how APEX does it.

They did the task of getting it all working together - you can just reuse their work.

BI Publisher with OAS

Dieter Oberkofler, February 01, 2009 - 4:02 am UTC

We have also looked into BI Publisher but I understand that BI-PUB requires the complete OAS infrastructure to be used and would not run just on an Oracle Database Server.
Does it?

I'm also wondering if BI-PUB is restricted to be used with APEX or would also work in conjunction with a simple mod_plsql application?

Tom Kyte
February 02, 2009 - 10:17 am UTC

... I'm also wondering if BI-PUB is restricted to be used with APEX or would also
work in conjunction with a simple mod_plsql application?
...

since APEX is nothing more than a simple mod_plsql application - the answer is yes.



See the link above in the original answer - it has all of the setup for both ways to do the pdf printing by APEX and those details answer the first bit (no, it does not run in the database, it doesn't need a full up iAS implementation - does need oc4j)

pdf

Sam, February 15, 2010 - 7:30 pm UTC

Tom:

Does apex come preinstalled with those report servers (i.e oracle report publisher or apche FOP) ?

Would those serve the same thing Crystal reports does (i.e create a report layout and select fields and generate PDF reports dynamically)?

PLPDF

Arpan, February 12, 2013 - 5:32 am UTC

can any one please help me to solve the following problem from pl_fpdf.
I've already the package compiled successfully in my DB.
but still am unaware of this thing that how to create the output pdf and how to set the destination of the pdf file?
please help...
Tom Kyte
February 12, 2013 - 7:40 am UTC

the plpdf site - which "owns" this software - has a support link on it, I'd suggest trying that.

Oracle itself has nothing to do with plpdf.

URL shared is not working

Chaitali, March 16, 2018 - 8:40 am UTC

Dear Team,

I was trying to open the URL provided in original response. But seems not working. It is giving error as Page Not Found.

http://www.oracle.com/technology/products/database/application_express/html/configure_printing.html

It would be great, if you could
share the latest URL.

Thanks in advance!
Regards,
Connor McDonald
March 18, 2018 - 3:05 am UTC

Try this one

https://docs.oracle.com/database/121/HTMDB/bldapp_rpt_print.htm#HTMDB05033

But remember, both the original and this one are about printing from Apex not directly from PLSQL

The Apex link is broken

Michelle Unser, April 19, 2021 - 10:55 am UTC

The Apex link suggested leads to a "Page not found"
Chris Saxon
April 19, 2021 - 12:43 pm UTC

Thanks, fixed

Apex link

A reader, September 07, 2023 - 2:19 pm UTC

The Apex link suggested leads to a "Page not found"
Connor McDonald
September 08, 2023 - 7:13 am UTC

edited.

Thanks

More to Explore

PL/SQL demos

Check out more PL/SQL tutorials on our LiveSQL tool.

PL/SQL docs

PL/SQL reference manual from the Oracle documentation library