Dan,
Jpegs are supported through GD.
Use the factory method
Zend_Pdf_Image::imageWithPath('/path/to/file.jpg');
The image handling classes in Zend PDF are undergoing
transitioning and
should not be directly used.
Kevin
Dan Field wrote:
> Zend_Pdf_FileParser_Image_Jpeg does not sem to be part
of my 1.0.2
> distribution. I wanted to create a PDF of images but
use a string
> rather than a filename to add the images. I decided to
copy a little
> code from Zend/Pdf/Image.php but I ran out of luck when
I only found
> that the PNG parser has been written.
>
> This is what I wanted to do:
>
> class PDFDocument {
> protected $pdf;
>
> public function __construct() {
> $this->pdf = new Zend_Pdf();
> }
>
> public function generatePDF($images) {
>
> $this->pdf->pages =
array_reverse($this->pdf->pages);
>
> foreach ($images as $imageName) {
> $this->pdf->page =
> $this->pdf->newpage(Zend_Pdf_Page::SIZE_A4);
> $image = new Image($imageName);
> $imgStream =
$image->resizeWithRatio(0.4,0.4);
>
> $dataSource = new
> Zend_Pdf_FileParserDataSource_String($imgStream);
> $imageParser = new
> Zend_Pdf_FileParser_Image_Jpeg($dataSource);
> $pdfJPEG = new
Zend_Pdf_Resource_Image_Jpeg($imageParser);
>
>
$this->pdf->page->drawImage($pdfJPEG, 10, 10, 10,
10);
>
> $this->pdf->pages[] =
$this->pdf->page;
> }
> $this->pdf->render();
> }
> }
>
> Am I out of luck for generating PDFs from JPEGs at this
moment in time?
>
|