32. Pattern
CREATE OR REPLACE procedure test32 is
-- Pattern
---------------
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
-- create pattern: line
plpdf.CrTillingPattern('line',5,5);
plpdf.AddLine2Pattern('line',0,0,5,5);
-- create pattern: chequer
plpdf.CrTillingPattern('chequer',4,4);
plpdf.AddRect2Pattern('chequer',0,0,2,2,'F');
plpdf.AddRect2Pattern('chequer',2,2,2,2,'F');
-- create pattern: halfchequer
plpdf.CrTillingPattern('halfchequer',4,4);
plpdf.AddRect2Pattern('halfchequer',0,0,2,2,'F');
plpdf.AddRect2Pattern('halfchequer',2,2,2,2,'D');
-- create pattern: circle
plpdf.CrTillingPattern('circle',5,5);
plpdf.AddCircle2Pattern('circle',5/2,5/2,2,'D');
plpdf.AddCircle2Pattern('circle',0,5/2,2,'D');
plpdf.AddCircle2Pattern('circle',5,5/2,2,'D');
Plpdf.NewPage; -- begin a new page, without parameters means: page orientation: default (portrait)
Plpdf.SetPrintFont('Arial',NULL,12);
plpdf.SetTillingPattern('line',plpdf_const.Salmon);
Plpdf.DrawRect(10,10,40,40,'FD');
plpdf.SetTillingPattern('chequer',plpdf_const.Brown);
Plpdf.DrawRect(10,60,40,40,'FD');
plpdf.SetTillingPattern('halfchequer',plpdf_const.Royal_blue);
Plpdf.DrawRect(10,110,40,40,'FD');
plpdf.SetTillingPattern('circle',plpdf_const.Yellow_green);
Plpdf.DrawRect(10,160,40,40,'FD');
plpdf.SetCurrentXY(70,25);
plpdf.PrintCell(50,10,'Line pattern');
plpdf.SetCurrentXY(70,75);
plpdf.PrintCell(50,10,'Chequer pattern');
plpdf.SetCurrentXY(70,125);
plpdf.PrintCell(50,10,'Half-checquer pattern');
plpdf.SetCurrentXY(70,175);
plpdf.PrintCell(50,10,'Circle pattern');
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: test32.prc
Result: test32.pdf