IgnacioB's avatar

Generate PDF with tailwind

i'm trying to generate pdf with tailwind css styls. Any ideas what can i use ?

0 likes
3 replies
IgnacioB's avatar

@tangtang im having this problems

Error:

Symfony \ Component \ Process \ Exception \ ProcessFailedException
PHP 8.1.1910.23.1
The command "PATH=$PATH:/usr/local/bin:/opt/homebrew/bin NODE_PATH=`npm root -g` node '/usr/share/nginx/html/vendor/spatie/browsershot/src/../bin/browser.cjs' '{"url":"http:\/\/dk-devworker00:8401\/searchs-pdf","action":"pdf","options":{"args":[],"viewport":{"width":800,"height":600}}}'" failed. Exit Code: 127(Command not found) Working directory: /usr/share/nginx/html/public Output: ================ Error Output: ================ sh: 1: npm: not found sh: 1: node: not found

php:

use Spatie\Browsershot\Browsershot;

public function downloadPdf(){
    Browsershot::url(url()->previous())->pdf();
}

install:

composer require spatie/browsershot
npm install puppeteer

im using docker containers i think from some research, i need to install chromium but im not sure.

Research:

min: 31:30
https://www.youtube.com/watch?v=etjRY-SLQ6A&ab_channel=JamesMcDonald
tangtang's avatar

you typically need to install Chromium because it provides the necessary browser components for Puppeteer to function. When running headless, Puppeteer interacts with the headless browser to take screenshots, generate PDFs, or perform other browser automation tasks

Please or to participate in this conversation.