Alasdair
Alasdair

Reputation: 14161

Low Level PDF Creation - How to set page size?

I'm writing a PDF directly from code in PHP. I can specify the mediabox and cropbox values in the page object, but the PDF turns out really tiny and has to be zoomed in 2400% to see the page. I want to set the actual page size in inches as an absolute.

How can I do this?

Upvotes: 0

Views: 326

Answers (2)

iPDFdev
iPDFdev

Reputation: 5834

The MediaBox and CropBox coordinate values are set as points (1/72 inches). For a letter sized page you have to write [0 0 612 792] (multiply your inch values with 72).

Upvotes: 1

vascowhite
vascowhite

Reputation: 18430

I'd recommend using a pdf framework such as fpdf rather than re-inventing the wheel.

If you want to write your own implementation then I would recommend downloading FPDF anyway and seeing how the page size is set. Either that or Zend_Pdf, both have already solved your problem.

Upvotes: 2

Related Questions