Discover Master of Alchemy, our first iPad/iPhone and iPod touch game!

Follow Me


Forum's topics

Latest Files


Top Rated


Photo Gallery

Alessandro Crugnola on May 28, 2010 in actionscript , purePDF

Read pdf metadata with purePDF

In the recent purePDF update I've added the getInfo method to the PdfReader class, this allows to extract pdf informations once the document has been parsed.

Here's an example:
var pdf: ByteArray = URLLoader( ).data as ByteArray;
var reader: PdfReader = new PdfReader( pdf );
reader.addEventListener( Event.COMPLETE, onReadComplete );

function onReadComplete(event:Event):void
	var map: HashMap = reader.getInfo();
	for( var iterator: Iterator = map.keySet().iterator(); iterator.hasNext(); )
		var key: String =;
		trace( key + ": " + map.getValue( key ) );

In this way all the document's metadata will be traced (Author, Creation Date, Title, Subject, etc..)
In order to extract the field directly simply use:
function onReadComplete(event:Event):void
	var map: HashMap = reader.getInfo();
	trace( "Author: " + map.getValue( "Author" ) );
	trace( "Creator: " + map.getValue( "Creator" ) );
	trace( "Title: " + map.getValue( "Title" ) );
Download the latest purePDF here.


Bookmark and Share


Tags: Metadata , PDF , PdfReader , purepdf 


I'm not able to use this code (cf. Can you explain what exactly is "" because if i load a classique urlrequest, i have the same error i explain in google issue... Thanks in advance! sam

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)

Type the characters you see in the picture above.



TrackBack URL for this entry: