unable to generate PDF from spatie bowsershot - laravel

i have installed browsershot in my laravel project
I have installed puppeteer, installed chromium , my npm version is updated, but still i am unable to get the PDF of my simple html input , i have tried to take screenshot by URL method and save as image(It works), but my requirement is to generate PDF of my html.
This is my code in controller
$output=Browsershot::html($html)
->setNodeModulePath("/var/www/html/ProjectName/node_modules/")
->setChromePath("/usr/bin/chromium-browser")
->setNodeBinary('/usr/local/bin/node')
->setNpmBinary('/usr/local/bin/npm')
->showBackground()
->noSandbox()->timeout(60)
->save(public_path("DevTest.pdf");
Error Message:
"message": "The process "PATH=$PATH:/usr/local/bin NODE_PATH='/var/www/html/ProjectName/node_modules/' /usr/local/bin/node '/var/www/html/benesprint/vendor/spatie/browsershot/src/../bin/browser.js' '{"url":"file:\/\/\/tmp\/1933874416-0068512001600765779\/index.html","action":"pdf","options":{"path":"\/var\/www\/html\/ProjectName\/public\/DevTest.pdf","args":["--no-sandbox"],"viewport":{"width":800,"height":600},"displayHeaderFooter":false,"executablePath":"\/usr\/bin\/chromium-browser","timeout":60000,"printBackground":true}}'" exceeded the timeout of 60 seconds.",
**i would be grateful if you can help me out.**

i have similiar problem when browsershot inside container. and my step to resolve is like this:
Manual generate PDF from html using laravel tinker. if there is an error, try reinstall chromium and puppeteer library.
If success, then try remove all css and javascript links from html, and check for the result.
If success, then add --proxy-server="direct://" and --proxy-bypass-list=* into browsershot args
If step 3 is not working, then you can put css and javascript directly into view template or using php code to inclue those files like
<?php include public_path('css/styles.css') ?>

Related

How to Integrate Jasper Reports in Codeigniter PHP

I have tried below link to integrate jasper report in Codeigniter php
but it doesn't works
http://community.jaspersoft.com/questions/822686/how-connect-jasper-reports-php-application
Can anybody explain any other method to integrate jasper reports in Codeigniter PHP ?
EDIT
Code:
<?php
require_once APPPATH . "report/vendor/autoload.dist.php";
header('Content-Type: text/html');
use Jaspersoft\Client\Client;
$c = new Client( "localhost", "8080", "jasperadmin", "jasperadmin", "/jasperserver-pro", "organization_1" );
$report = $c->reportService()->runReport(APPPATH.'/report/sample_repor‌​t', 'html');
echo $report;
?>
When you want to use Jaspersoft Reports, you cannot use pre-created PDF files.
The process looks more or less like this:
Take Jaspersoft Studio to design report (will give jrxml file)
Upload jrxml file somewhere
Use some kind of PHP wrapper to create a report when you need it with fresh data, like the Jaspersoft PHP Rest Client. For more explanation see this question
Then this report can be created for example as a PDF file and provided for downloading
If you already created and filled the PDF files, it is more or less a question how to provide the PHP download.

Phpmailer doesnt work in joola on altervista.org Host

I have a form in a joomla website on altervista.org and I use phpmailer to send the output of this form (quote) throught email.
But when I load the page it occurs this error
Fatal error: require(): Failed opening required
'http://lindoelinda.altervista.org/reception2/phpmailer/PHPMailerAutoload.php'
(include_path='.:') in/
membri/lindoelinda/plugins/system/sourcerer/helper.php(607) :
runtime-created function on line 481
the file is well PHPmailer is located in that folder but it seems tell me that file doesn't exist
You should be using the Joomla! jMail class and not phpmailer. There's no point in using Joomla! CMS if your not using its classes and functions.
As it is a simple form you would be best just getting a new form component like rsforms to handle this and remove your custom setup.

blueimp jQuery-File-Upload not working for laravel 5

i am using , https://github.com/blueimp/jQuery-File-Upload plugin for image upload using ajax call in laravel 5. i also refered article http://peterjolson.com/using-laravel-and-jquery-file-upload/. but i am getting the following error error
GET http://localhost:8000/...../server/php/ 500 (Internal
Server Error)
when i use https://github.com/blueimp/jQuery-File-Upload/wiki/Basic-plugin i get the same error. Can anyone help with this or please suggest any working image uploader with ajax call for laravel 5
There is a main.js file, you need to adjust the url there according to the path you store it:
url: '../../uploadimage/server/php/'

Cannot install converseJS properly in Laravel 5

I am working on an application where I am trying to get the chat feature working by using the ConverseJS XMPP client on the front end and Openfire RTC on the back end.
I am working with Laravel 5 on the back end, and being the naive developer I am, I placed the files in the public folder and linked the JS and CSS file to the webpage.
<link rel="stylesheet" type="text/css" media="screen" href="/converse/css/converse.min.css">
<script src="/converse/builds/converse.min.js"></script>
It is working in Firefox and I can see the chat pluigin but in Chrome. The error I see in the console is:
Uncaught Error: See almond README: incorrect module build, no module
name
I am not sure what is causing this. Placing the files in the public folder and linking it to the pages, is this the right way? Or do I have to do something extra in Laravel 5 to get it running?
You receive this error because conversejs uses Almond as a AMD loader and it cannot handle modules without a name.
For example this will trow the error you mentioned:
$(function(){
...
});
So you should use something like this instead:
jQuery(function($){
...
});
More info here
Try to put the conversejs script last and wrap the code for jQuery plugins as mentioned before.

404 error when loading a image

I used ext js framework to build my web site. but there is alway a image that cannot be found, that means always return a 404 error. the image link is "http://localhost/undefined". I checked the HTML, and did not found any tag that its link is like this.
I wonder if I miss some steps when using the ext js framework, do any one know this issues?
have you try define the Ext blank image ??
try this :
Ext.onReady(function(){
Ext.BLANK_IMAGE_URL = '../extjs/resources/images/default/s.gif';
.....
//your code
.......
});
if still not solve.. try update your question with your current code..

Resources