Skip to content

Alessandro Crugnola

programmer by pure chance

  • Categories
    • actionscript
    • amfphp
    • android
    • aviary
    • firefox
    • flash media server
    • flex
    • general
    • iphone
    • php
    • purePDF
    • python
    • scripting languages
    • SEPY
  • Projects
    • purePDF
    • FontReader
    • PHP SWF Reader
    • AS3Gettext
    • Shared Object Reader
    • Flash Flickr SliderShow
  • Firefox extensions
    • Flash Tracer for Firebug
    • Flash Switcher
  • Android Applications
    • Photo Editor By Aviary
  • My GitHub
    • Android UIGestureRecognizer
    • Android JNI Support
    • ImageViewZoom
    • Material Bottom Navigation
    • Android Tooltip
    • Floating Action Menu
    • Android Exif Extended
    • More..
HomeRead pdf metadata with purePDF

Read pdf metadata with purePDF

May 28, 2010June 30, 2010 Alessandro Crugnola actionscript, purePDFant, bytearray, metadata, pdf, purePDF, reader
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( event.target ).data as ByteArray;
var reader: PdfReader = new PdfReader( pdf );
reader.addEventListener( Event.COMPLETE, onReadComplete );
reader.readPdf();

function onReadComplete(event:Event):void
{
	var map: HashMap = reader.getInfo();
	for( var iterator: Iterator = map.keySet().iterator(); iterator.hasNext(); )
	{
		var key: String = iterator.next();
		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.

Post navigation

← Amethyst Actionscript editor
Aviary new bird, Roc Music Creator! →

Search

Popular

  • Widget: SlidingDrawer top to bottom 378 views
  • AS3 SoundMixer, my turn 253 views
  • ImageView Zoom and Scroll 196 views
  • Android – Create a Vignette effect 47 views
  • Shared Object Reader 46 views
  • Reading resource files from native code 45 views
  • Simply Note 45 views
  • purePDF 43 views

Recents

  • Photoshop Extension: Opacity Editor
  • Why it’s hard to find Android developers
  • Android – Create a Vignette effect
  • Floating Action Menu for Android
  • java.lang.UnsatisfiedLinkError workaround
  • More Picasso changes
  • Forking Picasso
  • Obtain styleable fields at runtime

Instagram

Load More...Follow on Instagram

Tags

actionscript adobe amfphp android apollo aviary beta bug bytearray compiler component contest debug eclipse ecma editor extension firefox flash flash 8 flash 9 flash tracer flex game github holidays internet explorer iphone java linux macromedia mtasc mysql opensource osx parser pdf php purePDF python regular expression sdk SEPY windows xml
Proudly powered by WordPress | Theme: Big Brother by WordPress.com.