4

I am used zend and need to print report as in PDF and i want to draw location for image. but i can't find the solution because by i see in site i can only set size of image but can't find how to set location for image yet.

        $image = Zend_Pdf_Image::imageWithPath($base."/images/logo_login.png");
        $page->drawImage($image, 10, 30, 20, 50);

yes by this code i can't draw location for image. so anyone used to know a bout it , please share it to me. thanks !

koe
  • 736
  • 1
  • 12
  • 33

2 Answers2

2

Zend_Pdf uses the BOTTOM LEFT corner as the origin and uses points (1/72 of an inch) as the unit of measurement.

I don't usually post links to my own stuff so blatantly, but I've seen a number of questions from you recently on how to use Zend_Pdf and I think you could benefit from reading this article:

http://yetanotherprogrammingblog.com/content/zend_pdf-wrapper-and-sample-code

There is a specific section in that article on using drawImage().

JamesG
  • 4,288
  • 2
  • 31
  • 36
  • Is there a way to draw the image behind text, so it becomes like a background? There is no z-index argument to the drawImage function – Wouter Mar 04 '17 at 11:51
  • I haven't tested this theory, but I'm pretty sure that if you draw the image first and then draw the text that the text will appear on top of the image. That is, I'm pretty sure when a PDF is rendered the rendering app simply follows the instructions one after the other in the order that they appear in the file, meaning that whatever gets drawn second will overwrite whatever was drawn first. – JamesG Mar 05 '17 at 21:32
-1

drawImage function get as paramteters the location of the start point (top left) to draw the image and the end point (bottom right). By this coordinates, you can specify the location and the size of the image to draw.

http://framework.zend.com/manual/1.12/en/zend.pdf.drawing.html

public function drawImage(Zend_Pdf_Resource_Image $image, $x1, $y1, $x2, $y2);
sdespont
  • 13,915
  • 9
  • 56
  • 97