Friday, August 26, 2005

Change PDF options when emailing reports

This post is the result of a query I answered on the OTN DiscovererForum a day back. If you want to send a worksheet as a PDF attachment, how do you change the properties of the generated PD? E.g, if you want the margins to be larger, smaller, or the orientation to be portrait (or landscape), etc, how do you do that? On the face of it there doesn't seem to be any option or screen available to customize PDF export options. Well, the truth is that there is. The PDF generated is identical whether you are creating a printable version of your worksheet in Viewer (PDF), or whether you are exporting the worksheet as a PDF file. The printable page properties screen allows you to change and set a whole lot of properties such as the orientation, paper size, margins, shrinking factor, etc...

Below is a report where one field, 'Profit SUM' spills over to the next page. What I want to do is to shrink the size of the text (scale down) in the PDF so that all columns appear on a single page.
1. Click the 'Printable Page' link
2. Change the page and print properties and required. Check out a sample PDF page if required. Here I have changed the scaling factor to 60%, and also reduced the margins from their default values to a smaller value. I can take a look at a sample PDF based on these print settings as many times till I get the desired result. The sample itself is based only on a small subset of rows of the actual worksheet, so you don't have to worry (too much) about hogging middle-tier resources.
3. Go back to the worksheet.
4. Click the 'Send as email' link and select PDF as the export format.
5. In the send email page you can click the 'View attachment' link to see how the PDF looks.

website statisticswebsite statistics
(For some reason this is the third time I am (re)publishing this post - the first two times I left some really silly errors behind... must be the Friday evening syndrome: 'what am I doing bloggin at 8pm on a Friday?')