How can I display any file inside a web browser? [closed] - php

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

Related

How to save data from phpmyadmin database to pdf? [closed]

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.

Print Automatic PDF from folder [closed]

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 wanted to print pdf which i generate from FPDF in PHP automatically from server's folder.
Is there any way to automatically print PDF from a printer connected to the server from a specified folder?
Or to print the pdf generated in a device accessing that server, from that server's default printer.
We do this, albeit in a slightly hacky way. Here are the steps:
Generate the PDF with FPDF and save it to a location on disk
On the page that has loaded (or from another page) we have an iframe. With JavaScript we set the frame's location to that of the PDF
Again use JavaScript to print the iframe.
Note: our method has us confirm the print dialogue button before it prints. This is possibly something you can set with your printer settings.
If you want to just print without that hassle, there are ways to directly connect to your printer from PHP, but the only one I know of is via a PECL extension, and I think that's Windows only.
Use the fpdf print plugin to print the pdf,Please check this link here each time you open this pdf, it will open the print popup.

Display Document (PDF) Like SCRIBD.COM [closed]

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;

How to download a full HTML page as pdf using DOMPDF? [closed]

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)

PHP website file transfer [closed]

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 4 years ago.
Improve this question
I want to build a website with PHP where my users can host their music files on my server. When my users log into my site, they are presented with a file directory of all their songs, and can drag and drop to add new ones to their collection, delete old ones hosted on my server, rename them, stream music, download it, etc, etc.
My question is this: what is the best way to facilitate this file transfer/showing directories/all stuff mentioned above? FTP? HTTP requests? Speed is key for me. Suggestions?
(And if you might be able to point me to a framework to start with in your response that would be really cool too)
javascript, jQuery, php's opendir();, php's readdir(); with combination of ajax
for streaming, flash player

Categories