[PDF Writer] How to print all collumns in one page

Topics: Developer Forum
Nov 18, 2009 at 1:41 PM


I recently needed to generate an excel file containing 3 worksheets.

When all the work was done, "hurray", the project manager tells me he'd now prefer it in PDF.

Hopefully, PHPExcel allows you to generate PDF so that's what i did : just changed the format.

Although i have one issue : i have 5 columns each one containing text. This text can be from time to time quite long so the PDF version doesn't print all the collumns. (last one is missing cause it's outside the page)

Is there anyway i can configure my collumns to "fit to the page" ?

For now, i configured my columns with:


Plus, it seems cell borders aren't working for the PDF writer (have them under Excel5, not on PDF) . Is it normal ?

I'm using version 1.7.1.


Thanks !

Nov 19, 2009 at 2:54 AM

The PDF writer in PHPExcel is using the TCPDF project at SourceForge. It does not contain features like fit-to-page and border.

What you may try to do is to first export to HTML using PHPExcel_Writer_HTML and then use mPDF to export from HTML to PDF


If I recall correctly mPDF contains both the border and fit-to-page feature you are asking about.