i reviewed similar questions, but not found solution for my problem
Environment of our web-project using:
Our project generate dynamicaly pdf documents (using Zend Pdf class).
PDF generation takes arout ~10 seconds to complete for about 2 pages, which include 2 png-images (charts sending in POST data on svg format and java converted him (svg) to png image; on web charts generated with highcharts js-lib, to png ).
We need speed up generation process.
some parts of our code:
public function actionQuery()
{
...
$xxExporter->generatePdf($request, $someAdditionalData);
...
$xxExporter->httpOutputFile();
...
Yii::app()->end();
}
public function generatePdf(CHttpRequest $request, array $someAdditionalData)
{
initRequest($request, $someAdditionalData);
...
...attachItemToPdf..
...
setMetaData
...
}
public function httpOutputFile()
{
$this->pdf->save($filename);
header("Content-Disposition: attachment; filename=\"{$this->filename}.pdf\"");
header("Content-type: application/pdf");
header("Content-length: " . filesize($filename));
echo file_get_contents($filename);
unlink($filename);
}
converting svg to png with java:
$type = "-m {$this->fileType}";
$width = !empty($this->fileExportWidth) ? "-w {$this->fileExportWidth}" : '';
$outputFile = "-d {$this->fileExportTempName}";
$inputFile = $this->fileTempName;
$errorString = exec("{$this->pathJava} -jar {$this->pathBatik} {$type} {$outputFile} {$indexed} {$width} {$inputFile}", $output, $return_var);
Tomorrow i will try to install some jpg-lib to server, and try replace png to jpg in project.
if you need some additional information - let me know, I give it to you.
Could someone help me? I really don't know how to do this, I've tried everything I know.
Thank you very much for any help or suggestions!!
Try to use http://www.princexml.com/ - it works very fast and it's very easy.