pl_fpdf icon indicating copy to clipboard operation
pl_fpdf copied to clipboard

Image not working in 11g

Open szamrud opened this issue 11 years ago • 12 comments

Using pl_fpdf I'm able to put image in 10g environment on PDF reports, but when I try the same code in 11g I start getting the error message. look like image part of the code is not working in 11g. Any one has any idea or any solution.

procedure testImg is img varchar2(2000); begin FPDF('P','cm','A4'); openpdf; AddPage(); SetFont('Arial','B',16); img := 'http://www.lcw-design.com/jpgAutoc/sigle1.jpg'; Image(img,1, 1, 10); pl_fpdf.output (); end testImg;

szamrud avatar Jun 11 '14 19:06 szamrud

Hi, Could you please send the error message you get ?

Pilooz avatar Jul 15 '14 09:07 Pilooz

Hi, Here is the error, I'm getting.

error

Thanks, Syed

szamrud avatar Jul 15 '14 15:07 szamrud

I am also having this same issue with images. I has an issue in the image parser.

Fri, 16 Oct 2015 19:09:20 GMT

Failed to execute target procedure ORA-20100: <B>PL_FPDF error: </B>image : ORA-20100: <B>PL_FPDF error: </B>p_parseImage : ORA-20100: <B>PL_FPDF error: </B>Not a PNG file: http://www.chemeketa.edu/global_files/images/gen/social/facebook1-trans.png
ORA-06512: at "BANINST1.PL_FPDF", line 1948
ORA-06512: at "BANINST1.PL_FPDF", line 3322
ORA-06512: at "BANINST1.RECOGNITION_TEST", line 20
ORA-06512: at line 33

I modified the png_signature and signature_len variables because I noticed tha it wasn't matching what is at the tops of PNG files, looks like it need two more CHR(26) and the char length increased from 8 to 10

png_signature constant varchar2(10)  := chr(137) || 'PNG' || chr(13) || chr(10) || chr(26) || chr(26) || chr(26) || chr(10);
signature_len integer := 10;    

image

Do you have any ideas why this is an issue in 11g ?

padarr avatar Oct 16 '15 19:10 padarr

I tried every option but it doesn't work for me. I'm using as_pdf3 open source to generate PDFs.

szamrud avatar Oct 16 '15 20:10 szamrud

I'm trying the as_pdf3 but I keep getting an invalid path error when I put one of the demos in the script?

I could get the pl_fpdf to at least work, just not with images.

padarr avatar Oct 16 '15 21:10 padarr

pl_fpdf working fine without image, But if you really need image on PDF than only option is as_pdf3. If you search for p_dir and replace the directory name to your oracle directory, hope it will work fine for you.

p_dir varchar2 := 'Oracle Directory'

szamrud avatar Oct 16 '15 21:10 szamrud

Is it trying to save to the database? What I need it to do is open up a pdf just like the Output() function in pl_fpdf

padarr avatar Oct 16 '15 22:10 padarr

For your test you can store in the blob column, for browser you can use as_pdf3.output CREATE TABLE "TEST_PDF" ( "PDF_FILE" BLOB );

begin as_pdf3.init; as_pdf3.write( 'jpg, gif and png images are supported.' ); insert into test_pdf values (as_pdf3.get_pdf ()); end;

select * from test_pdf

szamrud avatar Oct 16 '15 22:10 szamrud

I do not see this procedure anywhere in the package. as_pdf3.output doesn't exist in what I downloaded from here https://github.com/mortenbra/alexandria-plsql-utils/tree/master/extras

Is there more that I need to install other than the first two pks and pkb files?

padarr avatar Oct 16 '15 22:10 padarr

Add this code to your as_pdf3 package spec and body.

procedure output (pb_file blob);

procedure output (pb_file blob) is

lb_file blob; begin lb_file := pb_file; OWA_UTIL.mime_header('application/pdf', FALSE); HTP.p('Content-Length: ' || DBMS_LOB.getlength(lb_file)); OWA_UTIL.http_header_close; wpg_docload.download_file(lb_file); end;

szamrud avatar Oct 16 '15 22:10 szamrud

For Browser...

procedure proc_run_report is lb_blob blob; begin as_pdf3.init; as_pdf3.write( 'jpg, gif and png images are supported.' ); lb_blob := as_pdf3.get_pdf (); as_pdf3.output (lb_blob); end;

szamrud avatar Oct 16 '15 22:10 szamrud

Thank you szamrud... You Rock Sir!

padarr avatar Oct 16 '15 22:10 padarr