Hello Student Looking at the sample code that you provide, it looks like you are doing some basic mail merge.
You can certainly use Zend_Pdf for this. However, there is another component, Zend_Service_LiveDocx_MailMerge, which offers a really easy way to populate templates, created in a word processing WYSIWYG package (for example, MS Word) directly in PHP, using the Zend Framework. The idea is simple: 1) You make a template in MS Word (for example). 2) In this template, you add so called "merge fields". 3) Using only a few lines of code, you populate the merge fields in the template. 4) You then save the document to PDF (or any other supported format). Using this approach would be particularly advantageous to you, as you can also save the document to image files (PNG, GIF, JPG etc.) -- perfect for the thumbnails that you need. You can specify the size of the resulting images files via the API. The documentation is here: http://framework.zend.com/manual/en/zend.service.livedocx.html Additionally, I run a blog dedicated to the component at: http://www.phplivedocx.org Which contains a number of sample applications. Getting started guide: http://www.phplivedocx.org/articles/getting-started-with-phplivedocx-zf/ Very simple sample applications: http://www.phplivedocx.org/articles/brief-introduction-to-phplivedocx/ List of supported formats: http://www.phplivedocx.org/2009/01/12/supported-file-formats-in-phplivedocx/ You may also be interested in a session that I held at PHP Unconference Europe a couple of weeks ago: http://www.phplivedocx.org/2011/02/19/slides-from-php-unconference-europe-2011/ If you have any questions, please do not hesitate to ask me. Best regards Jonathan Maron On Tue, Mar 1, 2011 at 11:18 AM, student <[email protected]> wrote: > Hello, > > I am looking forward to find some help regarding the creation of thumbnails > from a modified pdf. > > I use Zend_PDF to add some text and images to an existing pdf. > The way I use Zend is this: > $pdf = Zend_PDF::load(realpath($path)); > $page = $pdf->pages[$page]; > $font = getFont(); //here I load the Calibri.ttf or Eurostile.ttf e.g. > $page->setFont($font, $fontSize); > $page->drawText($tmp, $posx, $posY, "UTF-8"); > $pdf->save($savePath); > > After this I use GhostScript to generate thumbnails using the following: > > gs -dBatch -dNOPAUSE -dSAFER -sDEVICE=png16m -r300 -dTextAlphaBits=4 > -dGraphicsAlphaBits=4 -dFirstPage=1 -dLastPage=1 > -sOutputFile=out/pdf_page1_thumbnail.png pdfs/pdf.pdf -c quit > > The problem is, that in most cases the inserted text is in a different font > size or the letters are overlaying each other. The modified pdf documents > are good. > > Here is a link that shows some generated thumbnails: > https://printportal.la-well.de/thumbs.php > > I dont know if I am in the right place here. Please let me know, if you have > any hints or solutions to it. > > Regards > > student > > > > > -- > View this message in context: > http://zend-framework-community.634137.n4.nabble.com/Crappy-Thumbnails-from-generated-pdf-tp3329564p3329564.html > Sent from the Zend Framework mailing list archive at Nabble.com. >
