Dompdf\Adapter\GD
Image rendering interface
Renders to an image format supported by GD (jpeg, gif, png, xpm).
Not super-useful day-to-day but handy nonetheless
Synopsis
class GD
implements
Canvas
{
- // constants
- const FONT_SCALE = 0.75;
- // members
- private Dompdf $_dompdf;
- private $_img;
- private $_imgs;
- private $_width;
- private $_height;
- private $_actual_width;
- private $_actual_height;
- private $_page_number;
- private $_page_count;
- private $_aa_factor;
- private $_colors;
- private $_bg_color;
- private $_bg_color_array;
- private $dpi;
- // methods
- public void __construct()
- public Dompdf get_dompdf()
- public resource get_image()
- public float get_width()
- public float get_height()
- public int get_page_number()
- public int get_page_count()
- public void set_page_number()
- public void set_page_count()
- public void set_opacity()
- private int _allocate_color()
- private float _upscale()
- private float _downscale()
- public void line()
- public void arc()
- public void rectangle()
- public void filled_rectangle()
- public void clipping_rectangle()
- public void clipping_roundrectangle()
- public void clipping_end()
- public void save()
- public void restore()
- public void rotate()
- public void skew()
- public void scale()
- public void translate()
- public void transform()
- public void polygon()
- public void circle()
- public void image()
- public void text()
- public void javascript()
- public void add_named_dest()
- public void add_link()
- public void add_info()
- public void set_default_view()
- public float get_text_width()
- public string get_ttf_file()
- public float get_font_height()
- private void get_font_height_actual()
- public float get_font_baseline()
- public void new_page()
- public void open_object()
- public void close_object()
- public void add_object()
- public void page_text()
- public void stream()
- public string output()
- private void _output()
Hierarchy
Implements
Tasks
Line | Task |
---|---|
426 | |
511 | |
516 | |
524 | |
550 | |
561 | |
572 | |
581 | |
594 |
Constants
Name | Value |
---|---|
FONT_SCALE | 0.75 |
Members
private
- $_aa_factor
—
float
Image antialias factor - $_actual_height
—
int
Actual image height in pixels - $_actual_width
—
int
Actual image width in pixels - $_bg_color
—
int
Background color - $_bg_color_array
—
int
Background color array - $_colors
—
array
Allocated colors - $_dompdf — Dompdf\Dompdf
- $_height
—
int
Apparent canvas height in pixels - $_img
—
resource
Resource handle for the image - $_imgs
—
array
Resource handle for the image - $_page_count
—
int
Total number of pages - $_page_number
—
int
Current page number - $_width
—
int
Apparent canvas width in pixels - $dpi
—
int
Actual DPI
Methods
private
- _allocate_color() — Allocate a new color. Allocate with GD as needed and store previously allocated colors in $this->_colors.
- _downscale() — Scales value down from the current canvas DPI to 72 DPI
- _output() — Outputs the image stream directly.
- _upscale() — Scales value up to the current canvas DPI from 72 DPI
- get_font_height_actual()
public
- __construct() — Class constructor
- add_info() — Add meta information to the PDF
- add_link() — Add a link to the pdf
- add_named_dest() — Add a named destination (similar to <a name="foo">...</a> in html)
- add_object()
- arc()
- circle() — Draws a circle at $x,$y with radius $r
- clipping_end() — Ends the last clipping shape
- clipping_rectangle() — Starts a clipping rectangle at x1,y1 with width w and height h
- clipping_roundrectangle()
- close_object()
- filled_rectangle() — Draws a filled rectangle at x1,y1 with width w and height h
- get_dompdf()
- get_font_baseline()
- get_font_height() — Calculates font height, in points
- get_height() — Return the image's height in pixels
- get_image() — Return the GF image resource
- get_page_count() — Returns the total number of pages in the document
- get_page_number() — Returns the current page number
- get_text_width() — Calculates text size, in points
- get_ttf_file()
- get_width() — Return the image's width in pixels
- image() — Add an image to the pdf.
- javascript()
- line() — Draws a line from x1,y1 to x2,y2
- new_page() — Starts a new page
- open_object()
- output() — Returns the image as a string.
- page_text()
- polygon() — Draws a polygon
- rectangle() — Draws a rectangle at x1,y1 with width w and height h
- restore()
- rotate()
- save()
- scale()
- set_default_view()
- set_opacity() — Sets the opacity
- set_page_count() — Sets the page count
- set_page_number() — Sets the current page number
- skew()
- stream() — Streams the image to the client.
- text() — Writes text at the specified x and y coordinates See {@link Style::munge_color()} for the format of the color array.
- transform()
- translate()