16.6.3 Using PDF Viewer in Job Referrals Page
Use a PDF Viewer template component to display a PDF file inline in a page.
The Open Position Referrals page shown in Page Designer below includes a
PDF Viewer template component. It's available only as a Single
(Partial), so it shows a single row of data. Accordingly, the Source
query below returns a single row with a single PDF_PAGE_URL column.
The CASE statement uses APEX_PAGE.GET_URL to generate the URL to page 9001. It serves an inline PDF from the BLOB column in the employee job referrals table, based on the referral ID passed in the X01 parameter. Since it references the P11_REFERRAL_CANDIDATE_ID hidden page item as a bind variable, the Page Items to Submit property reflects that. This ensures the latest value of that item is always sent to the server when the region gets refreshed.
select case
when :P11_REFERRAL_CANDIDATE_ID is not null then
apex_page.get_url(
p_page => 9001,
p_x01 => :P11_REFERRAL_CANDIDATE_ID,
p_absolute_url => true)
end as PDF_PAGE_URL
from dualTip:
An iframe is separate document inside another page that includes it. Any relative URLs it contains resolve against its own location, rather than the containing parent page's. This explains why the PDF_PAGE_URL value here must be an absolute URL to work correctly. You request one by passing true for the p_absolute_url parameter to APEX_PAGE.GET_URL.
Figure 16-62 Sourcing the PDF_URL in the Region's Query
On the Attributes tab in the Property Editor, notice Appearance > Display is set to Single (Partial). The PDF URL property gets its value from the PDF_PAGE_URL column in the regions single-row query result using the &PDF_PAGE_URL. substitution. The Other Content Height is set to 15 to indicate that the other content on the page takes up about 15 lines of height in the base font size.
Finally, a dynamic action on the value Change event of the P11_REFERRAL_CANDIDATE_ID candidate picker Select List page item refreshes the Candidate CV PDF Viewer region. This combination produces an interactive inline PDF viewer that updates to show the CV of the selected candidate as shown below.
Figure 16-64 Candidate Picker Select List Refreshes PDF Viewer Template Component
Parent topic: Previewing BLOB Column PDF Files Inline


