php-phantomjs
php-phantomjs copied to clipboard
PDF D3 JS not loading fully But few components are working.
Hi All,
I am trying to create D3 JS graphs web page as PDF, but JS was not loading fully into PDF. I have tested HTML page there is no errors in console. Could you please suggest my mistakes in below script.
`$client = Client::getInstance();
// When we want to wait for all resources on the page to load.
$client->isLazy();
// Absolute path to phatomjs bin file
$bin_path = 'E:\phantomjs-2.1.1-windows\bin\phantomjs.exe';
$client->getEngine()->setPath($bin_path);
// Options
$client->getEngine()->addOption('--load-images=true');
$client->getEngine()->addOption('--ignore-ssl-errors=true');
$client->getEngine()->addOption('--local-to-remote-url-access=true');
// Here specify the page to take the PDF content
$pdf_url = SITE_URL.'/pdf_url.php';
$filename = 'filename.pdf';
$path = ROOT_DIR.'/../downloads/'.$filename;
//Request
$request = $client->getMessageFactory()->createPdfRequest($pdf_url, 'GET', 5000);
$request->setOutputFile($path);
$request->setFormat('A4');
$request->setOrientation('landscape');
//Response
$response = $client->getMessageFactory()->createResponse();
// Send the request
$send = $client->send($request, $response);`