Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to Access $dompdf #13

Closed
trovster opened this issue Nov 15, 2013 · 2 comments
Closed

Ability to Access $dompdf #13

trovster opened this issue Nov 15, 2013 · 2 comments

Comments

@trovster
Copy link

Need the ability to access the (currently) protected $dompdf property, which gives the ability to add content to every page (such as page count or other repeatable information).

$pdf = \PDF::loadHTML($this->layout->render());
$pdf->output();

$canvas = $pdf->dompdf->get_canvas();
$height = $canvas->get_height();
$width = $canvas->get_width();

$header = $canvas->open_object();
$canvas->page_text($width / 2, 24, 'Text', \Font_Metrics::get_font('Helvetica'), 10, array(0,0,0));
$canvas->close_object();
$canvas->add_object($header, 'all');

return $pdf->stream('output.pdf');
@barryvdh
Copy link
Owner

So does this work for you? $pdf->getDomPDF()

@trovster
Copy link
Author

Perfect :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants