« September 10, 2007 | Main | September 17, 2007 »

September 11, 2007 Archives

September 11, 2007

Secure your PDFs

As many of you hopefully know we can secure your PDF outputs from publisher. There was a question on the forum asking how it can be achieved - there are, of course, various ways.


The levels of security supported covered in the following graphic - for more details check the Adobe Reader/Acrobat help files and our of course.


PDFSec1:


You can see two password fields, the first prevents the document being opened the second prevents someone with the first password and Adobe Professional from changing the document. The changes are controlled by the following attributes in the graphic. You have complete control over the PDF outputs, but how do you achieve it?


E Business Suite Template Manager


In the template manager UI you'll see the configuration tab - this has the options above. They can be set at  template, data definition and site levels. The options will be laid out as above - if you want to secure a PDF output remember that you will need to set the 'Enable PDF Security' value to 'true.'


PeopleSoft and JD Edwards


For these apps you'll need to use the xdo.cfg file. This is an XML file that defines the security options. Check the user guide for details, the file will have the structure:


<config version="1.0.0"  xmlns="http://xmlns.oracle.com/oxp/config/">
    <!-- Properties -->
    <properties>
        <!-- System level properties -->
        <property name="system-temp-dir">c:/Temp</property>


        <!-- PDF security -->
        <property name="pdf-security">true</property>
        <property name="pdf-open-password">welcome</property>
        <property name="pdf-permissions-password">welcomeagain</property>
        <property name="pdf-no-printing">true</property>
        <property name="pdf-no-changing-the-document">true</property>
    </properties>
</config>


As you can see the passwords are going to be clear text - not great but you could argue that almost everyone will not have access to the config file. This file needs to sit under the JRE_TOP/lib directory on your web tier for publisher to find it.


BI Publisher Enterprise


The standalone release has very similar UI to the E Business Suite implementation - the security attributes are available at site and report levels.


RTF Template Method


There is another way to set these attributes via RTF template properties. In MSWord you can set custom properties for the document and we can use those to set the security attributes. Just define new attributes and prefix the property - take the property name and prefix it with 'xdo-' e.g. xdo-pdf-security


PDFSec2:


From the graphic you can see the custom properties Name and Values defined.


If you look at the  graphic the second property sets the password for the document:


Name: xdo-pdf-open-password
Value: {PASSWORD}


PASSWORD is actually an element value in the XML that can be retrieved at runtime and set as the document password. Again, clear text password in the XML data but you could have the XML swept away as soon as its been used.


Java API Method


Finally, if you are using the API to generate outputs you can set the security via an API call. Just about all of the document processing APIs have a setConfig method. This can be used to set the document security:

    // Set the security property
    Properties prop = new Properties();
    prop.put("pdf-security","true");
    prop.put("pdf-open-password","welcome");
    foProcessor.setConfig(prop);

In this case we have created a Properties object, loaded our security properties into it and then passed it to the processor API.


So, you can secure your PDF output - there are just multiple ways to do it.

Synching Charts and Data Grids in Flex Templates

This posts assumes that you've looked at the new flex templates and have worked through the tutorial in the New Features Guide.  If you built the report in this tutorial, you may have noticed that your results were interactive.  You can click on a column heading to sort the rows by a column.  Or, you can drag and drop a column to a new location.  You may have also noticed that the data grid and the chart are not synchronized.  Meaning that if you sort the data grid, the data in the chart does not also sort.  Synchronizing them is pretty easy though.

  1. Turn your XML into an XMLListCollection.  BIP sends data to the flex template as an XML Object.  Unfortunately, Flex doesn't have the best XML support.  If you need to sort, filter or refresh data, it is much easier to use an Array or a Collection.  The good news:  It's very easy to convert the XML into an XMLListCollection and the XMLListCollection is much easier to work with.  First, import the proper classes into your project by adding this line:

    import mx.collections.XMLListCollection;

    Tip: just type XMLListColl and type "CTRL - Space" and Flex Builder will complete the word and add the appropriate import statement.

    Second, create the XMLListCollection as a Bindable variable:

    [Bindable]
    public var filteredXML:XMLListCollection = new XMLListCollection(dataXML.ROW);

    Notice the the new variable called filteredXML is constructed from the dataXML variable that we used in the tutorial.

  2. Modify your data grid and chart so that their data providers are the new variable called filteredXML:

    <mx:DataGrid x="10" y="160" width="476" height="152" dataProvider="{filteredXML}">

    <mx:ColumnChart x="10" y="10" id="columnchart1" width="476" height="142" dataProvider="{filteredXML}">

  3. Create an init() function.  Our end goal here is to refresh the data behind the data grid and the chart.  The refresh method of a collection must be called from inside an init() function:

    public function init():void{
            filteredXML.refresh();
    }
This is all the code necessary to get the chart and the data grid in sync.  Now, if you sort the data grid, the x-axis of the chat will also sort.  Here is the MXML file and here is the full BIP Report (assumes you have a JDBC connection called demo that has access to the HR sample schema).  The full report has three templates: the template described in the new features document, the template I described building in this blog entry, and a template that sorts numbers properly (I'll be blogging about that next).

About September 2007

This page contains all entries posted to Oracle BI Publisher Blog in September 2007. They are listed from oldest to newest.

September 10, 2007 is the previous archive.

September 17, 2007 is the next archive.

Many more can be found on the main index page or by looking through the archives.

Powered by
Movable Type and Oracle