CodeIgniter Forums
pdf plugin help! - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: pdf plugin help! (/showthread.php?tid=22133)



pdf plugin help! - El Forum - 08-30-2009

[eluser]NachoF[/eluser]
I reeeally need to generate a pdf file from a databse query... It might get to 1000 records
Im using the dompdf plugin and Im getting this error

Quote:Fatal error: Allowed memory size of 16777216 bytes exhausted (tried to allocate 5880 bytes)

please help
thanls in advance.


pdf plugin help! - El Forum - 08-30-2009

[eluser]Dam1an[/eluser]
Well, the easiest way is to just increase the memoru limit, which is set in the php config (php.ini on windows)
Or do you not have access to this file?


pdf plugin help! - El Forum - 08-30-2009

[eluser]NachoF[/eluser]
I fixed it by addind this line to the plugin
ini_set("memory_limit","256M");

Dont understand how 256 MBs of memory is necesary for a 200KB pdf.. really stupid.


pdf plugin help! - El Forum - 08-30-2009

[eluser]überfuzz[/eluser]
[quote author="NachoF" date="1251681268"]I fixed it by addind this line to the plugin
ini_set("memory_limit","256M");

Dont understand how 256 MBs of memory is necesary for a 1MB pdf.. really stupid.[/quote]
Are you short on memory..? Undecided


pdf plugin help! - El Forum - 08-30-2009

[eluser]Dam1an[/eluser]
[quote author="NachoF" date="1251681268"]
Dont understand how 256 MBs of memory is necesary for a 1MB pdf.. really stupid.[/quote]

I doubt you need all that 256Mb Wink
But yeah, PDF generation is pretty memory intensive, it doesn't just use as much as the resultant file size


pdf plugin help! - El Forum - 08-30-2009

[eluser]NachoF[/eluser]
This is all on my local computer..... which has 6GBBs of RAM... I dont know the specs of the deployment server.... in any case.. what other approach do you reccomend?? instead of pdf... the user just wants a list of the all the attending students (out of 1200)... I just though it would be better if it was a pdf but he might as well print out a large html file and be done with it if its gonna risk the reliability of the system.... so... any ideas on a better way?


pdf plugin help! - El Forum - 08-30-2009

[eluser]überfuzz[/eluser]
You could have a go with the css. It's possible to alter print style. If you put out a <table> you can style it to look good on paper.

Example:
Code:
@media print {
    #header,#menu,#logo {
    display:none;
    }
    
    body {
    font-size:70%;
    }

    p,li,ul,ol,h1,h2,h3,h4,h5,td{
    font-family: serif;
    }

}