0 Replies Latest reply on Jul 16, 2015 6:45 AM by alan_bloom

    AlivePDF ImageStream not working?

    alan_bloom

      Hi there

       

      Got a strange problem that I can't seem to figure out.

      I can add an image with AlivePDF like:

       

           [Embed(source='logo.png')]

           private var logoClass:Class;

           private var logo:Bitmap = new logoClass();

           ....

           pdf.addImage(logo, null, -10, -10, 210, 28, 0, 1, true, "PNG", 100, "Normal",null);

       

      Which works fine, albeit a low res image. In order to put a high resolution image in the PDF, I changed to:

       

          [Embed(source='logo.png')]

           private var logoClass:Class;

           ...

           pdf.addImageStream( logoClass() as ByteArray, ColorSpace.DEVICE_RGB, null,-10, -10, 210, 28, 0,1,'Normal',null);

       

      When I try to compile this with Flex 4.6, I get an error: "Access of undefined property ColorSpace.". So I change the ColourSpace to a string, like this:

           pdf.addImageStream( logoClass() as ByteArray, 'ColorSpace.DEVICE_RGB', null,-10, -10, 210, 28, 0,1,'Normal',null);

      Which compiles without errors but just doesn't work - calling the same function which worked previously just does nothing at all.


      Any advice?


      Thanks!


      Alan