--For PLPDF v5.2 or later
DECLARE
l_pdf_blob BLOB;
BEGIN
-- Initialize PLPDF
plpdf_owner.plpdf.init;
plpdf_owner.plpdf.newPage;
-- Set font properly using setPrintFont
plpdf_owner.plpdf.setPrintFont('Arial', NULL, 12);
-- Write text to PDF
plpdf_owner.plpdf.text(100, 750, 'Hello from PLPDF!');
-- Retrieve the generated PDF as a BLOB
l_pdf_blob := plpdf_owner.plpdf.getContentStream;
-- Output headers
owa_util.mime_header('application/pdf', FALSE, 'UTF-8');
htp.p('Content-Disposition: inline; filename="test.pdf"');
htp.p('Content-Length: ' || TO_CHAR(DBMS_LOB.getlength(l_pdf_blob)));
owa_util.http_header_close;
-- Send the BLOB to the browser
wpg_docload.download_file(l_pdf_blob);
END;