Converting HTML to an Image [duplicate] - php

This question already has answers here:
Closed 11 years ago.
Possible Duplicates:
Convert URL to screenshot (script).
PHP: How to capture browser window screen with php?
I have a URL and I want to convert that webpage screenshot to an image. Please let me know if we can do this using php or some other tools that can be used with PHP/Linux.

This isn't the best solution, but you could convert the HTML page to a PDF, then use imagemagick to convert the pdf to a jpeg using this command exec("convert sample.pdf sample.jpeg"). To convert HTML to pdf, see this question.
Convert HTML + CSS to PDF with PHP?

The shutter screenshot tool is able to do that.
It's in the menu: File -> New -> Web
Can be used with Linux and PHP on the same system. See the manpage for commandline options to be invoked from PHP.

Related

How to generate pdf from url [duplicate]

This question already has answers here:
How Can I add HTML And CSS Into PDF [closed]
(30 answers)
Closed 5 years ago.
How could i generate a pdf file using url without using any api ?
Or if any free api provider then please tell me.
I have a file www.highstore.in/myticket.php
In this file php & MySQL is used to get data now i want to convert this data as it is in PDF format.
this is not an API, but you can use a FPDF OPEN SOURCE library, it's too easy to use. you can see some examples here :
FPDF LIBRARY
You can use one of free libraries to generate pdf files
https://ourcodeworld.com/articles/read/226/top-5-best-open-source-pdf-generation-libraries-for-php
If you want to return generated pdf as a result of execution of a PHP script you should change header content-type into
header("Content-type:application/pdf");

how to convert html code to png image using php [duplicate]

This question already has answers here:
Convert HTML to Image in PHP without shell
(5 answers)
Closed 6 years ago.
Is there a php script that allow to convert a html code to a png image.
The problem with GD library is that only convert text to image( and not html code )
There is no pure PHP solution to this.
Basically you've got two options:
Client-side rendering
Use something like html2canvas to render your image using javascript in the browser.
Server-side rendering
Use a library like wkhtmltopdf which can be invoked by PHP to generate the image.
Another server-side solution would be using Phantom.js which can also run javascript before capturing the screen.

How to convert html to pdf or image using Javascript or PHP [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Convert HTML + CSS to PDF with PHP?
How to convert current html rendered in browser
to an image or pdf (so later on i can convert it to image),
using javascript (canvas or anything) or php?
what are the alternative solution?
For PDF conversion, it will help you.
dompdf: HTML to PDF Converter
If you want to generate PDF of HTML+CSS through PHP then There is TCPDF for generating PDF from HTML + CSS.
TCPDF is a PHP class for generating PDF documents without requiring
external extensions. TCPDF Supports UTF-8, Unicode, RTL languages,
XHTML, Javascript, digital signatures, barcodes and much more.
For creating pdf im using FPDF - php library, if you have an option do it with it...
[For converting html to PDF in client side you can use printElement

Html to jpeg as thumbnail [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Website screenshots using PHP
Can someone tell me how to take a thumbnail off of a web page using php or js without any 'API' support? Otherwise convert HTML to PS and PS to jpeg is also possible.
Thank you.
Try Phantom JS. It can be used to render HTML from the commandline, using various output formats. Creating a thumbnail can be done by setting the zoom factor.
WKHtmlToImage is able to render a webpage using webkit engine. You will have to launch an executable on server-side though.

how to take print out of a page in pdf format using php? [duplicate]

This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
Convert HTML + CSS to PDF with PHP?
Which is the best PDF library for PHP?
I am trying to take the print out of a web page in pdf format.
How can this be done?
Take a look at http://www.php.net/manual/en/book.pdf.php or http://www.fpdf.org/
You could use a free save to pdf tool
http://www.dopdf.com/
If you then want to share this with othe people on your website then upload the file and link to it via href
download pdf
You need to use pdf generator library in your php file
Download it from http://sourceforge.net/projects/tcpdf/files/
See README.txt for installation instructions.
You can use one of these:
FPDF
TCPDF
DOMPDF

Categories