PdfReader for purePDF

Recently I’ve update purepdf adding PdReader.

Using PdfReader an existing pdf document can be opened and parsed. Later I will also port the PdfStamper which will allow to modify existing pdf documents.
Currently I’ve posted 3 simple examples about the PdfReader:
  1. Extract bookmarks
  2. Extract text
  3. Extract images
  4. ExtractTextPDF.air (air application): browse for local pdf documents and display pages contents
Currently the reader has some limitations (such as it cannot open crypted documents) and it’s not fast enough, but I hope to optimize it in the future.

mm.cfg revealed!

I’ve just discovered an unbelievable post by Jean-Philippe Auclair with ALL the undocumented options of the mm.cfg file!

Really interesting in particular AS3Trace and AS3Verbose (and what is AS3Turbo anyway?). Also TraceOutputBuffered could be useful for all swf with uncommented trace calls 🙂

By the way, this is the list of features he discovered (follow the link above for detailed information on each command):
  • AllowUserLocalTrust
  • AS3AllocationTracking
  • AS3AutoStartSampling
  • AS3CSE
  • AS3DCE
  • AS3DynamicProfile
  • AS3MIR
  • AS3Sampling
  • AS3SSE
  • AS3StaticProfile
  • AS3Trace
  • AS3Turbo
  • AS3Verbose
  • AssetCacheSize=X
  • AutoUpdateDisable
  • AutoUpdateInterval
  • AutoUpdateVersionUrl
  • AVHardwareDisable
  • CodeSignLogFile
  • CodeSignRootCert
  • Convert8kAnd16kAudio
  • CrashLogEnable
  • DisableAVM1Loading
  • DisableDeviceFontEnumeration
  • DisableIncrementalGC
  • DisableMulticoreRenderer
  • DisableNetworkAndFilesystemInHostApp
  • DisableProductDownload
  • DisableSockets
  • DisplayGPUBlend
  • EnableIncrementalValidation
  • EnableLeakFile
  • EnableSocketsTo
  • EnableSocketsTo
  • EnableSocketsTo
  • EnforceLocalSecurityInActiveXHostApp
  • ErrorReportingEnable
  • FileDownloadDisable
  • FileUploadDisable
  • ForceGPUBlend
  • FrameProfilingEnable
  • FullScreenDisable
  • GCStats
  • GPULogOutputFileName
  • HeapProfilingAS3Enable
  • LegacyDomainMatching
  • LocalFileLegacyAction
  • LocalFileReadDisable
  • LocalStorageLimit
  • LogGPU
  • MaxWarnings
  • OverrideGPUValidation
  • OverrideUserInvokedActions
  • PolicyFileLog
  • PolicyFileLogAppend
  • PreloadSwf
  • PreloadSwf
  • ProductDisabled
  • ProductDownloadBaseUrl
  • ProfileFunctionEnable
  • ProfilingOutputDirectory
  • ProfilingOutputFileEnable
  • RendererProfilingEnable
  • RTMFPP2PDisable
  • RTMFPTURNProxy
  • ScriptStuckTimeout
  • SecurityDialogReportingEnable
  • SuppressDebuggerExceptionDialogs
  • ThirdPartyStorage
  • TraceOutputBuffered
  • TraceOutputFileEnable
  • TraceOutputFileName
  • UseBrokerProcess
  • WindowlessDisable

Flash alpha GradientMatrix to PDF using purePDF

One of the most hard thing to traslate when creating pdf documents from existing flash movies is indeed the gradient matrix.

Not only because pdf and flash have 2 different coordinates system and because the gradient matrix is applied in 2 different ways, but also if you want to convert gradient with transparent colors inside.
Let me say that I’ve encountered the same issue Mario posted here, even if I made a little modification to his solution: GradientMatrix.as
This is the swf example. Click on the sprite to start the animation. It will rotate and translate both the sprite and its gradient matrix, then click again to stop the animation and create the pdf file at that frame.
SWF HERE
In order to create the correct gradient matrix with the right position and rotation in purePDF I’ve used the PdfShading.complexAxial static method in this way:
var cb_shading: PdfShading = PdfShading.complexAxial( writer, top_left.x, top_left.y, top_right.x, top_right.y, cb_colors, cb_ratios, true, true );

then for the alpha masking I’ve created a PdfTransparencyGroup applied to the alpha mask.

You can see my solution (which probably is not the best one, but it’s the one I discovered for now) in the code below.
[kml_flashembed movie=”/wp-content/uploads/2010/02/ExampleColorGradient2.swf” height=”300″ width=”400″ /]

Continue reading

purePDF, a complete actionscript PDF library

PurePDF is a complete library for creating PDF documents using actionscript 3 ( targeted for flash player 10 ).
The project is actually hosted on google code.

This is is a porting I’ve made of the famous java iText library ( version 4.2 ) by Bruno Lowagie into pure actionscript 3.0 (with some little modifications).
iText ( and purePDF ) has tons of features for create and manipulate pdf documents. A quick list of the features actually implemented into purepdf:

  • pdf viewers display options
  • alpha transparency, blend modes
  • layers
  • arabic RTL writing
  • support for pdf text rendering ( example )
  • tables ( nested tables, page split tables, table with images, etc…)
  • slide show ( page transitions )
  • annotations, comments, file annotations
  • patterns, shadings patterns (linear and gradient), spot colors, rgb color and cmyk color
  • linear and radial gradients with alpha ( example or example 2 )
  • forms (user input forms, textfields, combo box, list, checkbox)
  • paragraphs, phrases, chunks for text manipulation, chapters, lists…
  • images (jpeg, png, animated gif, tif, bitmapdata ) and image patterns
  • basic and advanced paths
  • afm, otf, pfm, ttc and ttf fonts (embedded and not embedded)
  • metadata, page header and footers
  • external, internal links
  • barcodes creation ( ean-ucc 13, ucc-12, ean-ucc-8, upc-e, pdf 417, ean supplements) ( example )
  • unicode, cjk fonts and text
  • file attachments
  • javascript ( example )
  • multi column text
  • Embedded movies ( example )
  • Vertical text ( see this example )
  • and many other features…

You can take a look at this PDF document (self generated using actionscript reflection) with the purePDF APIs.

Other actionscript libraries I’ve used for this project are: fzlib, as3corelib, ashashmap, alchemy, as3-commons.

You can both download the library from source code and compile it yourself ( see at the Installation guide ) or download the precompiled swc files from the project’s download section.

Moreover there are actually a lot of examples to explain all the library features and for a quick guide. You can find them listed and updated here. In General refers to the project wiki for all the updated examples/howtos and the project updates.

update: here you can find the updated online api documentation