Should I use PurePDF or AlivePdf

1.4k views Asked by At

My company has only two flex pdf libraries available, AlivePDF and PurePDF.
I am having trouble finding very good documentation related to what I need to do so I hope to get some feedback from people who have used these libs.

The primary thing I need to do is paste a group of DisplayObjects into a pdf, with decent quality of the image. I had used org.alivepdf.pdf.PDF.addImage(..) function before but the image quality was very poor and somehow the process cropped off parts of the image, making it unusable.

Here is an example of something that might need to be pasted into a pdf:

<s:HGroup id="imageGroup">
  <s:Label text="Chart Title" />
  <mx:Legend dataProvider="myChart" />
  <mx:LineChart id="myChart">
    <!-- do chart stuff here -->
  </mx:LineChart>
</s:HGroup>
1

There are 1 answers

0
Chris On

PDF.addImage() generates low resolution graphics. For higher quality, use this instead:

  • take a snapshot of the image group using ImageSnapshot.captureImage(), setting the dpi to 300
  • add the resulting bytearray to the PDF using addImageStream()

I have used AlivePDF for a while. There are a few quirks and the documentation is sparse, but this is workable and the results are great.