mikehaertl / phpwkhtmltopdf Goto Github PK
View Code? Open in Web Editor NEWA slim PHP wrapper around wkhtmltopdf with an easy to use and clean OOP interface
License: MIT License
A slim PHP wrapper around wkhtmltopdf with an easy to use and clean OOP interface
License: MIT License
I'm forcing a PDF download using the $pdf->send()
method, as well as using header-html as an option (with a URL to another page). Debugging through it, if I open the file in /tmp the PDF displays fine with the header and body as it should be.
However the downloaded version (from the browser) does not include the header, only the body. I tried using file_get_contents
instead of readfile
with the exact same results.
I'm using version 1.1.5 - any ideas?
Hi there,
I set this up in Laravel 4 through composer:
"require": {
"laravel/framework": "4.0.*",
"mikehaertl/phpwkhtmltopdf": "dev-master",
"h4cc/wkhtmltopdf-i386": "dev-master"
},
did composer update..
code it in my Controller:
public function getDownload() {
$pdf = new Pdf('http://google.com');
die(var_dump($pdf->saveAs(public_path().'/uploads/testtest.pdf')));
}
and I got this error:
rename(,.pdf): No such file or directory.
Any idea where I could have done wrong?
I'm running on Mac OSX, php 5.4.19, XAMPP.
Thanks!
Hello,
I'm wondering if it's possible to set the page orientation (portrait v landscape) on individual pages instead of globally. I have a need for individual pages to be different orientations across my document.
Thanks.
I am trying to make the generated PDF be displayed in the user's browser instead of being downloaded, so I replaced $pdf->send('Voucher.pdf')
with $pdf->send()
but it still makes the file to be downloaded automatically instead of being viewed inside the browser!
i want to save diferent pdfs, but only save the same pdf
this is the code that i use
$pdf = new Wkpdf_Utility();
$x = 0;
foreach ($XMLs as $file) {
$this->view->data = $file;
$pdf->addPage($this->view->render("pdf.phtml"));
$pdf->saveAs(APPLICATION_PATH.'/../data/temp-pdf/'.$x.'.pdf');
}
i am getting this error in my pdf.php
Fatal error: Class 'mikehaertl\wkhtmltopdf\pdf' not found in C:\xampp\htdocs\p\billPdf.php on line 6
and plz help me how should i convert a file to pdf on a click of a button..
and thanks for your project man it's helping a lot of people...
Hi,
I'm wondering what the licence is on this wrapper. MIT?
Thanks,
Pete
I'm just trying a simple test but its only returning this in browser:
binary = __DIR__ . '/vendor/bin/wkhtmltopdf-i386'; $pdf->saveAs('/tmp/new.pdf'); ?>
I'm not quite sure why, here's my basic test code:
<?
use mikehaertl\wkhtmlto\Pdf;
// You can pass a filename, a HTML string or an URL to the constructor
$pdf = new Pdf('/printRdy.php');
// If you installed the binary through composer, you need to configure
// the right path to the binary (modify to match your path/version):
$pdf->binary = __DIR__ . '/vendor/bin/wkhtmltopdf-i386';
$pdf->saveAs('/tmp/new.pdf');
?>
Hi,
first great work, thanks :)
Now the issu :
I try to use phpwkhtmltopdf with somme javascript but i got error with no text error :
this is my error :
Could not run command "C:\inetpub\wwwroot\Communication\Appli\script\..\includes\wkhtmltopdf_x64.exe" --encoding "UTF-8" --orientation "Landscape" --margin-bottom "10mm" --margin-top "20mm" --header-spacing "10" "C:\inetpub\wwwroot\Communication\Appli\script\..\..\Donnees\crises\200\upload\temp\1404832841_tmp_file.html" "C:\Windows\Temp\tmp5E63.tmp":
and this is the content of 1404832841_tmp_file.html :
<!DOCTYPE html><html><head></head><BODY><div>foo</div><script type="text/javascript">document.write("bar");</script></BODY></HTML>
if i set the option disable-javascript, it generate the pdf but whithout "bar"
The same command in shell generate pdf.
what i tried get stdout and system() like you said here
whitout success :(
If you have some idea...
(sorry for my english )...
it seems like you have to change
$process = proc_open($command, $descriptors, $pipes, null, null, array('bypass_cmd'=>true));
to
$process = proc_open($command, $descriptors, $pipes, null, null, array('bypass_shell'=>true));
to get this class working in windows
(http://php.net/manual/en/function.proc-open.php)
I can't get the .exe to run from the php script. Has anyone got it working under Windows 7? ( the cmd command works fine) What/ where did you have to set permissions? I have changed permissions under Properties> Security for the bin folder, but no luck. I am a secondary user on the machine, and set as Administrator, the html is in Wamp. Please don't post links to windows list of errors or wkhtmltopdf - nothing helpful there.
When I tried to generate pdf from google.com page, it won't work and the following error has been dumped out:
string(541) "Could not run command '/var/www/html/pdftext/vendor/h4cc/wkhtmltopdf-amd64/bin/wkhtmltopdf-amd64' 'http://www.google.com.jp/' '/var/www/html/pdftext/app/storage/pdf/tmp/pdf_d5b63d348ddb0ae043a70a6d468a2875': Loading pages (1/6) [> ] 0% [======> ] 10% Error: Failed loading page http://www.google.com.jp/ (sometimes it will work just to ignore this error with --load-error-handling ignore) Exit with code 1 due to http error: 1003 "
When I ran the command using the above command, it did generate a file in tmp folder (with no pdf extension).
Please tell me where I did wrong!!
Thank you very much.
May i suggest another change, with regard to using HTML strings.
The wrapper checks for the presence of <html>
tag in the regex. In my case, the <html>
is declared in a common place for using in both web view and producing the pdf. And the tag is declared as <html lang="en">
.
My suggestion is to check for the closing html tag </html>
which will not contain any additional attributes/properties, implemented through a minor change:
const REGEX_HTML = '/<\/html>/i';
or maybe not just using strpos()
instead of regex.
I have html date (table with 32 cols and 135 rows in it) on 6 pages of A4 page.
80% of my attempts trying to generate pdf file from this html - fails with an error:
Fatal error: Uncaught exception 'Exception' with message 'Could not create PDF: Could not run command '/var/www/site/bin/wkhtmltopdf-amd64' --footer-center '[page]/[topage]' --dpi '250' --orientation 'landscape' --user-style-sheet '/var/www/site/htdocs/css/pdf.css' --footer-font-size '9' --outline-depth '0' /tmp/tmp_WkHtmlToPdf_qX3Waz.html /tmp/tmp_WkHtmlToPdf_gi862w: ' in /var/www/site/includes/functions/system.php:122 Stack trace: #0 /var/www/site/htdocs/index.php(201): topdf('??? ?
I've commented __destructor()
to keep tmp files alive and try to reproduce this error via console, but in console everything works perfect (I'm executing the same command, that shows in error)
With other html data your script works fine for me!
How to find where the problem is?
In case you're not aware, the new version is out:
http://wkhtmltopdf.org/downloads.html
Apparently, this version is "headless" and do not require a display or display service.
Meaning we can get rid of all the xvfb stuff. I'll give this a try within the next month and let you guys know if it works. If someone has time to test it earlier that'd be great.
Using addTOC & addCover caused fatal php error.
Adding the leading "--" to the relevant lines in addTOC & addCover functions seemed to fix this error and PDF was successfully generated.
E.g:
$options[''input] = "--cover $input";
&
$options['input'] = "--toc";
I have been using wkhtmltopdf for a long time. It works great with html elements. But when svg elements come, though it generates the pdf but svg elements are not rendered.
Would a toString() option be a good addition? See below for code:
/**
* Return the PDF as a string
*
* @return string of PDF
*/
public function toString()
{
if (($pdfFile = $this->getPdfFilename())===false) {
return null;
}
return file_get_contents($pdfFile);
}
Hi, thanks for your wrapper, it's really great and easy to use.
As the title states, sometimes the wkhtmltopdf binary completes, prints "Done", then prints an error message stating
Exit with code 2 due to http error: 404 Page not found
I'm sure this is not a problem with your wrapper, and I'm pretty sure it's something I've done wrong, but it seems to appear to other people:
https://code.google.com/p/wkhtmltopdf/issues/detail?id=548
So I have a proposed "fix" (read: hack) to work around it for now.
I'm new to Git and GitHub, so I've made a patch but I don't know how to post it.
Below are the contents (please keep laughing to a minimum):
diff --git a/WkHtmlToPdf.php b/WkHtmlToPdf.php
index d2c6279..27f43de 100644
--- a/WkHtmlToPdf.php
+++ b/WkHtmlToPdf.php
@@ -307,7 +307,17 @@ class WkHtmlToPdf
$result = proc_close($process);
if($result!==0)
- $this->error = "Could not run command $command:\n$stderr";
+ {
+ if ( (!file_exists($fileName)) || (filesize($fileName)===0) )
+ {
+ $this->error = "Could not run command $command:\n$stderr";
+ }
+ else
+ {
+ $this->error = 'Warning: an error occurred while creating the PDF, but some data was written';
+ return true;
+ }
+ }
} else
$this->error = "Could not run command $command";
Hello, first of all, thank you for your Wrapper, it's really usefull !
I have a problem with some pages like: http://gridster.net/
When i run this command directly with the tool, i get this error:
"Exit with code 1 due to network error: ContentNotFoundError"
But the pdf file is fully generated.. It's this function which catch the errors on generation:
/**
* @return mixed the temporary PDF filename or false on error (triggers PDf creation)
*/
public function getPdfFilename()
{
if ($this->tmpFile===null) {
$tmpFile = tempnam($this->getTmpDir(),'tmp_WkHtmlToPdf_');
if ($this->createPdf($tmpFile)===true) {
$this->tmpFile = $tmpFile;
} else {
return false;
}
}
return $this->tmpFile;
}
It's possible to make a better error catching ? For the moment, i just added, a filesize verification on the tmpFile generated and if it's not null, i send the file, i'm pretty sure that there is a better way.
Thank for reading
4f0a3cb Now you can set the xvfb usage with a simple function.
You only need to have xvfb-run into your system and phpwkhtmltopdf will set the needed command string to execute under xvfb.
Usage:
# Set xvfb auto detect executable xvfb-run location (only unix/linux)
$pdf->setXvfb(true);
and
# Set xvfb bin manually
$pdf->setXvfb('/usr/bin/xvfb-run');
Hi all, I'm using the following:
// Save the PDF
$pdf->saveAs('/home/path/images/PDFs/new2222.pdf');
if(!$pdf->saveAs())
throw new Exception('Could not create PDF: '.$pdf->getError());
Which produces the following error although saves the file perfectly:
Warning: Missing argument 1 for WkHtmlToPdf::saveAs(), called in /home/path/testScreenshots/test.php on line 22 and defined in /home/path/testScreenshots/WkHtmlToPdf.php on line 172
Warning: copy() [function.copy]: Filename cannot be empty in /home/path/testScreenshots/WkHtmlToPdf.php on line 177
If I try reverse the error check I get the same
if($pdf->saveAs()) {
echo 'ok';
}
I cannot figure out how to get the options to work for me, rather it be global or page options.
hello i am beginner and wants to know all from scratch .
and how to do this "The wkhtmltopdf binary must be installed and working on your system".
i don't know how to install wkhtmltopdf on localhost on wamp/xampp and use your tool.
Hi,
Debian wheezy 7.3, localhost
wkhtmltopdf --use-xserver --disable-javascript --no-background --no-images --grayscale --header-left "[webpage]" --footer-center "[page]/[topage]" --footer-right "[date]" http://github.com/mikehaertl/phpwkhtmltopdf README.pdf
generates the pdf
$pdf->addPage('http://google.com);
$pdf->send('README.pdf');
generates the pdf, however:
$pdf->addPage('http://github.com/mikehaertl/phpwkhtmltopdf');
$pdf->send('README.pdf');
does not generate the pdf
print_r($pdf) output:
WkHtmlToPdf Object ( [binPath:protected] => [binName:protected] => wkhtmltopdf [enableEscaping:protected] => 1 [version9:protected] => [options:protected] => Array ( [0] => grayscale [1] => no-images [2] => no-background [header-font-size] => 10 [header-left] => [webpage] [footer-center] => [page]/[topage] [footer-right] => [date] ) [pageOptions:protected] => Array ( ) [objects:protected] => Array ( [0] => Array ( [input] => http://github.com/mikehaertl/phpwkhtmltopdf ) ) [tmp:protected] => [tmpFile:protected] => [tmpFiles:protected] => Array ( ) [procEnv:protected] => [isWindows:protected] => [enableXvfb:protected] => [xvfbRunBin:protected] => [xvfbRunOptions:protected] => --server-args="-screen 0, 1024x768x24" [error:protected] => [localOptions:protected] => Array ( [0] => binName [1] => binPath [2] => tmp [3] => enableEscaping [4] => version9 [5] => procEnv [6] => enableXvfb [7] => xvfbRunBin [8] => xvfbRunOptions ) )
neither does
$pdf->addPage(""http://github.com/mikehaertl/phpwkhtmltopdf\"");
$pdf->send('README.pdf');
generate the pdf
Cheers,
Alan
I am having problems adding multiple pages to a PDF document using the great PHP wkHTMLToPdf wrapper.
The following code just gives me a blank page.
require_once('phpwkhtmltopdf/WkHtmlToPdf.php');
$pdf = new WkHtmlToPdf;
$pdf->addPage('http://www.google.co.uk');
$pdf->addPage('http://www.google.co.uk');
$pdf->send('test.pdf');
exit();
but this works fine.
require_once('phpwkhtmltopdf/WkHtmlToPdf.php');
$pdf = new WkHtmlToPdf;
$pdf->addPage('http://www.google.co.uk');
$pdf->send('test.pdf');
exit();
Hey! I've been trying for a while now but i can't seem to use both methods at the same time. I'll explain my needs and problems. :D
I have a script generating html strings containing varied info and I have no problem generating the document. But i'd like for users to be able to view the document on the browser window and, only if they want to, save the document. The problem is that when the pdf's save button is pressed, i'm prompted to save the php script instead of .pdf! So, my alternative would be forcing users to view AND save the document (which is wrong but would kind of solve it).
Is there a way to change the filename used to save the document or use both send() methods?
Thanks for your time. :)
header("Content-Disposition: $inline; filename=\"$filename\"");
Should be:
header("Content-Disposition: $disposition; filename=\"$filename\"");
I'm trying to get the binary string right because I keep getting this error:
'/..\..\..\Program' is not recognized as an internal or external command, operable program or batch file.
And here's the getCommand():
"/..\..\..\Program Files\wkhtmltopdf\bin\wkhtmltopdf.exe"/ --no-outline --margin-top "0" --margin-right "0" --margin-bottom "0" --margin-left "0" --disable-smart-shrinking "printRdy.php" "C:\Windows\Temp\tmpBA0B.tmp.pdf"
From this code:
<?php
require_once '/vendor/autoload.php';
use mikehaertl\wkhtmlto\Pdf;
$options = array(
'no-outline', // Make Chrome not complain
'margin-top' => 0,
'margin-right' => 0,
'margin-bottom' => 0,
'margin-left' => 0,
// Default page options
'disable-smart-shrinking'
);
$pdf = new Pdf($options);
$pdf->binary ='"/..\..\..\Program Files\wkhtmltopdf\bin\wkhtmltopdf.exe"/';
$pdf->addPage('printRdy.php');
$pdf->saveAs('print.pdf');
echo $pdf->getError();
echo "<br>", $pdf->getCommand();
?>
I know this is the right string path because I ran php-shellcommand with this string and the command executes just fine. Here's the string I ran in php-shellcommand:
'"/..\..\..\Program Files\wkhtmltopdf\bin\wkhtmltopdf.exe"/ http://localhost/Ponudomat/printRdy.php print.pdf'
So the problem is created by "/ and the wired thing is that the same is in the s
This fails:
$pdf->addPage('http://www.example.com/index.php?a=1&b=2');
Console:
This fails:
/usr/bin/wkhtmltopdf http://www.example.com/index.php?a=1&b=2 /tmp/foo
This works:
/usr/bin/wkhtmltopdf 'http://www.example.com/index.php?a=1&b=2' /tmp/foo
I think you can see the problem. Where in the code can I fix this?
When I try to build a pdf from an external url I get this error.
PHP Fatal error: Uncaught exception 'Exception' with message 'Could not create PDF: Could not run command "wkhtmltopdf" --no-outline --margin-top "0" --margin-right "0" --margin-bottom "0" --margin-left "0" "http://google.com" --disable-smart-shrinking "C:\Windows\Temp\tmp58E1.tmp"
However when I run this command myself it works perfectly so I don't think it is a wkhtmltopdf issue. The error is thrown from line 334 which makes me think proc_close is passing an error along. The pdf file is also not created.
When the --header-*
or --footer-*
option is set with a string containing spaces, the wrapper does not output the result.
For example, this option is not working:
$pdf->setOptions(array('header-left'=>'"ABC A"', ));
Altering the nested quotes in any combination of single/double quotes is also not working. Also, escaping " with \ is not working. But the $command
string created by the wrapper works fine when pasted directly at the command prompt.
In the Windows version, the error thrown is:
'C:\Program' is not recognized as an internal or external command, operable program or batch file.
where $bin is set to "C:\Program Files (x86)\wkhtmltopdf\wkhtmltopdf"
Tested with wkhtmltopdf 0.11.0 rc1 and PHP 5.4.15 Running Nginx web server.
$pdf->send() or $pdf->send('filename.pdf') did not work.
To fix this simply add this two lines inside send() function.
ob_clean();
flush();
(before readfile and after if, here is example)
if($filename!==null)
header("Content-Disposition: attachment; filename=\"$filename\"");
ob_clean();
flush();
readfile($pdfFile);
return true;
The first option set without argument will not visible in the generated command string, because it's key is 0 and the in_array part of setOptions method will fail.
$options = array(
'encoding' => 'UTF-8', // option with argument
'print-media-type', // option without argument
'no-outline', // option without argument
);
'print-media-type' will not exist in command string.
in_array(0, array('bar', 'foo')); // returns true
Affected code:
https://github.com/mikehaertl/phpwkhtmltopdf/blob/master/WkHtmlToPdf.php#L158
in_array should used with strict = true
Hello, thanks very much for the wrapper.
I have a few requests for which I included a patch below:
Btw, what's the use for the setPageOptions()? I think it is redundant because the wkhtmltopdf manual states "Options for the page object can be placed in the global options and the page options areas.". So wkhtmltopdf already applies page options supplied globally to every page added.
Index: WkHtmlToPdf.php
===================================================================
--- WkHtmlToPdf.php (revision 56)
+++ WkHtmlToPdf.php (working copy)
@@ -152,6 +152,16 @@
}
/**
+ * Return the PDF as a string.
+ *
+ * @return mixed the PDF contents or false on error (triggers PDf creation)
+ */
+ public function getPdf()
+ {
+ return @file_get_contents($this->getPdfFilename());
+ }
+
+ /**
* Set global option(s)
*
* @param array $options list of global options to set as name/value pairs
@@ -228,6 +238,7 @@
/**
* @return string path to temp directory
+ * @throws LogicException when the directory is not a directory or is not writeable
*/
public function getTmpDir()
{
@@ -235,6 +246,10 @@
$this->tmp = sys_get_temp_dir();
}
+ if (!(is_dir($this->tmp) && is_writeable($this->tmp))) {
+ throw new LogicException($this->tmp.' is not a writeable directory');
+ }
+
return $this->tmp;
}
@@ -341,6 +356,8 @@
foreach($options as $key=>$val)
if (is_numeric($key)) {
$out .= " --$val";
+ } else if (is_array($val)) {
+ $out .= " --$key ".implode(' ', $this->enableEscaping ? array_map('escapeshellarg', $val) : $val);
} else {
$out .= " --$key ".($this->enableEscaping ? escapeshellarg($val) : $val);
}
I'm trying to get wkhtmltopdf to use a stylesheet, but it doesn't seem to be reading it at all. I'm using:
$pdf->setPageOptions(array('user-style-sheet'=>'/css/layout.css'));
(I also did try to use the full url for the style sheet)
The content I am adding to the pdf is from html text - not from a url - so I also tried linking the style sheet as I would in a normal page:
<!doctype html><!html><!head><!meta charset="UTF-8"><!title>'.$doc['doc_name'].'<!/title><!link rel="stylesheet"href="/css/Layout.css"/><!/head><!body>.......content.........<!/body><!/html>
But it doesn't read this at all. All that it will read is if I put the style inline
<!div style="margin-bottom:2rem">....content....<!/div>
or if I put it in a style section in the html head
<!doctype html><!html><!head><!meta charset="UTF-8"><!title>'.$doc['doc_name'].'<!/title><!style>.divClass{margin-bottom:2rem;}<!/style><!/head><!body>........content........<!/body><!/html>
Any suggestions would be great!!
(obviously my code doesn't have all the ! in it - did that so it would be visible and not try to render it)
19ac210 Added wkhtmltopdf binary auto detect with a simple function.
You can use it or not, but the change from your revision is that if you don't want to use auto detect, you must define absolute path to binary, phpwkhtmltopdf now only contains the binary file basename.
Hi,
I'm currently trying to use your wkhtmltopdf but I cannot get passed a Warning call saying :
Warning: proc_open() [function.proc-open]: CreateProcess failed, error code - 87 in Path/To/WkHtmlToPdf.php on line 325
I tried with a basic code given in the tutorial but it doesn't work.
$pdf = new WkHtmlToPdf;
$pdf->addPage('http://google.com');
$pdf->send();
The error code 87 stands for invalid parameter.
Anyone can help me ?
Thank you
First, thanks for taking to time to write this PHP wrapper class.
I'm in a bit of a bind and don't have a clue on how to fix this issue. My server is running Windows Server 2008 R2, PHP 5 and Tomcat Apache.
The error cites line 300 in the WkHtmlToPdf.php file:
$process = proc_open($command, $descriptors, $pipes, null, null,barray('bypass_shell'=>true));
I'm not quite sure what this error means, and after googling it there were no viable answers. I think this is more a Windows error than PHP error, but no idea how to resolve it. Any help is greatly appreciated.
Michael
Hi,
I'm using laravel framework and installed on my local machine (windows OS with wamp server installed, AMD) the package together with the binary using composer.
I created a test class. Please see below:
use mikehaertl\wkhtmlto\Pdf;
class PDFConverter {
public function __construct() {
}
public function createPDF() {
$pdf = new Pdf('http://gmail.com/');
$pdf->binary = base_path(). '/vendor/bin/wkhtmltopdf-amd64';
$pdf->saveAs(base_path()."/public/documents/sample.pdf");
//$pdf->send();
$pdf->send('sample.pdf');
var_dump($pdf);
}
However, the generated pdf file was 0kb and my pdf reader showed an alert with this message, "format error, not a pdf or corrupted".
I really don't know what caused this error.
Please help. It's been weeks since I've been searching for a good package that will convert html file to pdf with too many nested tables.
Thank you!
68ae639 I have updated source style to clarify some code parts.
I'm respecting PSR-2 compilant all as I can ;)
Legibility opinion is like nose, everyone has one.
I am converting HTML to PDF with wkhtmltopdf-i386 on Ubuntu 11.10 , Using PHP. With simple HTML and text it is working fine but But HTML script with SVG and Canvas render Blank result means PDF generating but blank.
Add pdf files is not working.
Returns :
Could not run command 'wkhtmltopdf/./wkhtmltopdf.app/Contents/MacOS/wkhtmltopdf' /wkhtmltopdf/tmp/rel.PDF /private/var/folders/47/z5_vl81j7hq082xscfv10sf40000gn/T/tmp_WkHtmlToPdf_AjBXBK: Loading pages (1/6) [> ] 0% [======> ] 10% [============================================================] 100% Error: Failed loading page http:///wkhtmltopdf/tmp/rel.PDF (sometimes it will work just to ignore this error with --load-error-handling ignore)
I'm using version 1.10 and added the _headerHtml variable with its getter and setter. Also in the _getCommand function I added the line
command. = (mb_strlen ($ this-> getHeaderHtml ())> 0)? . "- Header-spacing 15 - header-html " "$ this-> getHeaderHtml ()" \ "": "",. However, the header is not shown, but shown footer
thanks
6310f5a Added suport to proc_open environment parameters.
Added as new option to __construct and setOptions functions.
Usage:
$pdf = new \WkHtmlToPdf([
'procEnv' => ['option1' => 'value1']
]);
Hi,
Great job with this tool.
I was trying to get this working but I think there are some files missing ( i downloaded through here the latest version).
For example mikehaertl\shellcommand\Command as BaseCommand is required.
Much appreciated
I have noticed another issue. Output above 6 pages is not working.
I am trying to generate PDF through a string.
Example, i have created a table in html, which when output in A4 size would come to 8 pages. If the page is set to A3, the output is received (coming upto 6 pages), but on changing the paper size to A4, there is no output.
Typing the instruction, generated through the class, at the Windows command prompt works, with A4 output correctly being received in 8 pages, but doing the same in PHP produces no ouput.
Debugging hangs in this line:
$stdout = stream_get_contents($pipes[1]);
I am getting the following error while generating PDF's:
Could not create PDF: Could not run command '/usr/bin/wkhtmltopdf' --no-outline
--margin-top '0' --margin-right '0' --margin-bottom '0' --margin-left '0'
/tmp/tmp_WkHtmlToPdf_Re96FH: sh: -c: line 0: syntax error near
unexpected token `newline' sh: -c: line 0: `'/usr/bin/wkhtmltopdf' --no-outline
--margin-top '0' --margin-right '0' --margin-bottom '0' --margin-left '0' '
I have setup the basic example as shown on the wiki page.
When I try to add a footer using this code nothing shows up.
$footer = "<html><div style='height:2.54cm;width:100%;background:#cccccc;'>Hello how are you<br/>hhhh<br/>hhhh</div></html>";
$pdf->addPage($top.$specHtml.$modelHtml.$picHtml, array('footer-html' => $footer));
Everything else is generated fine.
When I use the same code but with header-html it show a small white space at the top of my pages but no other content is inserted.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.