15. Draw rectangle
CREATE OR REPLACE procedure test15 is
-- Draw rectangle
l_blob blob;
l_filename varchar2(30) := '123.pdf';
begin
plpdf.init; -- initialize, without parameters means: page orientation: portrait, unit: mm, default page format: A4
plpdf.NewPage; -- begin a new page, without parameters means: page orientation: default (portrait)
for i in 1..20 loop
plpdf.SetColor4Drawing(0,i*10,0); -- set drawing color
plpdf.DrawRect(10,10,i,i,'D'); -- draw rectangle: x position, y position, width, heigth, draw line
end loop;
plpdf.SetColor4Drawing(0); -- set default drawing color
plpdf.SetColor4Filling(0,0,255); -- set color for filling (RGB)
plpdf.DrawRect(50,10,20,20,'DF'); -- draw rectangle: x position: 50, y position: 10, width: 20, heigth: 20, draw line, fill
plpdf.SendDoc(l_blob); -- create content
-- print
/*
owa_util.mime_header('application/pdf',false);
htp.p('Content-Disposition: inline; filename="' || l_filename || '"');
htp.p('Content-Length: ' || dbms_lob.getlength(l_blob));
owa_util.http_header_close;
wpg_docload.download_file(l_blob);
*/
-- or store
insert into STORE_BLOB (blob_file, created_date) values (l_blob, sysdate);
commit;
end;
/
Source: test15.prc
Result: test15.pdf