01.02.2013 Views

Publishing Reports to the Web - Downloads - Oracle

Publishing Reports to the Web - Downloads - Oracle

Publishing Reports to the Web - Downloads - Oracle

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Frequently Asked Questions<br />

How do you dynamically change <strong>the</strong> printer tray setting in <strong>the</strong> midst of a<br />

print job?<br />

In some cases, you may want <strong>to</strong> switch printer trays in <strong>the</strong> middle of a report. For<br />

example, you might want <strong>the</strong> first page of a report printed on letterhead stationary<br />

and subsequent pages printed on plain white paper. For character mode reports, you<br />

can achieve this result through a combination of editing <strong>the</strong> .prt file and changing <strong>the</strong><br />

report’s properties. For bit-mapped reports, you use <strong>the</strong> SRW.SET_PRINTER_TRAY<br />

built-in function. On UNIX, this functionality is supported for PostScript output but<br />

not PCL output. For PCL, <strong>Oracle</strong> <strong>Reports</strong> ignores <strong>the</strong> commands for changing<br />

orientation and paper tray. Although dynamically changing <strong>the</strong> orientation and<br />

printer tray for PCL is not supported on UNIX, you can change <strong>the</strong>m at runtime<br />

through <strong>the</strong> print dialog box for PCL.<br />

By using <strong>the</strong> Before Report, Between Pages, or format triggers you can switch <strong>to</strong><br />

different printer trays as your report formats. This allows you <strong>to</strong> easily print pages of<br />

<strong>the</strong> same report on different sheets of paper.<br />

SRW.SET_PRINTER_TRAY is a built in <strong>Oracle</strong> <strong>Reports</strong> function for setting <strong>the</strong> printer<br />

tray. The <strong>Reports</strong> Builder online help system describes this function’s syntax.<br />

Example<br />

From <strong>the</strong> Before Report trigger, you can set <strong>the</strong> printer tray for <strong>the</strong> very first page:<br />

function BeforeReport return boolean is<br />

begin<br />

srw.set_printer_tray('UPPER PAPER TRAY');<br />

return (TRUE);<br />

end;<br />

To set <strong>the</strong> printer tray dynamically for subsequent pages, add a format Trigger <strong>to</strong> an<br />

item that prints on each page of <strong>the</strong> report. The following code checks for even pages<br />

and sets <strong>the</strong> page number accordingly:<br />

function B_tbpFormatTrigger return boolean is<br />

page_num number;<br />

begin<br />

srw.get_page_num(page_num);<br />

begin<br />

if mod(page_num, 2) = 0 <strong>the</strong>n<br />

srw.set_printer_tray('UPPER PAPER TRAY');<br />

else<br />

srw.set_printer_tray('LOWER PAPER TRAY');<br />

end if;<br />

return (true);<br />

end;<br />

end;<br />

Why does <strong>the</strong> external print command ignore <strong>the</strong> tray select option while<br />

trying <strong>to</strong> print <strong>the</strong> PostScript output generated by <strong>Oracle</strong> <strong>Reports</strong>?<br />

Suppose that you enter <strong>the</strong> following print command:<br />

- lp -dprinter -oupper $report_print_file1<br />

In this case, <strong>the</strong> -oupper option in <strong>the</strong> lp command is ignored. The reason for this<br />

behavior is that <strong>Oracle</strong> <strong>Reports</strong> generates tray information in its PostScript output. The<br />

tray selection in <strong>the</strong> PostScript overrides <strong>the</strong> specification on <strong>the</strong> command line. If you<br />

want <strong>the</strong> tray information on <strong>the</strong> command line <strong>to</strong> be respected, you need <strong>to</strong> remove<br />

5-22 <strong>Oracle</strong> Application Server <strong>Reports</strong> Services <strong>Publishing</strong> <strong>Reports</strong> <strong>to</strong> <strong>the</strong> <strong>Web</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!