Main

August 31, 2009

Turning on trace() for the Flash Player in Acrobat 9

If you've started to work with the new Acrobat ActionScript API for creating custom PDF Portfolio navigators you'll quickly come to a point where you may want to do some debugging. Unfortunately, the current Acrobat 9 application doesn't provide a true debugging environment. However, you can see errors and get a pretty good understanding of what's going on by simply outputting some trace() statements. Error reporting and trace() is off by default but you can turn it on by adding the following settings to the Windows registry:


Continue reading "Turning on trace() for the Flash Player in Acrobat 9" »

Bookmark and Share
permalink.gif

| Comments (0)

August 17, 2009

Joel's PDF Portfolio Utilities Updated

I recently updated "Joel's PDF Portfolio Utilities" to include the ability to combine multiple portfolios into one.

 

Combine All Open PDF Portfolios:
This script will look at all of the open PDF files to see which are PDF Portfolios meaning the collection object returns a value. Then, it will combine all the open PDF Portfolios into a single new PDF Portfolio that contains all the files and metadata from the sources. This version will not maintain folder structure so it's best to use on PDF Portfolios that do not contain folders. Creating a new PDF Portfolio through app.newCollection() is a privileged function so you'll need to wrap it in a trustedFunction to make it work, the code snippet below shows how.


Continue reading "Joel's PDF Portfolio Utilities Updated" »

Bookmark and Share
permalink.gif

| Comments (0)

August 13, 2009

Acrobat 9.1 SDK Update Released

The Navigator SDK for PDF Portfolio Layouts is finally out of beta and is available for download. Samples, updated documentation and other resources are available in the Acrobat 9.1 SDK August 2009 update. You can get it by following the link below.


Continue reading "Acrobat 9.1 SDK Update Released" »

Bookmark and Share
permalink.gif

| Comments (2)

June 5, 2009

ZIP files in PDF Portfolios

Why can't I add ZIP files to a PDF Portfolio?

Ok - so this isn't exactly a developer topic but the question has popped up in my inbox with enough regularity that I thought I'd write an article about it.

You can try to add a ZIP file to a PDF Portfolio but then you see the warning dialog to the right. If you choose to click "OK", the ZIP file will be added to the PDF Portfolio. Great!

Actually - not so great. No one will be able to open or extract the ZIP from the Portfolio unless they hack their registry (Windows) or plist (Mac). So even though you were able to add the .ZIP file, it's of very little use if you plan on sharing that PDF Portfolio with a broader audience.

The list of embargoed file types is a lot longer than just ZIP. You see the same warning if you attach EXE, VBS, BAT, DLL, or JS because they are associated with malicious programs, macros, and viruses that can damage your computer; the list goes on and on.

PDF Portfolios use ZIP Compression:

So here's the good news, when you add a folder full of files to a PDF Portfolio guess what happens. That's right - Acrobat uses ZIP compression to bundle them up. You don't actually need to go through the process of zipping a folder full of files and then add the ZIP to the Portfolio. Just skip the zipping step add the folder directly to the Portfolio. The file size of the PDF Portfolio and a ZIP with the same set of files in it is virtually identical plus you get a great Flash UI to help people find what they need inside the Portfolio.

Bookmark and Share
permalink.gif

| Comments (1)

May 22, 2009

Part 7 of The Customizing PDF Portfolio Layouts Series posted

This is it! The last in my seven part series on developing custom PDF Portfolio layouts has been posted. This one discusses adding files and resources. Jump on over to Part 7 and take a look.

What now? You didn't really think there would be only seven did you? I'm just getting started. Now that you have a chance to understand the basics with simple (and frankly.... ugly) examples, it's time to make something functional and pretty.

I'm thinking about writing a few "utility" navigators and have a few ideas of my own but am interested in hearing from my dear readers as well so please comment with your ideas. Here's a short list of what I've been thinking about.

Drag-n-Drop Ordering Wouldn't it be great if you could just drag your files around into the order that you want them to appear? I've got some ideas on how to do that and actually have the order stick in other navigators that respect the sort order.
Advanced Folder Navigation By default, folders appear as items but I want to be able to build a tree just like some of the Adobe ones do and then be able to drag-n-drop files between.
A Vertical Navigator "Bar" I'm thinking something slim and sleek that sits on the side and uses the splitter to give you a nice big preview window but easily navigate the PDF Portfolio.
User Defined Thumbnails Add your own thumbnails to the files that don't auto-generate them.

In addition to the utility navigators, I'm going to try putting together a few more visually stunning examples with some cooler navigation and animations so stay tuned.

Bookmark and Share
permalink.gif

| Comments (0)

May 19, 2009

Part 6 of The Customizing PDF Portfolio Layouts Series posted

The sixth in my seven part series on developing custom PDF Portfolio layouts has been posted. This one discusses sorting.

Jump on over to Part 6.
Bookmark and Share
permalink.gif

| Comments (0)

May 3, 2009

Part 5 of The Customizing PDF Portfolio Layouts Series posted

The fifth in my seven part series on developing custom PDF Portfolio layouts has been posted. This one discusses working with document metadata.


Jump on over to Part 5.

Bookmark and Share
permalink.gif

| Comments (0)

April 24, 2009

Part 4 of The Customizing PDF Portfolio Layouts Series posted

The fourth in my seven part series on developing custom PDF Portfolio layouts has been posted. This one discusses working with thumbnails.

Jump on over to Part 4.

As a reminder, here are the topics with links to the what I have posted so far

The "Customizing PDF Portfolio Layouts" Series

Coming soon I'll have...

  • Part 5: Working with Metadata
  • Part 6: Sorting
  • Part 7: Adding Resources and Files


Bookmark and Share
permalink.gif

| Comments (0)

March 5, 2009

Part 3 of The Customizing PDF Portfolio Layouts Series posted

The third in my seven part series on developing custom PDF Portfolio layouts has been posted. This one discusses previewing files and navigating folders. By the end of the article, you'll have the code required to build a navigator based on just about any data driven Flex control. I'll also be adding a feedback section to all three parts so you'll have a chance to help me improve these articles in the future. So - jump on over to Part 3.
Bookmark and Share
permalink.gif

| Comments (0)

February 26, 2009

The Customizing PDF Portfolio Layouts Series

I just posted the first two of a seven part series that discusses writing custom PDF Portfolio Layouts or "Navigators" as we call them in "Acrobat Developer Land". I'll also take this opportunity to launch the PDF Developer Junkie Web.Blogs are great for all kinds of things like news and short articles or even a series of articles. However, sometimes, organizing articles in reverse chronological order just isn't helpful. So - I created a web site to house all of my "How-to" articles.

If you've been interested in learning about how to create your own Navigators and you've got some ActionScript 3 skills, jump into the links below and get started. Each article has a sample Flex project attached as well as the Acrobat ActionScript SDK (prerelease version).

The "Customizing PDF Portfolio Layouts" Series

Coming soon I'll have...

  • Part 5: Working with Metadata
  • Part 6: Sorting
  • Part 7: Adding Resources and Files
Bookmark and Share
permalink.gif

| Comments (0)

January 19, 2009

My presentations from MAX are available on AdobeTV

Two of my presentations covering PDF Portfolios and the new Rich Media Annotations are now available on AdobeTV. Each one is about an hour long. These presentations were recorded live so if the "um"s and "ah"s start making you crazy, you can get the same information by going to my home page and watching "Developing with ActionScript for Adobe Acrobat 9" located in the "Recorded Presentations:" section in the left column.

Flash in Acrobat: Part 1
Customizing PDF Portfolio Layouts

Flash in Acrobat: Part 2
Rich Media Annotations

Bookmark and Share
permalink.gif

December 16, 2008

All work and no play...

PDF Portfolios make the perfect companion for your holidays - downtime at the relatives, waiting for your delayed airplanes, or entertaining the kids. Why? Because we worked with Flash Games developers to create PDF Portfolios of their games.These portfolios are also great examples of what you can do with our new ActionScript API for Acrobat 9. So put down that Wii controller and go old school.

Download the game portfolios
Learn more about developing PDF Portfolio Navigators

Bookmark and Share
permalink.gif

| Comments (0)

October 21, 2008

Joel's PDF Portfolio Utilities

For those of you interested in scripting PDF Portfolios with the new Acrobat JavaScript "Collection" Object, I've created a few example utility scripts to demonstrate the features of the new object.

There are four basic utility scripts bundled into the one, each one demonstrates a different aspect of working with PDF Portfolios or what the API calls "Collections".

UPDATE: Combine All Open PDF Portfolios:
This script will look at all of the open PDF files to see which are PDF Portfolios meaning the collection object returns a value. Then, it will combine all the open PDF Portfolios into a single new PDF Portfolio that contains all the files and metadata from the sources. This version will not maintain folder structure so it's best to use on PDF Portfolios that do not contain folders. Creating a new PDF Portfolio through app.newCollection() is a privileged function so you'll need to wrap it in a trustedFunction to make it work, the code snippet below shows how.

Note: trustedFunction is available only during batch, console and in folder level JavaScripts. Because it is used to elevate the privilege level of the function, you can't use it from inside a PDF file.

trustedNewCollection = app.trustedFunction (
function()
{
app.beginPriv(); // Explicitly raise the privilege
var d = app.newCollection();
app.endPriv();
return d;
}
)

newPortfolio = trustedNewCollection();

Copy PDF Document Properties to Portfolio Fields:
This script will run through all of the Data Objects in the collection and, for every PDF that it finds, will use the new "setFieldValue" method to copy each item in the "doc.info" dictionary to a collection metadata field, creating new fields as necessary.

Export Portfolio Metadata to Console:
This script will run through each item in the collection and use the "getFieldValue" method to create a comma separated values stream from the collection metadata. The script will output to the JavaScript console, you can copy the text from there and massage the data in another application if you need to.

Set Portfolio Initial View:
This script will create a fly-out menu that allows you to set the "initialView" of the collection to "Tile" (Basic Grid), "Detail" (List View), or "Hidden" which will show the cover sheet rather than the Flash-based Portfolio interface.

These are just examples and I haven't done anything that anyone could rightly call testing so use these to learn the new parts of the API not for actual work.

Windows Installation:
1. From Windows, select "Start" then "Run". Paste the following line into the text box and press enter

%USERPROFILE%\Application Data\Adobe\Acrobat\9.0\JavaScripts

2. Drag the .js file to that directory
3. Restart Acrobat if it's running.

Mac Installation:
1. Find your version of the directory below. The red parts of the path will change based on your system.

/Macintosh HD/Users/joelgeraci/Library/Application Support/Adobe/Acrobat/9.0_x86/JavaScripts/

2. Drag the .js file to that directory
3. Restart Acrobat if it's running.

You'll see a new menu under "Document" called "Joel's Portfolio Utilities"

Download Joel's Portfolio Utilities

Bookmark and Share
permalink.gif

| Comments (1)

September 17, 2008

How Do You Deal with Large PDF Portfolios?

Actually, this post can apply to any large PDF that has any objects in it that might prevent the normal "Fast Web View" feature in Acrobat or Reader from displaying the PDF in the browser quickly.

Background:
Saving a PDF with "Fast Web View" restructures a PDF document for page-at-a-time downloading (byte-serving) from web servers. With Fast Web View, the web server sends only the requested page, rather than the entire PDF. This option is especially important with large documents that can take a long time to download from a server. For PDFs with static content like text, line art, and images this works great. You can browse through a PDF that's thousands of pages very quickly without downloading the whole thing first.

"Fast Web View", while functioning correctly, may not be effective when loading PDF files containing large objects such as embedded videos or file attachments. To maintain backward compatibility, a PDF Portfolio is basically a PDF with a bunch of attachments and some extra stuff in the catalog object. When these kinds of files are encountered, Acrobat or Reader appears to hang when in reality it's just reading a really big chunk of data from the server.

So back to the original question...

How Do You Deal with Large PDF Portfolios?
There are a number of ways, but here's one that's ridiculously easy if you have administrator rights to an Apache web server or even just a directory on it. By the way, this solution has nothing to do with Acrobat, Reader or PDF, it's just basic server management.

Byte-Serving the PDF is fast. But... it's not nearly as fast as just forcing the whole PDF to download rather than opening it in the browser. To do this, set the Content-Disposition to "attachment" for that file. On any web server, you can do this by serving the PDF up via a script and setting Content-Disposition in the HTML headers but with Apache it's easier than all that. This may also work on other servers but I haven't tried it.

I created two separate directories on my server. One called "view" and one called "download". In the "download" directory, I added a file called ".htaccess" that allows me to customize the server response to any request for a file from that directory. It contains a single line of code.

Header set Content-Disposition "attachment"

This allows me to create links to PDF files in the "download" directory and the end user will be prompted to download the file rather than have it open inside the browser. The following two links will behave very differently even though the <a href=> tag is basically the same and the PDFs are identical except that they are being served up from different directories. If you hover over the link, you'll be able to see the destinations. The behavior is determined by the directory on the server, not any script or parameter in the <a href=> tag.

  This PDF Opens in the browser - It'll look like it hangs your browser but if you wait long enough it'll show up.

This PDF will download to your desktop - You can open it once it's finished. Personally, I think this is a better experience when "Fast Web View" won't do the trick.

Bookmark and Share
permalink.gif

| Comments (0)

August 20, 2008

Acrobat 9 SDK Now Available

The Acrobat 9 SDK is posted to the Acrobat Developer Center for public download.

But wait, there's more. New in Acrobat 9, we've added a livedocs version of the documentation. Now you'll be able to provide feedback on most topics and even submit corrections or report bugs. Now's the chance to show off your Kung-Fu skills and contribute to the developer community. Comments will be monitored so don't expect them to show up right away but they will show up.

Flex Developer Alert!
Acrobat 9 Custom Navigator SDK is available in Pre-release:

Use Flex and your ActionScript skills to create SWF interfaces (Navigators) for PDF Portfolios using the new ActionScript APIs for Acrobat 9. Check out my previous post to see some of the possibilities. The good news is, the Custom Navigator SDK is all ActionScript, you don't need to know anything about the rest of the Acrobat SDK to get started.

Use this PDF form to request access to the prerelease program.

Bookmark and Share
permalink.gif

August 12, 2008

Web Page to Detect Acrobat or Reader Version

If you've been reading my series on PDF Portfolios and Backward Compatibility, you'll know that there are several methods for ensuring a good experience for both users of earlier versions of Acrobat or Reader and for users who have upgraded to version 9. The simple PDF file on the right can be used in the simplest cases when you want users to actually decide for themselves if they want to upgrade or not. The PDF is a one page file and I've used the embed tag to place it on this page.You can download it and look at the JavaScripts to see how it works.

PortfolioBadge.pdf

Bookmark and Share
permalink.gif

| Comments (2)

August 11, 2008

Reliable Intra-Portfolio Link Creation

Creating links from one PDF in a PDF Portfolio to another PDF in the same PDF Portfolio is really pretty simple but the "Preview" window is not the place to do it. The Preview Window does give you access to a few of the editing tools in Acrobat such as the commenting and link tools but, in my experience so far, saving your changes has proven to be unreliable. Don't worry, there's a work-around and I've already filed a bug report.

You're much better off clicking the "Open" button to bring the file into the full Acrobat User Interface and creating your interactivity there.

Now you'll be able to insert a link. In the link dialog, be sure "Go to a page view" is selected even if you are opening another file in the PDF Portfolio.

You'll see the dialog below.

Your PDF Portfolio should still be open in a separate window, switch to it. Using the Portfolio navigation tools, go to the document you want to link to and click "Set Link". You should be back where you started.

Be sure to save the file.


Bookmark and Share
permalink.gif

| Comments (2)

PDF Portfolios and Backward Compatibility - Part 4

This entry is the second post on ensuring the user sees your PDF Portfolio in all it's Flashy glory, that is, forcing it to be viewed in Acrobat or Reader 9. Earlier posts on this topic can be read here Part 1, Part 2, and here Part 3.

In the last article, we used some JavaScript to detect the version of Acrobat or Reader being used and close the document if the viewer version number was lower than 9. Thus, ensuring that the document could only be viewed in a version of ACrobat or Reader that is capable if displaying DF Portfolios correctly. This works fine when the document is being opened from the desktop or otherwise local file. Unfortunately, for security reasons, this.closeDoc() is not permitted to execute while a PDF is being viewed in the browser so the user needs to download the PDF and then open it.

With particularly large PDF Portfolios, this can potentially create a bad user experience when the user spends several minutes downloading a PDF only to find that they then need to go spend more time downloading a new Reader in order to view it. This article will discuss how to redirect the browser based on the version of Acrobat or Reader being used.

Redirecting the Browser Based on Viewer Version

The "right" way to do this is, unfortunately, unreliable. Ideally, you could have a PDF load into a small 1 x 1 pixel <DIV> and have Acrobat or Reader tell the browser what version it is. There's enough of an API in Acrobat and Reader to make communicating with the host easy but there are too many dependencies on the most popular browsers out there to make this technique reliable. Instead, we'll load a small, one page PDF into the browser and use it along with a parameter stored in the URL to redirect the browser to the actual destination.

The example code below will detect the parameter string after the "?" in the URL to the redirecting PDF and then launch that URL if the version number if greater than or equal to 9 sending the browser to the Reader download page if not. To use the script, simply add code to the Document JavaScripts outside of any function so that it runs every time the document opens. If the document is not running in a browser, the first "if" statement will return false and the script won't run. The code might look like this.

if (this.external)
{
q = this.URL.lastIndexOf("?")+1
destination = this.URL.substring(q)
if (app.viewerVersion >= 9)
{
//add a message here to tell the user what's happening
app.launchURL(destination)
}
else
{
//add a message here to tell the user what's happening
app.launchURL("http://www.adobe.com/reader")
}
}

Then you place the redirecting PDF on your site somewhere and create a link to it. In the link, add a "?" then the path to the actual destination. A live example URL and reference implementation is below.

  Example File

http://joelgeraci.com/adobe/PDFP/PDFPredirect.pdf?destination.html

Note: Depending on the security settings and version of Acrobat or Reader being on the client machine, the end user may see any number of security warning dialogs when the JavaScript tries to redirect the browser. You may want to add something to the link to alert people of that fact.

Bookmark and Share
permalink.gif

| Comments (0)

August 7, 2008

PDF Portfolios and Backward Compatibility - Part 3

The first two parts of this discussion focus on backward compatibility and creating a good user experience. If you are interested in that please read the earlier posts here Part 1 and here Part 2. This entry focuses on ensuring the user sees your PDF Portfolio in all it's Flashy glory, that is, forcing it to be viewed in Acrobat or Reader 9.

We can use Acrobat JavaScript to control what happens when the document is opened. The application property "app.viewerVersion" will return the version number of Acrobat or Reader being used. Then we can use an "if" statement to branch the code. If the viewer number is too low, we can use "this.closeDoc()" to shut down the file. You'll want to add this code to the Document JavaScripts outside of any function so that it runs every time the document opens. The code might look like this.

if (app.viewerVersion < 9)
{
//Add your own message or something here.
this.closeDoc();
};

Unfortunately, for security reasons, this.closeDoc() is not permitted to execute while a PDF is being viewed in the browser. To get around this limitation, I've also created a special link to the PDF that will prevent it from opening in the browser and ask the user to download it instead. This is also a great little trick to use for large PDF Portfolios that may take a long time to open in the browser.

The example file below will only stay open in Acrobat or Reader 9. If it is opened in an earlier version a dialog box (right) that I authored in WindJack's AcroDialogs will appear explaining what's happening.

Example Portfolio

Bookmark and Share
permalink.gif

| Comments (0)

August 6, 2008

PDF Portfolios and Backward Compatibility - Part 2

This entry builds on concepts introduced in Part 1. Read it here: PDF Portfolios and Backward Compatibility - Part 1

Many document authors who created PDF Packages in Acrobat 8 used the cover sheet to help users navigate the files in the package. Unfortunately, they ran into difficulties creating as dynamic an interface as they'd like given the limitations of the link actions in Acrobat 8. Based on their feedback, we added the PDF Portfolio feature to Acrobat 9 which lets developers leverage the power of Flash to create highly branded, highly interactive experiences for their document's audience.

That said, many authors need their PDF content to be compatible with multiple versions of Acrobat. As mentioned in the previous article, the cover sheet can be replaced to create a more custom experience for users with earlier versions of Acrobat and Reader but that cover sheet can also serve as a navigational aide just like in Acrobat 8, it's just that the authoring process in Acrobat 9 is a little different.

In Acrobat 8, you had full editing capabilities on the cover sheet. You could add buttons, links, bookmarks and other multimedia. In Acrobat 9 you only get the link tool and even that is only accessible through the menu, you won't find it on the toolbar or the context menu.

To create an interactive cover sheet in Acrobat 9, follow the steps in the previous article to replace the default cover sheet then.

Add links to the PDF Portfolio cover sheet in Acrobat 9.

  1. Select View|Portfolio|Cover Sheet to show the cover sheet
  2. Select Tools|Advanced Editing|Link Tool to add links to the page
  3. Marquee over the area you want to be a link.
    In the image below, I used PhotoShop CS3 to open the three PDFs, saved them as images (rasterizing the vector art and type) and added them to my PDF by editing the cover sheet in Adobe Illustrator CS3 then added links on top of those image areas to simulate the actions in a PDF Portfolio Layout.
  4. When adding links to other documents in the same PDF Portfolio, choose "Go to a page view" as the link action then use the detail view of the portfolio to go to the file you want.
  5. After setting the link, you'll probably need to display the cover sheet again (Step 1)

  This example file will display like the image below in Acrobat and Reader 8...

... and in Acrobat and Reader 9, you'll see the normal PDF Portfolio view.

 

Bookmark and Share
permalink.gif

| Comments (0)

August 5, 2008

PDF Portfolios and Backward Compatibility - Part 1

If you haven't heard of PDF Portfolios yet, watch a recorded demo or read about the basic plumbing at "Acrobat 9 Portfolios" on "Spartacus of Acrobat" then come back here.

By default, PDF Portfolios created in Acrobat 9 will open in earlier versions of Acrobat and Reader and the PDF Portfolio will make the best use of the features available to it. When opened in version 8, the PDF Portfolio will act like a PDF Package and in version 7 and 6, the contents will appear as attachments. Since the portfolio layout is actually a SWF file and only Acrobat 9 can "play" it, earlier versions will display a "Cover Sheet". The "Cover Sheet" was introduced in Acrobat 8 as part of the PDF Package concept and by default is a single page PDF that is used as a wrapper around a bunch of other content. However, in Acrobat 8, the cover sheet could also be a PDF of your own choosing with links and other navigational aides that you specify during the package creation process. This functionality has been replaced by the PDF Portfolio layout concept in 9 and now you do not have the option of setting your own cover sheet during the assembly process. The new default cover sheet looks like the one below.It's not bad but you might want a more personalized experience for users that don't have the latest version. To customize the cover sheet, follow the instructions under the graphic.

Replacing the default cover sheet with your own.

  1. Create a PDF file with all of the information you want to convey to users of earlier versions of Acrobat

  2. Open the PDF Portfolio that you want to customize

  3. Select View|Portfolio|Cover Sheet from the menu. You should see the same thing as above.

  4. Select Document|Replace Pages and select the PDF that you just created and follow the rest of the dialog prompts.

  5. Save the file.

Now users of Acrobat or Reader version 9 will see the animated portfolio layout and users of earlier versions will see your custom cover sheet.

Setting the default cover sheet.

Replace the file called "coversheet.pdf" in your version of this directory "C:\Program Files\Adobe\Acrobat 9.0\Acrobat\DocSettings\CombineFiles\ENU" and that will be the new default.

Bookmark and Share
permalink.gif

| Comments (3)