Git Product home page Git Product logo

laravel-nova-pdf's People

Contributors

monaye avatar padocia avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

laravel-nova-pdf's Issues

Issue when generating Pdf

Great Plugin

Getting this error on Linux Server

The command \"PATH=$PATH:/usr/local/bin:/opt/homebrew/bin NODE_PATH=npm root -g node '/var/app/current/vendor/spatie/browsershot/src/../bin/browser.js' '{\"url\":\"file:\\/\\/\\/tmp\\/1068099769-0897319001641134454\\/index.html\",\"action\":\"pdf\",\"options\":{\"args\":[],\"viewport\":{\"width\":800,\"height\":600},\"displayHeaderFooter\":false}}'\" failed.\n\nExit Code: 127(Command not found)\n\nWorking directory: /var/app/current/public\n\nOutput:\n================\n\n\nError Output:\n================\nsh: npm: command not found\nsh: node: command not found\n

Append other pdf

Is there a simple way to append disk stored pdf file(s) to the generated file?

Model field as file name

Is there a way to pass a field of the model the action is currently executed?

Like

protected function filename()
{
    return $this->models->first()->name .  "-Report.pdf";
}

Thanks!

Error output

Hi,
I’ve just installed your package which seems that is great but I am having the following issue:
When running the action to download pdf I am getting the error ……Error output== == ‘node’ is not recognized as an internal or external command!operable program or batch file
I’ve already set the variable path for node.js in my windows 7 control panel
Why is that happening and it would be appreciated if you guide me how to fix this
Thanks

Pdf file is not opening

the pdf file upon opening returns
We can't open this file
Something went wrong.

and the size of the file is 0

implemented method incompatibility

Hello,

Thanks for this package that I am using in my current project.

PHPStan is complaining about something:

Declaration of Padocia\NovaPdf\Actions\ExportToPdf::defaultFilename() must be compatible  with Padocia\NovaPdf\Concerns\WithFilename::defaultFilename(): string in vendor/padocia/laravel-nova-pdf/src/Actions/ExportToPdf.php on line 103.

I think this is because the return type is specified on the abstract method but not on the other one. Can you have a look please ?

Thanks in advance.

Only one model download

Hi,
In your preview photo shows that you are able to select multiple files simultaneously.
If i select more than one rows it just download the pdf that produced from the first model and ignore the others.
Am i doing something wrong?

Thanks for your package
Pampos

Error: Failed to launch the browser process!

Hi, i am in live site and after i followed this #8 i did this:

npm install -g puppeteer
npm link puppeteer

but when i use tinker: Spatie\Browsershot\Browsershot::url('https://nova.laravel.com')->save('test.pdf')

I get this error:

Symfony\Component\Process\Exception\ProcessFailedException with message 'The command "PATH=$PATH:/usr/local/bin NODE_PATH=npm root -g node '/var/www/dotorm.cv/releases/20211123160705/vendor/spatie/browsershot/src/../bin/browser.js' '{"url":"https://nova.laravel.com","action":"pdf","options":{"path":"test.pdf","args":[],"viewport":{"width":800,"height":600}}}'" failed.

Exit Code: 1(General error)

Working directory: /var/www/dotorm.cv/releases/20211123160705

Output:

Error Output:

Error: Failed to launch the browser process!
/usr/lib/node_modules/puppeteer/.local-chromium/linux-901912/chrome-linux/chrome: error while loading shared libraries: libnss3.so: cannot open shared object file: No such file or directory

TROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md

at onClose (/usr/lib/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:203:20)
at Interface.<anonymous> (/usr/lib/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:193:68)
at Interface.emit (events.js:388:22)
at Interface.close (readline.js:429:8)
at Socket.onend (readline.js:202:10)
at Socket.emit (events.js:388:22)
at endReadableNT (internal/streams/readable.js:1336:12)
at processTicksAndRejections (internal/process/task_queues.js:82:21)

Some one can help me pass this error, please (I get this error only on live site in my computer all is working good).

puppeteer requirement

Great plugin!!

just a minor things noticed in the Reame during the installation

  1. composer padocia/laravel-nova-pdf => missing require
  2. npm install puppeteer is also required for your package to work but missing in the document.
message: "The command "PATH=$PATH:/usr/local/bin NODE_PATH=`npm root -g` node '/vendor/spatie/browsershot/src/../bin/browser.js' '{"url":"file:\/\/\/var\/tmp\/559450596-0497906001615420802\/index.html","action":"pdf","options":{"args":[],"viewport":{"width":800,"height":600},"displayHeaderFooter":false}}'" failed.↵↵Exit Code: 1(General error)↵↵Working directory: /public↵↵Output:↵================↵↵↵Error Output:↵================↵node:internal/modules/cjs/loader:900↵  const err = new Error(message);↵              ^↵↵Error: Cannot find module 'puppeteer'↵Require stack:↵- /vendor/spatie/browsershot/bin/browser.js↵    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:900:15)↵    at Function.Module._load (node:internal/modules/cjs/loader:745:27)↵    at Module.require (node:internal/modules/cjs/loader:972:19)↵    at require (node:internal/modules/cjs/helpers:88:18)↵    at callChrome (/vendor/spatie/browsershot/bin/browser.js:44:25)↵    at Object.<anonymous> (/vendor/spatie/browsershot/bin/browser.js:284:2)↵    at Module._compile (node:internal/modules/cjs/loader:1083:30)↵    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1112:10)↵    at Module.load (node:internal/modules/cjs/loader:948:32)↵    at Function.Module._load (node:internal/modules/cjs/loader:789:14) {↵  code: 'MODULE_NOT_FOUND',↵  requireStack: [↵    '/vendor/spatie/browsershot/bin/browser.js'↵  ]↵}↵"

Save PDF on storage

Hi, How to save pdf on storage before preview then, and how can i preview pdf directly on browser without download.

Some Tailwind classes not loaded

Hi there!

I'm trying to use some Tailwind classes to customize background colors or text colors, but doesn't been reflected in the PDF. Others classes like text-2xl or font-extrabold are ok, but if you try to use bg-purple-300 nothing happen.

<!doctype html>
<html>
<head>
    <title>Laravel Nova Pdf Template</title>
    <meta charset="UTF-8"/>
    <link href="{{ asset('css/app.css') }}" rel="stylesheet">
    @foreach ($stylesContents as $stylesContent)
        <style>
            {{ $stylesContent }}
        </style>
    @endforeach
    <style>
        html, body {
            height: 100%;
        }
    </style>
</head>
<body class="tailwind-container">
<section>
    @foreach ($models as $model)
        <div class="grid grid-cols-4 gap-4">
            <div class="bg-purple-300 h-12 rounded-md flex justify-center items-center text-white text-2xl font-extrabold">{{ $model->getKey() }}</div>
            <div class="bg-purple-300 h-12 rounded-md flex justify-center items-center text-white text-2xl font-extrabold">{{ $model->batch->name }}</div>
            <div class="bg-purple-300 h-12 rounded-md flex justify-center items-center text-white text-2xl font-extrabold">{{ $model->telephone->telephone }}</div>
            <div class="bg-purple-300 h-12 rounded-md flex justify-center items-center text-white text-2xl font-extrabold">{{ $model->status->name }} ({{ $model->status->code }})</div>
        </div>
    @endforeach
</section>
</body>
</html>

As you can see the template has been simplifies as max as possible in order to don't have any conflictive CSS class

This is the result that I can see in my PDF
Captura de pantalla 2021-05-09 a las 12 08 05

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.