What are the parameter of the Image() in tcpdf?
Asked Answered
C

4

7

I need to align an image . But I did not get with the parameters passed inside the Image function in tcpdf .

$pdf->Image(Image_Path, 0, 250, 210 , 0, 'PNG', '', '', false, 300, '', false, false, 0, 'LB', false, false);

Crispa answered 19/5, 2017 at 4:40 Comment(0)
B
16

Image( filename, left, top, width, height, type, link, align, resize, dpi, align, ismask, imgmask, border, fitbox, hidden, fitonpage)

filename : name of the file containing the image
left : from left
top: from top
width: width of the image. Zero for automatically calculated
height : height of the image. Zero for automatically calculated.
type: JPG, JPEG, PNG. If not specified, the type is inferred from the file extension.
link:URL or identifier returned by AddLink()
align: T (top), M (middle), B (bottom), N (next line)
resize: true/false. If true resize (reduce) the image to fit :w and :h (requires RMagick library); if false do not resize; if 2 force resize in all cases (upscaling and downscaling).
dpi: dot-per-inch resolution used on resize. Recommended 300
align: align L (left), C (center), R (right)
ismask: true if this image is a mask, false otherwise
imgmask: image object returned by this function or false.
border: 0: no border (default) 1: frame or a string containing some or all of the following characters (in any order): L: left T: top R: right B: bottom
fitbox: If true scale image dimensions proportionally to fit within the (:w, :h) box.
hidden: true/false
fitonpage: if true the image is resized to not exceed page dimensions.

From https://www.rubydoc.info/gems/rfpdf/1.17.1/TCPDF:Image

Bluestone answered 2/8, 2020 at 0:1 Comment(0)
B
4

The documentation is a good start:

Image( $file, $x = '', $y = '', $w = 0, $h = 0, $type = '', $link = '', $align = '', $resize = false, $dpi = 300, $palign = '', $ismask = false, $imgmask = false, $border = 0, $fitbox = false, $hidden = false, $fitonpage = false, $alt = false, $altimgs = array() )

What do you mean by "align"?

Berceuse answered 19/5, 2017 at 6:34 Comment(2)
Where can I find the meaning for $ismask, $imgmask, $alt etc?Bassett
Unfortunatelly, this documentation is somehow crippled, but the source code has doxygen comments, which list also description of the arguments. For example here is the documentation for the Image() arguments: github.com/tecnickcom/TCPDF/blob/master/tcpdf.php#L6790Berceuse
C
2
Image( $file, $x = '', $y = '', $w = 0, $h = 0, $type = '', $link = '', $align = '', $resize = false, $dpi = 300, $palign = 'C', $ismask = false, $imgmask = false, $border = 0, $fitbox = false, $hidden = false, $fitonpage = false, $alt = false, $altimgs = array() )

Put C for center align, L for Left align, R for right align

Client answered 8/10, 2019 at 15:22 Comment(0)
W
0
$tcpdf->Image('../xyz.png', $x=150, $y=10, $w=40, $h=20, 'PNG');
Willin answered 12/11, 2022 at 9:56 Comment(1)
Please explain your answer to make it better.Era

© 2022 - 2024 — McMap. All rights reserved.