Menu for Database knowledge

hdr_services.gif (1973 bytes)
Oracle design, development, administration.

Wpdf - build PDFs in pl/sql.     Click here
Example - simple pdf1
procedure helloworld is
  b blob;
begin

  pdf('P','cm','A4');
  openpdf;
  AddPage();
  SetFont('Arial','B',16);
  Cell(0,1.2,'Hello World',0,1,'C');

  if true then
    output();		-- send to browser
  else
    b	:= Output();	-- or get pdf as blob for storage or email
    htp.init;
    owa_util.mime_header('application/pdf',false);
    htp.print('Content-Length: ' || dbms_lob.getlength(b));
    htp.print('Content-disposition: inline; filename="pdf.pdf"');
    owa_util.http_header_close;
    wpg_docload.download_file(b);
  end if;

exception when others then pdf_error;
end helloworld;
Example 2 - basic image // image() can accept a blob or clob (base64 image string)
procedure image_test(b blob) is
begin
  pdf('P','cm','A4');
  openpdf;
  AddPage();
  image(b, 100, 100);
  Output();
exception  when others then   pdf_error;
end;
Example 3 - th / td
procedure newstuff1_demo is
  str varchar2(300);
begin
  pdf('P','mm','letter');
  AliasNbPages	:= '`p';
  SetMargins(10,20,10);
  openpdf;
  SetAutoPageBreak(true);
  AddPage();

  SetFont('Arial','B',8);
  th(40, 'Description', 'l');
  th(10, 'List');
  th(10, 'Qty');
  th(15, 'Ext');

  for z in 1..30 loop
    td('font-size:7.5;',   'Item Number '|| z );
    td('font-size:7.5;align:right', z*2.3);
    td('font-size:7.5;align:center', z-1);
    td('font-size:7.5;align:right', ( z*2.3 * (z-1) ));

    if z = 3 then
      str := 'This line has more text and will wrap to the next '||
	         'line which now is automatic.';
      td('line-height:2;font-size:5.2;font-family:Courier;', str);
      td('line-height:2;colspan:3;', '');
    end if;

	end loop;

  td('font-weight:bold;colspan:4;align:right', 'TOTAL QTY:  $'|| 9999.99 );

  ln(5);
  ln(5);

  SetFont('Arial','',7);
  write(5, 'Example of a page break with the multi line cell:');

  ln(5);
  ln(5);

  tClear;
  SetFont('Arial','B',8);
  th(30, 'Col 1', 'l');
  th(15, 'Col 2');

  for z in 1..15 loop
    td('font-size:6;line-height:3;', 'Row '|| z||
	   ' this is a wraping row, as it will wrap. '|| z );
    td('font-size:6;align:center;line-height:3;', 'item '|| z*2);
  end loop;

  output;

exception  when others then   pdf_error;
end;


database@databaseknowledge.com