PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Tuesday, October 4, 2022

[FIXED] How to make phpExcel to PDF doc fit in one page

 October 04, 2022     pdf, php, phpexcel     No comments   

Issue

I'm trying to save docs made by phpExcel into pdf format. Everything is fine, except for the fact that my file is very wide and doesn't fit in one page (so part of the data is lost behind the doc border)

I tried to use:

$phpExcel->getActiveSheet()->getPageSetup()->setFitToPage(true);
$phpExcel->getActiveSheet()->getPageSetup()->setFitToWidth(1);
$phpExcel->getActiveSheet()->getPageSetup()->setFitToHeight(0); 

But nothing changed. (And as I understand these only works for print version, not for converting to PDF). Does anyone has any ideas how to improve that?


Solution

I solve this issue with the following command:

$phpExcel->getActiveSheet()->getPageSetup()->setPaperSize(PHPExcel_Worksheet_PageSetup::PAPERSIZE_A3);


Answered By - Solonka
Answer Checked By - Katrina (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing