If you're seeing something other than Verdana, the Font is Graublau Sans Web by FDI fonts.info
This article explains how to add additional files and resources to the Navigator of your PDF Portfolio.
The following is a list of software that you'll need to get started with these tutorials. This section is repeated in each article on this topic.
| What You Need: | Where to get it: |
| Adobe Acrobat 9 Pro or Adobe Acrobat 9 Pro Extended |
If you don't already have a copy of Acrobat, you can buy it here. For Windows users, you can download a fully functional 30 day trial here. Sorry - we don't have a trial version for OSX. |
| Flex Builder 3 | You can purchase or download a 60 day free trial of Flash Builder 4 here Note: The Actobat ActionScript API (AcrobatAPI.swc) only works with version 3.0.0 of the Flex SDK. You can download version 3.0.0.477 of the Flex SDK here. The project files in these tutorials will be looking for the name "Flex 3.0.0" in the compiler settings. |
| The Acrobat 9 ActionScript SDK | You can download the complete Acrobat 9 SDK here. The Navigator SDK is part of that. |
| Apache Ant | Again, I like to keep everything in Flex so I use Flex Ant Tasks to zip my files into a Navigator .NAV file. Instructions on how to set this set up are in the next part of the series. |
If you remember from part one of this series, your Navigator can use resources that are stored in the .nav file. These files must be stored in a folder called "navigator" in the root of the .NAV file and you can reference these files from your .SWF application through URLs as in the example code below.
<mx:Image source="navigator/ActionScriptHeader.png"/>
But what do you do when you want to allow your users to add their own images (a logo for example) and modify other aspects of the Navigator and then save those into the PDF file for use later? Well, the Acrobat ActionScript API provides the tools to do just that.
Working with Resources:
The ICollection object has three methods related to resources; addResource, deleteResource, and writeResource. You can only add resources when the document permissions allow it to be modified. The Acrobat ActionScript API handles this pretty nicely. The permissions property of the Collection can be used to determine if your Navigator can write to the file. There are two cases where a Collection cannot be modified by a Navigator; the file is being viewed in the Adobe Reader and the file is being viewed in Adobe Acrobat but is secured. Unlike Acrobat JavaScript, the Navigator cannot tell if the PDF file is being viewed in Reader or Acrobat. By using the permissions property, you don't need to differentiate between the two conditions. The code below shows how to check for the ability to modify a PDF Portfolio.
if (_host.collection.permissions.check("Document", "Modify") == true)
{
//You can save changes
}
else
{
//You can’t
}
addResource:
The addResource method will bring up a file browsing dialog prompting the user to select the needed file. File types that are not blacklisted by Acrobat will be added to the resource dictionary of the PDF Portfolio. The resource can later be accessed by any call that can read data from a URL. You can set the path where the resource will be added. It must be a relative path, "/" separated, but with no leading "/" and must start with "Navigator/". If the URL does not have a file extension (that is, it does not contain a '.'), then the file extension of the added file (if any) will be appended. If the URL ends with "/", then the entire file name of the selected file will be appended. This makes it pretty easy to find things later. Because there is no way to enumerate the resources, you'll want to devise a way to keep track of what was added or deleted.
deleteResource:
The same thing as above... but in reverse. Basically, you just pass in the path to the resource to be deleted. It must match a path used previously on a successful call to addResource or writeResource.
Again, because there is no way to enumerate the resources, you'll want to devise a way to keep track of what was added or deleted.
writeResource:
This one is a little different from addResource in that no dialog is presented. You need to start out with an object that you want to write then convert that to a ByteArray. The method then replaces the contents of the Navigator resource if one exists for the given path or creates a new one. The naming and permission rules that I outlined above for also apply.
After downloading this example and compiling the code, you can install the Navigator by following these simple steps.
Windows:
Files:
Download Source