Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I used dompdf to download a receipt that is initially in HTML format. But as soon as it gets converted, the orientation and the format gets distorted. Is there way to download an HTML page as pdf with the same height and width as the HTML page?
No there is not. Every html->pdf tool are different. some doesnt allow css some allow html5 but very bad. some allow gif etc. lots of variations. You shouldnt look for a tool that render the html page and convert to pdf. You should find something like view the page and get its screenshots of it and print as pdf. because today's complex html pages are just too overwhelming for html->pdf tools. Those tools are made for html coders to create fancy pdfs.
Try to search browser plug-ins. If you find one you can automatize the process via linux konsole. (fire-fox, maybe chrome too not sure though)
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
im new in Webdevelopment and I wanted to ask you ("THE EXPERTS") if you could guide me or give some hints how to do following Webpage:
I want to upload 3-5 Images, place them automatically horizontally on a PDF and let the user download the PDF. I don't want to store the images so after you reload the page the images should be gone.
Could you help me how to realize such webpage? Or atleast which way I should use? Jscript, html5, php etc...
Best regards
Machete
You are looking for a pdf-libary like FPDF.
Especially take a look at the Image() function (Documentation).
quick and dirty, create a php script that executes something like this on the shell:
convert image1.png image2.png image3.png output.pdf
you need to have imagemagick installed.
There are more elegant ways to do that.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I have a database on phpmyadmin. Then I have a website with some products. When user clicks on a specific product, he gets some details about that product. Those details are pulled from the database.
My question is: Is it possible to create a pdf file with the specific details about that product, so the user can download it?
So, the options i know are:
DOMPDF : php class that wrap the html and build the pdf. Works good, customizable, based on pdflib, if i remember right it takes even some CSS. Bad news: slow when the html is big or many complex.
this is a tutorial to follow :http://www.sitepoint.com/convert-html-to-pdf-with-dompdf/
HTML2PS: same of DOMPDF, but this one convert first in .ps (ghostscript), then, in whatever format you need (pdf, jpg, png). For me is little better then dompdf, but have the same speed problem.. oh, better compatibility with css.
Those two are php classes, but if you can install some software on the server, and access it throught passthru() or system(), give a look to these too:
wkhtmltopdf: based on webkit (safari's wrapper), is really fast and powerfull.. seem like is the best one (atm) for convert on the fly html pages to pdf, taking only 2 seconds for a 3 pages xHTML document with CSS2. Is a recent project, anyway, the google.code page is often updated.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I want to display some pdf file on my website, but I do not want people to download the file. like scribd.com that displays the document.
anyone can help me?
If you want to make sure your user cannot download the original PDF file you will have to convert it to something else before.
Scribd converts the PDF to HTML (with one image in the background that contains all non-text objects). I am not aware of any PDF to HTML parsers, so you would have to write your own. Due to the nature of PDF files, this will unfortunately not be easy (see this question for some more details: Convert PDF to HTML in PHP?)
If you are fine with relying on some external web service, you might try this: https://cloudconvert.org/pdf-to-html
As an alternative to parsing the PDF to HTML, you could also just output it as an image. This is much easier to achieve but also not very nice in terms of user experience. If you chose this method, the easiest way would be to use ImageMagick and Ghostscript (see https://stackoverflow.com/a/467805):
<?php
$im = new imagick('file.pdf[0]');
$im->setImageFormat('jpg');
header('Content-Type: image/jpeg');
echo $im;
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I am making a web site where the site needs to keep the user files. My problem: I have a list of files ( docs, pdf, img, xml, excel ). I need to show the user each file's contents when they click a file from the list. I know how to work with img, but other file types I don't. I tried with flexpaper, but it supports only pdf.
My question is : Do you know any way to display any type of file or a library that supports all (or at least more) file types?
If it is important, I use in server side php(exectly yii ). Again one thing is important, the files need to be in my server.
Google doc viewer is support ( docs, pdf, excel ) files, other files e.g. image, xml browser native support,
For instance google doc viewer
<iframe width="100%" height="400" src="https://docs.google.com/viewer?url=http%3A%2F%2Fresearch.google.com%2Farchive%2Fbigtable-osdi06.pdf&embedded=true"></iframe>
Google Doc viewer
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I've seen a couple of topics about this problem - The ability to print through a browser.
Unfortunately the only working solution for me was printing with an iframe.
the problem with iframe is that the browser actually hangs quite a bit when the page loads which is a good annoyance.
Is there any other way I can print a file? Should I display it as a html and print it or keep it pdf and use pdfjs to get it in canvas and print?
All of these though don't allow me to set print options, because I'm trying to send it to a label printer it requires specific dimensions.
Thanks in advance,
Sincerely,
The way I solved this is by installing wkhtmltopdf on my server. Since I use a dynamic page with Javascript to add content I send the whole html page to my php wich stores the html file in a temporary folder on my server and then I use wkhtmltopdf to create the pdf. Once thats done my ajax request opens op that new pdf file. and done you can print that pdf.
Its the best solution I found to print out with pdf files, the problem with other things is that you can't get rid of that extra clutter on the top and footer of the webpages.
Greetings
Ezeky
In the case of an HTML page :
as described here, you can specify css rules for the media type print in your css file. This will be applied when requesting for a print in your browser.