Git Product home page Git Product logo

Comments (11)

spiritix avatar spiritix commented on September 24, 2024 2

Added Windows support with the current release: https://github.com/spiritix/php-chrome-html2pdf/releases/tag/v1.1

Thanks for reporting.

from php-chrome-html2pdf.

spiritix avatar spiritix commented on September 24, 2024

Hi,
Please install the latest version (1.0.1) and try to run composer update again.
Make sure you don't get any NPM errors or warnings.
You can verify the installation of the NPM packages by navigating to vendor/spiritix/php-chrome-html2pdf and check if there is a node_modules folder.

from php-chrome-html2pdf.

ajaybairagi avatar ajaybairagi commented on September 24, 2024

Still not work. I am working in windows 8

Error
if (mb_strlen($result['output']) === 0) { throw new ConverterException('No data returned'); }

My controller code

    {
             
            $input = new UrlInput();
            $input->setUrl('https://www.google.com');
            $converter = new Converter($input, new DownloadOutput());
            $converter->setOption('landscape', true);
            $converter->setOptions([
                'printBackground' => true,
                'headerTemplate' => '<p>I am a header</p>',
            ]);
            $output = $converter->convert();
            $output->download();
    } ```
 

![composerupdate](https://user-images.githubusercontent.com/4539562/38500559-695f1808-3c28-11e8-8afb-167f0cdcca31.PNG)

from php-chrome-html2pdf.

spiritix avatar spiritix commented on September 24, 2024

This library has not yet been tested on Windows. I will have a look at this once I have some free resources, otherwise PRs are welcome.

from php-chrome-html2pdf.

hakimio avatar hakimio commented on September 24, 2024

@spiritix
There are some known issues with "proc_open()" on Windows. See the following stack overflow thread for more info. You should use "exec()" instead at least on Windows.

from php-chrome-html2pdf.

hakimio avatar hakimio commented on September 24, 2024

Or the best idea might be to use php-shellcommand and let users pass custom config options to the library.

from php-chrome-html2pdf.

spiritix avatar spiritix commented on September 24, 2024

@hakimio The question is how many people would actually use this library on Windows - using PHP on a Windows web server is not a very common use case I guess? Would you like to have support for this as well?

from php-chrome-html2pdf.

hakimio avatar hakimio commented on September 24, 2024

@spiritix What? Why people wouldn't use PHP on Windows?
Yes, I would like to use your library on Windows.

Anyway, imho the best way to handle this would be to use "php-shellcommand" and have "commandOptions" config option where people could pass custom options to "php-shellcommand" like it's done in "phpwkhtmltopdf". Also, have something in README file about this issue.

from php-chrome-html2pdf.

spiritix avatar spiritix commented on September 24, 2024

Well, there certainly are some reasons why I personally would not recommend using PHP on Windows. The most important ones being performance, security, cost, extension and library incompatibilities, small community, no decent CLI, but let's not get into that, everyone should use what he is happy with :)

Back to topic: I am afraid that the problem here isn't just because of how proc_open is being used, it's quite possible that also the way the NPM dependencies are installed doesn't work properly on Windows. Will have a look at this soon.

from php-chrome-html2pdf.

hakimio avatar hakimio commented on September 24, 2024

I don't want to go into deep discussion of pros and cons of using PHP on Windows but...

  • as most people (including me) use Windows only locally for testing, performance, cost, security, etc doesn't matter
  • most PHP libraries, which don't depend on third party executables, work just fine on Windows.
  • If you need linux like cli on Windows, you can use cygwin or similar software (most don't really need that).
  • Talking about community, according to Stack Overflow 2018 survey around 50% of the surveyed people still use Windows as their primary OS (and ~35% develop for Windows platform).

I am using global npm executables (like Angular ng cli) on windows without any issues and "Puppeteer" works on windows as well, so not sure why there should be any issues.

from php-chrome-html2pdf.

hakimio avatar hakimio commented on September 24, 2024

Awesome work 👍

from php-chrome-html2pdf.

Related Issues (20)

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.