[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1200
  • Last Modified:

Generating pdf using oracle reports

We need to generate a pdf file using the images stored in the tables. Images are stored in the BFILE format and our website is in PL/SQL. So we know we can generate pdf files using oracle reports. what are steps to be followed . We need to do this in the code of PL/SQL(programatically). Has anyone done this before ? Please help with an answer.
0
shami4u
Asked:
shami4u
  • 2
1 Solution
 
oleggoldCommented:
Quating from the above
to  have jave code to work with frr pdf writing options like Ghostscript You need the following
create or replace and compile 
java source named "Util" 
as 
package createpdf;
import java.io.FileOutputStream;
import java.io.IOException;
 
import com.lowagie.text.*;
import com.lowagie.text.pdf.PdfWriter;
 
public class Util extends Object 
  {
    public static void Create_Pdf(String args[]) 
      {
	  Document document = new Document();
	  try {
	        PdfWriter.getInstance(document, new FileOutputStream("d:\\Doc.pdf"));
	        document.open();
	        document.add(new Paragraph(args[0]));
	      } 
	  catch (DocumentException de) 
             {
	        System.err.println(de.getMessage());
	     } 
	  catch (IOException ioe) 
             {
	        System.err.println(ioe.getMessage());
	     }
	  document.close();
       }
   };
 
create or replace function CREATE_NEW_PDF(p_src in varchar2) return varchar2 
as 
language java 
name 'Util.Create_Pdf(java.lang.String) return String'; 
 
 
 
 
And also I have executed: 
 
 
 
BEGIN 
dbms_java.grant_permission('<DB_USER>','java.io.FilePermission','$ORACLE_BASE','write'); 
dbms_java.grant_permission('<DB_USER>','java.lang.RuntimePermission','*', 'writeFileDescriptor' ); 
END; 
 

Open in new window

0

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now