<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>pdf &#8211; Alessandro Crugnola &#8211; sephiroth.it</title>
	<atom:link href="https://blog.sephiroth.it/tag/pdf/feed/" rel="self" type="application/rss+xml" />
	<link>https://blog.sephiroth.it</link>
	<description>programmer by pure chance</description>
	<lastBuildDate>Thu, 17 Feb 2011 19:00:06 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	

<image>
	<url>https://blog.sephiroth.it/wp-content/uploads/2019/03/cropped-sepy-big-32x32.png</url>
	<title>pdf &#8211; Alessandro Crugnola &#8211; sephiroth.it</title>
	<link>https://blog.sephiroth.it</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Multipage TIF to PDF</title>
		<link>https://blog.sephiroth.it/2011/02/17/multipage-tif-to-pdf/</link>
					<comments>https://blog.sephiroth.it/2011/02/17/multipage-tif-to-pdf/#comments</comments>
		
		<dc:creator><![CDATA[Alessandro Crugnola]]></dc:creator>
		<pubDate>Thu, 17 Feb 2011 19:00:06 +0000</pubDate>
				<category><![CDATA[purePDF]]></category>
		<category><![CDATA[multipage]]></category>
		<category><![CDATA[pdf]]></category>
		<category><![CDATA[tif]]></category>
		<guid isPermaLink="false">http://blog.sephiroth.it/?p=1503</guid>

					<description><![CDATA[Recently I&#8217;ve continued the porting of iText adding the support for a new image type: multipage tif. The only problem with this update is that actually it&#8217;s really slow and probably with very complex image files it can hang the player for too long. Probably I should modify the ImageElement.getInstance method and make it asynchronous &#8230; <a href="https://blog.sephiroth.it/2011/02/17/multipage-tif-to-pdf/" class="more-link">Continue reading <span class="screen-reader-text">Multipage TIF to PDF</span></a>]]></description>
										<content:encoded><![CDATA[<p>Recently I&#8217;ve continued the porting of iText adding the support for a new image type: <a href="http://en.wikipedia.org/wiki/Tagged_Image_File_Format" target="_blank">multipage tif</a>.</p>
<p>The only problem with this update is that actually it&#8217;s really slow and probably with very complex image files it can hang the player for too long. Probably I should modify the <strong>ImageElement.getInstance</strong> method and make it asynchronous in order to prevent flash player to freeze&#8230;</p>
<p>Anyway, the current trunk version of purePDF can handle TIF image and here a simple code example:</p>
<p><code lang="actionscript"><br />
package<br />
{<br />
    import flash.display.Sprite;<br />
    import flash.events.Event;<br />
    import flash.events.MouseEvent;<br />
    import flash.events.TimerEvent;<br />
    import flash.net.FileReference;<br />
    import flash.utils.ByteArray;<br />
    import flash.utils.Timer;<br />
    import flash.utils.getQualifiedClassName;</p>
<p>    import org.purepdf.elements.RectangleElement;<br />
    import org.purepdf.elements.images.ImageElement;<br />
    import org.purepdf.io.RandomAccessFileOrArray;<br />
    import org.purepdf.pdf.PageSize;<br />
    import org.purepdf.pdf.PdfDocument;<br />
    import org.purepdf.pdf.PdfViewPreferences;<br />
    import org.purepdf.pdf.PdfWriter;<br />
    import org.purepdf.pdf.codec.TiffImage;</p>
<p>    public class TestTIF extends Sprite<br />
    {<br />
        [Embed( source="assets/foxdog_multiplepages.tif", mimeType="application/octet-stream" )]<br />
        private var cls1: Class;</p>
<p>        private var document: PdfDocument;<br />
        private var writer: PdfWriter;<br />
        private var buffer: ByteArray;<br />
        private var filename: String;<br />
        private var index: int;<br />
        private var pages: int;<br />
        private var stream: RandomAccessFileOrArray;</p>
<p>        public function TestTIF()<br />
        {<br />
            super();<br />
			addEventListener( Event.ADDED_TO_STAGE, onAdded );<br />
		}</p>
<p>		private function onAdded( event: Event ): void<br />
		{<br />
            stage.addEventListener( MouseEvent.CLICK, onClick );<br />
        }</p>
<p>        private function createDocument( subject: String = null, rect: RectangleElement = null ): void<br />
        {<br />
            buffer = new ByteArray();</p>
<p>            if ( rect == null )<br />
                rect = PageSize.A4;<br />
            writer = PdfWriter.create( buffer, rect );<br />
            document = writer.pdfDocument;<br />
            document.addTitle( getQualifiedClassName( this ) );</p>
<p>            if ( subject )<br />
                document.addSubject( subject );<br />
            document.setViewerPreferences( PdfViewPreferences.FitWindow );<br />
        }</p>
<p>        private function onClick( event: Event ): void<br />
        {<br />
            filename = getQualifiedClassName( this ).split( "::" ).pop() + ".pdf";<br />
            var byte: ByteArray = new cls1();<br />
            stream = new RandomAccessFileOrArray( byte );<br />
            var image: ImageElement = ImageElement.getInstance( byte );<br />
            createDocument( "Multi page TIFF Image Example", PageSize.A4 );<br />
            document.open();<br />
            // add the first page to the document<br />
            document.add( image );<br />
            // get the total number of pages<br />
            pages = TiffImage.getNumberOfPages( stream );<br />
			trace("number of pages: " + pages );<br />
            // next page index to add to document (first page is 1)<br />
            index = 2;<br />
            var timer: Timer = new Timer( 100, 1 );<br />
            timer.addEventListener( TimerEvent.TIMER, onTimerComplete );<br />
            timer.start();<br />
        }</p>
<p>        private function onComplete(): void<br />
        {<br />
            stream.close();<br />
            document.close();<br />
            save();<br />
        }</p>
<p>        private function onTimerComplete( event: TimerEvent ): void<br />
        {<br />
            if ( index > pages )<br />
            {<br />
                onComplete();<br />
                return;<br />
            }<br />
            document.add( TiffImage.getTiffImage( stream, index ) );<br />
            index++;<br />
            Timer( event.target ).reset();<br />
            Timer( event.target ).start();<br />
        }</p>
<p>        private function save( e: * = null ): void<br />
        {<br />
            var f: FileReference = new FileReference();<br />
            f.save( buffer, filename );<br />
        }<br />
    }<br />
}<br />
</code></p>
<p><br class="spacer_" /></p>
<p>Here you can see the result <a href="https://blog.sephiroth.it/?attachment_id=1506">PDF file</a>.<br />
And here the input <a href="https://blog.sephiroth.it/?attachment_id=1507">TIF image</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.sephiroth.it/2011/02/17/multipage-tif-to-pdf/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>Read pdf metadata with purePDF</title>
		<link>https://blog.sephiroth.it/2010/05/28/read-pdf-metadata-with-purepdf/</link>
					<comments>https://blog.sephiroth.it/2010/05/28/read-pdf-metadata-with-purepdf/#respond</comments>
		
		<dc:creator><![CDATA[Alessandro Crugnola]]></dc:creator>
		<pubDate>Fri, 28 May 2010 07:14:53 +0000</pubDate>
				<category><![CDATA[actionscript]]></category>
		<category><![CDATA[purePDF]]></category>
		<category><![CDATA[ant]]></category>
		<category><![CDATA[bytearray]]></category>
		<category><![CDATA[metadata]]></category>
		<category><![CDATA[pdf]]></category>
		<category><![CDATA[reader]]></category>
		<guid isPermaLink="false">http://blog.sephiroth.it/?p=319</guid>

					<description><![CDATA[In the recent purePDF update I&#8217;ve added the&#160;getInfo method to the PdfReader class, this allows to extract pdf informations once the document has been parsed. Here&#8217;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: &#8230; <a href="https://blog.sephiroth.it/2010/05/28/read-pdf-metadata-with-purepdf/" class="more-link">Continue reading <span class="screen-reader-text">Read pdf metadata with purePDF</span></a>]]></description>
										<content:encoded><![CDATA[<div>In the recent purePDF update I&#8217;ve added the <strong>getInfo</strong> method to the PdfReader class, this allows to extract pdf informations once the document has been parsed.</p>
<div>Here&#8217;s an example:</div>
<div>
<pre name="code" class="js">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 ) );
	}
}</pre>
</div>
<div>
</div>
<div>In this way all the document&#8217;s metadata will be traced (Author, Creation Date, Title, Subject, etc..)</div>
<div>In order to extract the field directly simply use:</div>
<div>
<pre name="code" class="js">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" ) );
}</pre>
</div>
<div>Download the latest <strong>purePDF</strong> <a href="http://code.google.com/p/purepdf/downloads/list">here</a>.</div>
<div><img decoding="async" src="http://img.zemanta.com/pixy.gif?x-id=9614febd-ab17-4368-9cae-6155ac380111" alt="" /></div>
</div>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.sephiroth.it/2010/05/28/read-pdf-metadata-with-purepdf/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>WMF and BMP support in purePDF</title>
		<link>https://blog.sephiroth.it/2010/05/07/wmf-and-bmp-support-in-purepdf/</link>
					<comments>https://blog.sephiroth.it/2010/05/07/wmf-and-bmp-support-in-purepdf/#respond</comments>
		
		<dc:creator><![CDATA[Alessandro Crugnola]]></dc:creator>
		<pubDate>Fri, 07 May 2010 21:08:34 +0000</pubDate>
				<category><![CDATA[actionscript]]></category>
		<category><![CDATA[purePDF]]></category>
		<category><![CDATA[bitmap]]></category>
		<category><![CDATA[pdf]]></category>
		<category><![CDATA[wmf]]></category>
		<guid isPermaLink="false">http://blog.sephiroth.it/?p=298</guid>

					<description><![CDATA[Just a quick update on the project status.&#160;In the last 2 days I&#8217;ve added a couple of features to purePDF: BMP support ( see BitmapImageSample ) WMF Windows metafile support ( see WMFImageSample ) Now almost all basic image formats are supported.]]></description>
										<content:encoded><![CDATA[<p>Just a quick update on the project status. In the last 2 days I&#8217;ve added a couple of features to <a href="http://code.google.com/p/purepdf">purePDF</a>:</p>
<div>
<div>
<ul>
<li>BMP support ( see <a href="http://code.google.com/p/purepdf/source/browse/examples/src/BitmapImageSample.as">BitmapImageSample</a> )</li>
<li>WMF Windows metafile support ( see <a href="http://code.google.com/p/purepdf/source/browse/examples/src/WMFImage.as">WMFImageSample</a> )</li>
</ul>
</div>
</div>
<div>Now almost all basic image formats are supported.</div>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.sephiroth.it/2010/05/07/wmf-and-bmp-support-in-purepdf/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>PdfReader for purePDF</title>
		<link>https://blog.sephiroth.it/2010/02/27/pdfreader-for-purepdf/</link>
					<comments>https://blog.sephiroth.it/2010/02/27/pdfreader-for-purepdf/#respond</comments>
		
		<dc:creator><![CDATA[Alessandro Crugnola]]></dc:creator>
		<pubDate>Sat, 27 Feb 2010 18:59:41 +0000</pubDate>
				<category><![CDATA[actionscript]]></category>
		<category><![CDATA[air]]></category>
		<category><![CDATA[bookmarks]]></category>
		<category><![CDATA[images]]></category>
		<category><![CDATA[itext]]></category>
		<category><![CDATA[pdf]]></category>
		<category><![CDATA[purePDF]]></category>
		<guid isPermaLink="false">http://blog.sephiroth.it/?p=293</guid>

					<description><![CDATA[Recently I&#8217;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&#8217;ve posted 3 simple examples about the PdfReader: Extract bookmarks Extract text Extract images ExtractTextPDF.air (air application): browse for local pdf documents &#8230; <a href="https://blog.sephiroth.it/2010/02/27/pdfreader-for-purepdf/" class="more-link">Continue reading <span class="screen-reader-text">PdfReader for purePDF</span></a>]]></description>
										<content:encoded><![CDATA[<p>Recently I&#8217;ve update <a href="http://code.google.com/p/purepdf/">purepdf</a> adding PdReader.</p>
<div>Using PdfReader an existing pdf document can be opened and parsed. Later I will also port the <a href="http://api.itextpdf.com/com/itextpdf/text/pdf/PdfStamper.html">PdfStamper</a> which will allow to modify existing pdf documents.</div>
<div>Currently I&#8217;ve posted 3 simple examples about the <strong>PdfReader</strong>:</div>
<div>
<ol>
<li><a href="http://code.google.com/p/purepdf/source/browse/examples/src/test_reader/HelloWorldReader.as">Extract bookmarks</a></li>
<li><a href="http://code.google.com/p/purepdf/source/browse/examples/src/test_reader/HelloWorldReader.as"></a><a href="http://code.google.com/p/purepdf/source/browse/examples/src/test_reader/ExtractStream.as">Extract text</a></li>
<li><a href="http://code.google.com/p/purepdf/source/browse/examples/src/test_reader/ExtractStream.as"></a><a href="http://code.google.com/p/purepdf/source/browse/examples/src/test_reader/ExtractImages.as">Extract images</a></li>
<li><a href="http://ve.m5yn67dl.vesrv.com/wp-content/uploads/2010/02/ExtractTextPDF.air">ExtractTextPDF.air</a> (air application): browse for local pdf documents and display pages contents</li>
</ol>
<div>Currently the reader has some limitations (such as it cannot open crypted documents) and it&#8217;s not fast enough, but I hope to optimize it in the future.</div>
</div>
<div class="zemanta-pixie" style="margin-top: 10px; height: 15px;"><img decoding="async" class="zemanta-pixie-img" style="border: none; float: right;" src="http://img.zemanta.com/pixy.gif?x-id=099ac39b-84af-49c0-80ce-8814821fc8e5" alt="" /><span class="zem-script more-related more-info pretty-attribution"><script src="http://static.zemanta.com/readside/loader.js" type="text/javascript"></script></span></div>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.sephiroth.it/2010/02/27/pdfreader-for-purepdf/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Flash alpha GradientMatrix to PDF using purePDF</title>
		<link>https://blog.sephiroth.it/2010/02/10/flash-alpha-gradientmatrix-to-pdf-using-purepdf/</link>
					<comments>https://blog.sephiroth.it/2010/02/10/flash-alpha-gradientmatrix-to-pdf-using-purepdf/#comments</comments>
		
		<dc:creator><![CDATA[Alessandro Crugnola]]></dc:creator>
		<pubDate>Wed, 10 Feb 2010 14:41:19 +0000</pubDate>
				<category><![CDATA[actionscript]]></category>
		<category><![CDATA[purePDF]]></category>
		<category><![CDATA[gradient]]></category>
		<category><![CDATA[matrix]]></category>
		<category><![CDATA[opacity]]></category>
		<category><![CDATA[pdf]]></category>
		<guid isPermaLink="false">http://blog.sephiroth.it/?p=291</guid>

					<description><![CDATA[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. &#8230; <a href="https://blog.sephiroth.it/2010/02/10/flash-alpha-gradientmatrix-to-pdf-using-purepdf/" class="more-link">Continue reading <span class="screen-reader-text">Flash alpha GradientMatrix to PDF using purePDF</span></a>]]></description>
										<content:encoded><![CDATA[<p>One of the most hard thing to traslate when creating pdf documents from existing flash movies is indeed the <strong><a class="zem_slink freebase/en/gradient rdfa" title="Gradient" rel="ctag:means wikipedia" href="http://en.wikipedia.org/wiki/Gradient">gradient</a> matrix</strong>.</p>
<div>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 <strong>transparent colors</strong> inside.</div>
<div>Let me say that I&#8217;ve encountered the same issue <a href="http://www.quasimondo.com/archives/000689.php#000689">Mario posted here</a>, even if I made a little modification to his solution: <a href="/wp-content/uploads/2010/02/GradientMatrix.as">GradientMatrix.as</a></div>
<div>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.</div>
<div id="ExampleColorGradient2">SWF HERE</div>
<div>In order to create the correct gradient matrix with the right position and rotation in <a href="http://code.google.com/p/purepdf/">purePDF</a> I&#8217;ve used the <span style="font-family: Monaco, helvetica, hirakakupro-w3, osaka, 'ms pgothic', sans-serif; font-size: 12px;">PdfShading.complexAxial<span style="font-family: arial, helvetica, hirakakupro-w3, osaka, 'ms pgothic', sans-serif; font-size: 13px;"> static method in this way:</span></span></div>
<div>
<pre>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 );</pre>
<p>then for the alpha masking I&#8217;ve created a PdfTransparencyGroup applied to the alpha mask.</p>
</div>
<div>You can see my solution (which probably is not the best one, but it&#8217;s the one I discovered for now) in the code below.</div>
<div>[kml_flashembed movie=&#8221;/wp-content/uploads/2010/02/ExampleColorGradient2.swf&#8221; height=&#8221;300&#8243; width=&#8221;400&#8243; /]</div>
<div class="zemanta-pixie" style="margin-top: 10px; height: 15px;"><img decoding="async" class="zemanta-pixie-img" style="border: none; float: right;" src="http://img.zemanta.com/pixy.gif?x-id=d3bf64f1-e4a7-4489-aa00-664f80327378" alt="" /><span class="zem-script more-related more-info pretty-attribution"><script src="http://static.zemanta.com/readside/loader.js" type="text/javascript"></script></span></div>
<p><span id="more-291"></span><br />
And this is the code I used to do that (download <a href="/wp-content/uploads/2010/02/ExampleColorGradient2.as">ExampleColorGradient2.as</a>):</p>
<pre>package wiki
{
 import flash.display.GradientType;
 import flash.display.Graphics;
 import flash.display.Sprite;
 import flash.display.StageAlign;
 import flash.display.StageScaleMode;
 import flash.events.Event;
 import flash.events.MouseEvent;
 import flash.geom.Matrix;
 import flash.geom.Point;
 import flash.geom.Rectangle;
 import flash.net.FileReference;
 import flash.text.TextField;
 import flash.text.TextFormat;
 import flash.text.TextFormatAlign;
 import flash.text.engine.ElementFormat;
 import flash.text.engine.FontDescription;
 import flash.text.engine.TextBlock;
 import flash.text.engine.TextElement;
 import flash.text.engine.TextLine;
 import flash.utils.ByteArray;

 import org.purepdf.colors.GrayColor;
 import org.purepdf.colors.RGBColor;
 import org.purepdf.pdf.PageSize;
 import org.purepdf.pdf.PdfContentByte;
 import org.purepdf.pdf.PdfDictionary;
 import org.purepdf.pdf.PdfDocument;
 import org.purepdf.pdf.PdfGState;
 import org.purepdf.pdf.PdfName;
 import org.purepdf.pdf.PdfShading;
 import org.purepdf.pdf.PdfShadingPattern;
 import org.purepdf.pdf.PdfTemplate;
 import org.purepdf.pdf.PdfTransparencyGroup;
 import org.purepdf.pdf.PdfWriter;

 [SWF(frameRate="60",width="400",height="300")]
 public class ExampleColorGradient2 extends Sprite
 {
 public function ExampleColorGradient2()
 {
 super();
 addEventListener( Event.ADDED_TO_STAGE, onAdded );
 }

 protected const SPRITE_W: Number = 250;
 protected const SPRITE_H: Number = 150;
 protected const STAGE_W: uint = 400;
 protected const STAGE_H: uint = 300;
 protected const GRADIENT_W: Number = SPRITE_W;
 protected const GRADIENT_H: Number = SPRITE_H;

 protected var sprite: Sprite;
 protected var frame: int = -1;
 protected var gradient_matrix: Matrix;
 protected var colors: Array;
 protected var alphas: Array;
 protected var ratios: Array;
 protected var gradient_rotation: Number = 0;
 protected var gradient_rect: Rectangle = new Rectangle( 0, 0, GRADIENT_W, GRADIENT_H );
 protected var text: TextField;

 protected var pair_x: Number;
 protected var pair_y: Number;

 // pdf properties
 private var cb_colors: Vector. = new Vector.();
 private var cb_ratios: Vector. = new Vector.();
 private var cb_alphas: Vector. = new Vector.();

 private var test_sprite: Sprite;

 protected function onAdded( event: Event ): void
 {
 stage.scaleMode = StageScaleMode.NO_SCALE;
 stage.align = StageAlign.TOP_LEFT;

 sprite = new Sprite();
 sprite.graphics.beginFill( 0, 0.5 );
 sprite.graphics.drawRect( 0, 0, SPRITE_W, SPRITE_H );
 sprite.graphics.endFill();

 gradient_matrix = new Matrix();
 colors = [ 0xFF0000, 0xFFFF00, 0x0000FF, 0xFF00FF, 0x00FF00 ];
 alphas = [ 1, 1, 0, 1, 1 ];
 ratios = [ 0, 63, 126, 186, 255 ];

 sprite.buttonMode = true;
 sprite.addEventListener( MouseEvent.CLICK, onClick );
 addChild( sprite );

 // pdf

 for( var k: int = 0; k < colors.length; ++k )
 {
 cb_colors[k] = RGBColor.fromARGB( 0xFFFFFFFF &#038; colors[k] );
 cb_ratios[k] = ratios[k]/255;
 cb_alphas[k] = alphas[k];
 }

 var msg_format: ElementFormat = new ElementFormat();
 msg_format.fontDescription = new FontDescription("Helvetica");
 msg_format.fontSize = 12;
 msg_format.color = 0x000000;

 var block: TextBlock = new TextBlock();
 block.content = new TextElement("Click the sprite to start/stop", msg_format);
 var message_line: TextLine = block.createTextLine();

 message_line.x = ( STAGE_W - message_line.width ) / 2;
 message_line.y = message_line.height;
 addChild( message_line );

 test_sprite = new Sprite();
 test_sprite.mouseEnabled = false;
 addChild( test_sprite );

 // background
 graphics.beginFill( 0xDDDDDD, 1 );
 for( k = 0; k < STAGE_H; k += 20 )
 {
 graphics.drawRect( 0, k, STAGE_W, 1 );
 }

 onEnterFrame( null );
 }

 protected function onEnterFrame( event: Event ): void
 {
 frame++;
 var matrix: Matrix = new Matrix();
 matrix.identity();
 matrix.translate( -SPRITE_W/2, -SPRITE_H/2 );
 matrix.rotate( radians( -frame/1.5 ) );
 matrix.translate( (STAGE_W/2) + ( 100 * Math.sin( frame/100 )), (STAGE_H/2) + ( 75 * Math.cos( frame/100 ))  );

 sprite.transform.matrix = matrix;

 gradient_rect.x = Math.sin( frame/100 ) * 100;
 gradient_rect.y = Math.cos( frame/100 ) * 100;

 var test: Matrix = new Matrix();
 test = GradientMatrix.getGradientBox( gradient_rect.width, gradient_rect.height, 0, gradient_rect.x, gradient_rect.y );
 pair_x = 1/test.a;
 pair_y = 1/test.d;

 gradient_rotation = radians( frame );
 gradient_matrix = GradientMatrix.getGradientBox( GRADIENT_W, GRADIENT_H, gradient_rotation, gradient_rect.x, gradient_rect.y );
 sprite.graphics.clear();
 sprite.graphics.beginGradientFill( GradientType.LINEAR, colors, alphas, ratios, gradient_matrix );
 sprite.graphics.drawRoundRect( 0, 0, SPRITE_W, SPRITE_H, 10, 10 );
 sprite.graphics.endFill();
 update();
 }

 protected function onClick( event: MouseEvent ): void
 {
 if( hasEventListener( Event.ENTER_FRAME ) )
 {
 removeEventListener( Event.ENTER_FRAME, onEnterFrame );
 save();
 } else {
 addEventListener( Event.ENTER_FRAME, onEnterFrame );
 }
 }

 private function save(): void
 {
 var k: int;
 var buffer: ByteArray = new ByteArray();
 var writer: PdfWriter = PdfWriter.create( buffer, PageSize.create( STAGE_W, STAGE_H ) );
 var document: PdfDocument = writer.pdfDocument;
 document.open();
 var cb: PdfContentByte = document.getDirectContent();
 cb.setTransform( new Matrix( 1, 0, 0, -1, 0, STAGE_H ) );

 // background
 cb.saveState();
 cb.setFillColor( 0xDDDDDD );
 for( k = 0; k < STAGE_H; k += 20 )
 {
 cb.rectangle( 0, k, STAGE_W, 1 );
 cb.fill();
 }
 cb.resetFill();
 cb.restoreState();

 // Exract the gradient box for pdf
 var box: Rectangle = gradient_rect.clone();
 var matrix: Matrix = new Matrix();
 matrix.translate( -GRADIENT_W/2, -GRADIENT_H/2 );
 matrix.translate( -gradient_rect.x, -gradient_rect.y );
 matrix.scale( pair_x, pair_y );
 matrix.concat( gradient_matrix );
 matrix.concat( sprite.transform.matrix );
 matrix.concat( new Matrix( 1, 0, 0, -1, 0, STAGE_H ) );

 var top_left: Point  = box.topLeft.clone();
 var top_right: Point = new Point( box.right, box.top );
 var bottom_right: Point = box.bottomRight.clone();
 var bottom_left: Point = new Point( box.left, box.bottom );

 top_left = matrix.transformPoint( top_left );
 top_right = matrix.transformPoint( top_right );
 bottom_right= matrix.transformPoint( bottom_right );
 bottom_left = matrix.transformPoint( bottom_left );

 cb.saveState();
 cb.setTransform( sprite.transform.matrix );

 // Create the template first
 var template: PdfTemplate = cb.createTemplate( GRADIENT_W, GRADIENT_H );
 var transGroup: PdfTransparencyGroup = new PdfTransparencyGroup();
 transGroup.put( PdfName.CS, PdfName.DEVICERGB );
 transGroup.isolated = true;
 transGroup.knockout = false;
 template.group = transGroup;

 var gState: PdfGState = new PdfGState();
 var maskDict: PdfDictionary = new PdfDictionary();
 maskDict.put( PdfName.TYPE, PdfName.MASK );
 maskDict.put( PdfName.S, new PdfName( "Luminosity" ) );
 maskDict.put( new PdfName( "G" ), template.indirectReference );
 gState.put( PdfName.SMASK, maskDict );
 cb.setGState( gState );

 // ALPHA TEMPLATE
 var matrix2: Matrix = new Matrix();
 matrix2.translate( -GRADIENT_W/2, -GRADIENT_H/2 );
 matrix2.scale( pair_x, pair_y );
 matrix2.concat( gradient_matrix );

 var alphas: Vector. = new Vector.( cb_alphas.length, true );
 for ( k = 0; k < cb_alphas.length; ++k )
 alphas[k] = new GrayColor( cb_alphas[k] );

 var template_shading: PdfShading = PdfShading.complexAxial( cb.writer, 0, 0, GRADIENT_W, 0, Vector.( alphas ), cb_ratios );
 var template_pattern: PdfShadingPattern = new PdfShadingPattern( template_shading );
 template_pattern.matrix = matrix2;

 template.rectangle( 0, 0, SPRITE_W, SPRITE_H );
 template.setShadingFill( template_pattern );
 template.fill();

 // CONTENT
 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 );
 var cb_pattern: PdfShadingPattern = new PdfShadingPattern( cb_shading );

 cb.roundRectangle( 0, 0, SPRITE_W, SPRITE_H, 5 );
 cb.setShadingFill( cb_pattern );
 cb.fill();

 cb.restoreState();
 document.close();

 var f: FileReference = new FileReference();
 f.save( buffer, "ExampleColorGradient2.pdf" );
 }

 private function update(): void
 {
 return;
 test_sprite.graphics.clear();
 test_sprite.graphics.beginFill( 0, 0.1 );
 test_sprite.graphics.drawRect( 0, 0, gradient_rect.width, gradient_rect.height );

 var matrix: Matrix = new Matrix();
 matrix.translate( -GRADIENT_W/2, -GRADIENT_H/2 );
 matrix.scale( pair_x, pair_y );

 var box: Rectangle = gradient_rect.clone();

 matrix.concat( gradient_matrix );
 matrix.concat( sprite.transform.matrix );

 test_sprite.transform.matrix = matrix;
 test_sprite.graphics.endFill();
 }

 public static function radians( degree: Number ): Number
 {
 return degree * ( Math.PI / 180 );
 }
 }
}</pre>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.sephiroth.it/2010/02/10/flash-alpha-gradientmatrix-to-pdf-using-purepdf/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
		<item>
		<title>purePDF, a complete actionscript PDF library</title>
		<link>https://blog.sephiroth.it/2010/02/03/purepdf-a-complete-actionscript-pdf-library/</link>
					<comments>https://blog.sephiroth.it/2010/02/03/purepdf-a-complete-actionscript-pdf-library/#comments</comments>
		
		<dc:creator><![CDATA[Alessandro Crugnola]]></dc:creator>
		<pubDate>Thu, 04 Feb 2010 04:37:08 +0000</pubDate>
				<category><![CDATA[actionscript]]></category>
		<category><![CDATA[purePDF]]></category>
		<category><![CDATA[alchemy]]></category>
		<category><![CDATA[itext]]></category>
		<category><![CDATA[pdf]]></category>
		<category><![CDATA[porting]]></category>
		<guid isPermaLink="false">http://blog.sephiroth.it/?p=290</guid>

					<description><![CDATA[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&#8217;ve made of the famous java iText library ( version 4.2 ) by Bruno Lowagie into pure actionscript 3.0 (with some little modifications). &#8230; <a href="https://blog.sephiroth.it/2010/02/03/purepdf-a-complete-actionscript-pdf-library/" class="more-link">Continue reading <span class="screen-reader-text">purePDF, a complete actionscript PDF library</span></a>]]></description>
										<content:encoded><![CDATA[<p><strong>PurePDF</strong> is a complete library for creating PDF documents using actionscript 3 ( targeted for flash player 10 ).<br />
The project is actually hosted on <a href="http://code.google.com/p/purepdf">google code</a>.</p>
<p>This is is a porting I&#8217;ve made of the famous java <a href="http://itextpdf.com/">iText</a> library ( version 4.2 ) by <strong>Bruno Lowagie</strong> into pure actionscript 3.0 (with some little modifications).<br />
iText ( and purePDF ) has tons of features for create and manipulate pdf documents. A quick list of the features actually implemented into purepdf:</p>
<ul>
<li>pdf viewers display options</li>
<li>alpha transparency, blend modes</li>
<li>layers</li>
<li>arabic RTL writing</li>
<li>support for pdf text rendering ( <a href="http://www.sephiroth.it/purepdf/pdfs/TextRender.pdf">example</a> )</li>
<li>tables ( nested tables, page split tables, table with images, etc&#8230;)</li>
<li>slide show ( page transitions )</li>
<li>annotations, comments, file annotations</li>
<li>patterns, shadings patterns (linear and gradient), spot colors, rgb color and cmyk color</li>
<li>linear and radial gradients with alpha ( <a href="http://www.sephiroth.it/purepdf/pdfs/ShadingGradientTransparency.pdf">example</a> or <a href="http://www.sephiroth.it/purepdf/pdfs/AdvancedGradient.pdf">example 2</a> )</li>
<li>forms (user input forms, textfields, combo box, list, checkbox)</li>
<li>paragraphs, phrases, chunks for text manipulation, chapters, lists&#8230;</li>
<li>images (jpeg, png, animated gif, tif, bitmapdata ) and image patterns</li>
<li>basic and advanced paths</li>
<li>afm, otf, pfm, ttc and ttf fonts (embedded and not embedded)</li>
<li>metadata, page header and footers</li>
<li>external, internal links</li>
<li>barcodes creation ( ean-ucc 13, ucc-12, ean-ucc-8, upc-e, pdf 417, ean supplements) ( <a href="/purepdf/pdfs/BarCodes.pdf">example</a> )</li>
<li>unicode, cjk fonts and text</li>
<li>file attachments</li>
<li>javascript ( <a href="http://www.sephiroth.it/purepdf/pdfs/Javascript2.pdf">example</a> )</li>
<li>multi column text</li>
<li>Embedded movies ( <a href="http://www.sephiroth.it/purepdf/pdfs/EmbeddedMovie.pdf">example</a> )</li>
<li>Vertical text ( see this <a href="http://www.sephiroth.it/purepdf/pdfs/VerticalTextExample.pdf">example</a> )</li>
<li>and many other features&#8230;</li>
</ul>
<p>You can take a look at this <a href="http://www.sephiroth.it/purepdf/pdfs/Reflection.pdf">PDF document</a> (self generated using actionscript reflection) with the purePDF APIs.</p>
<p>Other actionscript libraries I&#8217;ve used for this project are: <a href="http://www.wizhelp.com/fzlib/">fzlib</a>, <a href="http://code.google.com/p/as3corelib/">as3corelib</a>, <a href="http://code.google.com/p/ashashmap/">ashashmap</a>, alchemy, <a href="http://code.google.com/p/as3-commons/">as3-commons</a>.</p>
<p>You can both download the library from source code and compile it yourself ( see at the <a href="http://code.google.com/p/purepdf/wiki/Installation">Installation</a> guide ) or download the precompiled swc files from the project&#8217;s <a href="http://code.google.com/p/purepdf/downloads/list">download section</a>.</p>
<p>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 <a href="http://code.google.com/p/purepdf/wiki/Examples">here</a>. In General refers to the <a href="http://code.google.com/p/purepdf/w/list">project wiki</a> for all the updated examples/howtos and the project updates.</p>
<p><strong>update:</strong> <a href="/wp-content/uploads/purepdf/asdoc-output/">here</a> you can find the updated online api documentation</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.sephiroth.it/2010/02/03/purepdf-a-complete-actionscript-pdf-library/feed/</wfw:commentRss>
			<slash:comments>19</slash:comments>
		
		
			</item>
		<item>
		<title>Download flash camp presentation</title>
		<link>https://blog.sephiroth.it/2009/09/08/download-flash-camp-presentation/</link>
					<comments>https://blog.sephiroth.it/2009/09/08/download-flash-camp-presentation/#comments</comments>
		
		<dc:creator><![CDATA[Alessandro Crugnola]]></dc:creator>
		<pubDate>Tue, 08 Sep 2009 15:42:21 +0000</pubDate>
				<category><![CDATA[actionscript]]></category>
		<category><![CDATA[flex]]></category>
		<category><![CDATA[scripting languages]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[flex camp]]></category>
		<category><![CDATA[pdf]]></category>
		<category><![CDATA[presentation]]></category>
		<guid isPermaLink="false">http://blog.sephiroth.it/?p=278</guid>

					<description><![CDATA[I&#8217;m publishing here the pdf of the slides me and Gabriele used in the Flash Camp in Rimini last Saturday, if someone is interested. You can download the pdf here:&#160;flex camp.pdf P.S. Saturday night was really great, thank you everyone &#240;&#159;&#153;&#130;]]></description>
										<content:encoded><![CDATA[<p><span class="mt-enclosure mt-enclosure-image" style="display: inline;"><br />
<a href="/wp-content/uploads/2009/09/flex_camp.pdf"><img fetchpriority="high" decoding="async" class="aligncenter size-full wp-image-424" title="Screen shot 2009-09-08 at 8.31.25 AM" src="http://ve.m5yn67dl.vesrv.com/wp-content/uploads/2009/09/Screen-shot-2009-09-08-at-8.31.25-AM.png" alt="" width="400" height="299" srcset="https://blog.sephiroth.it/wp-content/uploads/2009/09/Screen-shot-2009-09-08-at-8.31.25-AM.png 400w, https://blog.sephiroth.it/wp-content/uploads/2009/09/Screen-shot-2009-09-08-at-8.31.25-AM-300x224.png 300w, https://blog.sephiroth.it/wp-content/uploads/2009/09/Screen-shot-2009-09-08-at-8.31.25-AM-150x112.png 150w" sizes="(max-width: 400px) 100vw, 400px" /></a><br />
</span></p>
<div>
<div style="text-align: left;">I&#8217;m publishing here the pdf of the slides me and Gabriele used in the <a href="http://www.actionscript.it/showVetrina.cfm?id=58">Flash Camp</a> in Rimini last Saturday, if someone is interested.</div>
<div style="text-align: left;">You can download the pdf here: <a href="/wp-content/uploads/2009/09/flex_camp.pdf">flex camp.pdf</a></div>
</div>
<div>P.S. Saturday night was really great, thank you everyone 🙂</div>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.sephiroth.it/2009/09/08/download-flash-camp-presentation/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>From A to Web memories</title>
		<link>https://blog.sephiroth.it/2006/09/29/from-a-to-web-memories/</link>
					<comments>https://blog.sephiroth.it/2006/09/29/from-a-to-web-memories/#respond</comments>
		
		<dc:creator><![CDATA[Alessandro Crugnola]]></dc:creator>
		<pubDate>Fri, 29 Sep 2006 17:28:54 +0000</pubDate>
				<category><![CDATA[actionscript]]></category>
		<category><![CDATA[apollo]]></category>
		<category><![CDATA[beta]]></category>
		<category><![CDATA[blaze]]></category>
		<category><![CDATA[conference]]></category>
		<category><![CDATA[pdf]]></category>
		<category><![CDATA[psd]]></category>
		<category><![CDATA[zinc]]></category>
		<guid isPermaLink="false">http://blog.sephiroth.it/?p=171</guid>

					<description><![CDATA[sneak peak of apollo and blaze<br /> ]]></description>
										<content:encoded><![CDATA[<p>Yesterday I attended the Italian Adobe conference, <a href="http://www.fromatoweb.it/" target="_blank">From A to Web</a>, in Milan.<br />
I like expecially the <strong>Mike Downey</strong> presentation, in which he showm us a sneak peak of the new Adobe project, codename &#8220;Apollo&#8221;.<br />
A <strong>PDF+Flash+HTML</strong> plugin viewer for creating desktop applications (so, goodbye Zinc and similar?). Someone asked him which html engine was used in apollo, but without a precis answer, I think he was referring to Geko&#8230;<br />
Also interesting the Mike&#8217;s explanation about the reason of the name &#8220;Apollo&#8221;.<br />
That&#8217;s because the first Central codename was &#8220;<a href="http://en.wikipedia.org/wiki/Project_Mercury" target="_blank">Mercury</a>&#8221; (early American program for launching humans into space) the second beta codename was &#8220;<a href="http://en.wikipedia.org/wiki/Project_Gemini" target="_blank">Gemini</a>&#8221; (the second US manned spaceflight program), and Apollo was the first ship to land the Moon</p>
<p>Then he introduced also a preview of the new Flash9 IDE (currently in beta process, codename &#8220;Blaze&#8221;) and he shown some of the new IDE features. First of all the IDE has changed (like in almost new releases) and there are very cool workspace management cool features indeed.<br />
A completely integrated Photoshop PSD import process. You can select which element of the psd file to be imported and how to do it, select one of the layers and import as movieclip, etc.. very nice for designers (There was a long applause).<br />
Another features he presented was the Robert Penner export as ActionScript3 of timeline tweens. This should be for developers who need to transform the timeline motion tweens created by designer into code (Another long applause). For what I understand it creates an xml code which can be put into the timeline and which reproduce the original tween. But I also understand that the produced code can only be used into the same timeline (a timeline with the same number of frames)..,</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.sephiroth.it/2006/09/29/from-a-to-web-memories/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
