Comments (11)
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.
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.
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.
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.
@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.
Or the best idea might be to use php-shellcommand and let users pass custom config options to the library.
from php-chrome-html2pdf.
@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.
@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.
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.
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.
Awesome work 👍
from php-chrome-html2pdf.
Related Issues (20)
- Problem with page.waitFor HOT 1
- Headers displayed in PDF HOT 1
- Change content-disposition to attachment HOT 6
- Unable to install on Linux Server HOT 1
- Uncaught PHP Exception: Shell error: 133 HOT 4
- Shell error 127 on linux ECS aws server but works fine on local HOT 5
- Binary error HOT 1
- Failed to launch the browser process HOT 1
- Cookies are not sent to Server while fetching content of the URL HOT 1
- No images/css/assets on relative urls HOT 3
- CSS Issue unexpected identifier "font"
- Fatal error: Uncaught Spiritix\Html2Pdf\ConverterException: Binary error: # # Fatal error in , line 0
- [Upgrade] Replace eloquent/composer-npm-bridge by php-forge/foxy HOT 1
- Binary Error -> import getStdin from 'get-stdin'; ^^^^^^^^ SyntaxError: Unexpected identifier at Module._compile HOT 5
- Binary error: Puppeteer old Headless deprecation warning HOT 3
- pageNumber and totalPages are not displayed in footerTemplate HOT 3
- Feature request: Add Auto Height
- urls with "file://" get a "net::ERR_UNKNOWN_URL_SCHEME " error
- Landscape Option Not Working
- Bug: Parameter type mismatch in Converter HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from php-chrome-html2pdf.