PDF Thumbnailer - php

I am scratching my head with this one, how can you get a screenshot or a thumbnail of a PDF? I am developing a social feed on a web server I have no control over, there is a PDF class but I cant narrow down what it is, and theres no function in there for this task.

To do this serverside, you could use ImageMagick. This allows PDF's to be converted into images on the server, not having to depend on the client's browser to have certain software.
You do need to be able to install ImageMagick on the server though.
A link to a guide can be found here

You can use google docs
https://docs.google.com/viewer?a=bi&pagenumber=1&url=http://url-of-your-pdf.pdf
It returns a png of the first page, you can then edit it using Imagemagick or similiar
Idea from: How to create thumbnails/screenshots out of PDF files on my Linux server?

Related

generate images from swf

Is there any library/module available with which i can generate images from a swf file?
The problem i am trying to solve is: I want to create a pdf from a web page and i am having problems in doing that when the web page has swf (question in stackoverflow)
I am thinking if i am able to read a swf and write out an image, i will be able to solve the above the problem
Will appreciate your help, Thanks
In fact, that is quite a hard task. I've spent hours looking for a program that could fulfill such a task. However, I eventually only found one. It isn't open-source but would really help you I guess.
Flash Animation Source can output all frames of a SWF file. It uses a DirectShow filter to do so. Therefore, a Windows operating system is required should you not want to use WINE.
In short, you'll just need to install Flash Animation Source on your computer and then find a way to get DirectShow frames using your desired programming language. Everything else is actually quite easy. You tell Windows the directory and the name of your SWF file and it'll do the rest, thus delivering you with an image. And did you know DirectShow filters can deliver all frames of a video? Therefore, you can choose which one you'd like to have.
By the way, please don't try to find another way to get an image of your SWF file. Believe me, you won't find one. I have looked for an open-source program that fits my needs but all of them fail. You need to use the propriertary Adobe Flash player for your outputs. There is no other option as the open-source alternatives still need a lot of development to genuinely output the vector-based frame as it is.

PHP rotate video

I have my own video sharing app,
My question is... is there any library,script or something else, to help me in rotating videos whatever their file extension is?
Many peoples are uploading videos but sometimes i found video (guessing shared with iphones or mobile phones) and i see them horizontally instead of vertically...
Does anyone have any ideas how to rotate them dynamically?
Im not familiar with any "libraries" that will do that. I think your better bet would be to find a command-prompt-enabled video software package (like Any Video Converter [See Q7]) that PHP can execute via command prompt on the fly.
PHP doesn't do that, and there are no extensions that I know off, made for that purpose.
You can use ffmpeg to manipulate videos, by calling it from your scripts (see shell_execute() and such functions). Reading the ffmpeg documentation will help you figure what can (and can't) be done with that powerful tool.

Open Source Web PDF Viewer?

Is their any Open Source Web PDF Viewer?
Which has good api through which I can modify the looks of the viewer?
I had tried the Scribd, Google Docs, FlexPaper , and this also.
But it is not giving me, as I want.
Then i had downloaded the shadowbox but it has not given me information about how to use it?
So anyone know good web pdf viewer and it would be great if it offers the customization
And that should be great if it is in php.Thanks in advance...
I don't think you're going to find a PDF viewer that's in PHP. The decoding of the PDF format happens on the client, which means your only options are either relying on the client to do the decoding work for you (Adobe Reader, Google Chrome's built-in reader, OS X's Preview app, etc.), rendering it with Javascript, or figuring out some way to convert the PDF into HTML.
PDFs are so ubiquitous these days, that it doesn't make a whole lot of sense to me to want to try to render it for a client; rather, simply tell them that the file they're downloading is a PDF and offer links to either Chrome or Adobe Reader, and let the user view the PDF in whatever app they please.
There is a wonderful pdf viewer which is opensource too. The ui implementation is basic. You will have to work on it. But its awesome.
http://view.samurajdata.se/
There is also a project from Mozilla called PDF.js. They're hoping to get it to a point where it's available as part of Firefox.
Get it at: http://mozilla.github.com/pdf.js/
I've tried it out myself and it works very well. The only issue is the source JS files are about 1.4mb which is rather large and I couldn't minify them due to some weird coding standards.

Pdf on web page: best solution

I need to include pdf files in some webpages, and I'm gettin' in troubles.
The app is a simple newspaper's archive, in which i can read right on page or download as pdf files, one file per page. What my customer can provide me is one pdf file for each page; what my customer wants from me is to navigate them in indexes (with page thumbnail) and have a read from a choosen one direcly in page; I'm using php/mysql.
I started trying out to use the <object> tag with type="application/pdf", but i found it's deprecate 'cause it's not crossplatform at all (there's no support on linux's browsers, but even my windows' firefox 3.5 couldn't show me anything).
I guessed I could transform that pdf in something different (html or simply images are good enough), but the only thing i found is ImageMagick, that I cannot use as I must install on server and I can't, as I'm not admin of that machine.
So, I'm finally looking for suggestions
Thanks
Display the pdf inline using an IFRAME. The thumbnail you can generate with imageMagik. You should be able to use the command line version of ImageMagik to resize and convert to jpg.
edit
Your best bet is to talk to the server admin and have them install php support for ImageMagik then you can use it as a class.
If you can't get support to install on the server, you will have to use the command line version.
You might be able to Google around for a library that wraps the command line, but it would be trivial to write it yourself.
With this in place you can create a large readable black and white png for each page. It should click through to the pdf.

How can I generate a screenshot of a webpage using a server-side script?

I need a server-side script (PHP, Python) to capture a webpage to a PNG, JPG, Tiff, GIF image and resize them to a thumbnail.
What is the best way to accomplish this?
See also:
Web Page Screenshots with PHP?
How can I take a screenshot of a website with PHP and GD?
How might I obtain a Snapshot or Thumbnail of a web page using PHP?
You can probably write something similar to webkit2png, unless your server already runs Mac OS X.
UPDATE: I just saw the link to its Linux equivalent: khtml2png
See also:
Create screenshots of a web page using Python and QtWebKit
Taking automated webpage screenshots with embedded Mozilla
What needs to happen is for a program to render the page and then take an image of the page. This is a very slow and heavy process but it can be done in PHP on Windows.
Also check the comments in the documentation article.
For python I'd recommend reading this article. It highlights some of the solutions.
There are services you can also call (via some API) that will return you an image. But usually they cost (WebShots for example)
You'll need to:
read the webpage and all the its multimedia content (images, flash, etc)
utilize a browser rendering engine to render the webpage
take a screenshot and save it as image
first and third steps are easy, the second step is more challenging ;)
If you are using php, you could use imagegrabscreen (PHP 5 >= 5.2.2). Imagegrabscreen: captures the whole screen.

Categories