Skip to main content
Participant
June 8, 2011
Question

Limit of 50 open PDFs in AIR?

  • June 8, 2011
  • 1 reply
  • 661 views

Created an AIR application using Flash Builder 4 and AIR 2.  Application opens numerous PDF documents and allows user to navigate between these documents.  Apparently there is a limit of 50 open PDF documents in AIR, then get an error message saying this limit is reached.  Please confirm this limit exists.  How can a Flex application get around this limit?  I was thinking of gathering handles and keeping track of them so that some PDF documents can be closed to make room for others, but this is klugy.

This topic has been closed for replies.

1 reply

Participating Frequently
June 8, 2011

Hi,

that is Reader plugin limitation itself not Adobe AIR (Air uses Adobe Reader as pluggable feature - it depends on it installed on system and there is api to detect that feature support with "pdfCapability" property of HTMLLoader). It is also affecting other 3rd party tools that are using pluggable Reader interface.

see for example:

http://forums.adobe.com/message/2128581

http://forums.adobe.com/message/2432520

What you could do:

#1

manage numbers of created instances - but as you noted that is clunky.

In addition I think you're eating system resources to have a pool of dozens of PDF readers

Instead you could use:

#2

combined pooling of PDF instances.

Why combined? to preserve memory you don't need to show actual PDF to user

- you have set of PDF (HTMLLoaders) instances in application pool and use them to load different documents

- because that nearly impossible for user to view all that content at the same time (readability) you could reuse instances to load different documents on demant

*and*

- here is a trick to minimize memory:

- once your HTMLLoader loads document - that is to be no longer used - you could take "screen shot" of it (that is current page) and re-use HTMLLoader instance to load other content.

To let user know what is loaded you show bitmap image in e.g. clickable container of your choice (you could have tile group that display pages )

How to get screen shot:

- add Event.COMPLETE to your html loader so it fires when pdf loads and then e.g.:

protected function htmlCompleteHandler(completeEvent:Event):void

{

     var bd:BitmapData = new BitmapData(html.width, html.height);

     bd.draw(html.htmlLoader);

     var image:Image = new Image();

     image.width = bd.width;

     image.height = bd.height;

     image.source = bd;

}

I think that you could even transform what is drawn to have small and nice thumbnails of non-active documents that way.

kind regards,

Peter

eodonAuthor
Participant
June 26, 2011

Thanks for the suggestions.  In particular, I'm looking at using the thumbnail idea.

The application has many PDF documents spread among various components.  A problem I'm running into is how to close a document open in one component when the user opens a document in another component.  It seems that I need to be able to remove children in different components that may not be in scope of the component the user is interacting with.  Any suggestions on how the HTMLLoader objects can be tracked and closed across components would be helpful.

Also, is there a good event that can be used to check when a user comes back to a closed PDF and so allow the document to be reloaded?  This application has more than a hundred states and I was thinking of keeping track of which states open which PDFs, but it's getting complicated.  Once closed, coming back to a component state with a PDF does not automatically reload the PDF.