|How rotate a pdf document using php?||#1|
How can I rotate a pdf document using php and linux?
posted date: 2008-12-31 08:25:00
|Re: How rotate a pdf document using php?||#3|
You would have to use a external library like this to extract the info a generate an image, then put it back to the pdf(or a new one)EDIT: If your going to get a Logo or a diagram this is a good choice, if its a big document with text and lots of images... its going to be pretty hard, could you edit the OP with more info on what you need?
posted date: 2008-12-31 08:31:00
|Re: How rotate a pdf document using php?||#4|
You will have to access the PDF as a binary file then find and adjust the "Rotate" attribute for each page (and possibly the "MediaBox" attribute). I am not aware of any PDF libraries for PHP that allow for this sort of direct manipulation of existing files. This method will not require changing anything about the content of the pages, it just changes the orientation the pages are displayed in by viewers (similar to the EXIF Orientation information in JPEG images).This snippet of perl should help illustrate what parts of the file you are looking for.
posted date: 2008-12-31 12:51:00
|Re: How rotate a pdf document using php?||#5|
You could use pdf90 from PDFjam.To address some of the other suggestions:I would be wary of adjusting the Rotate attribute directly, as this attribute is stored as text, and (90( or (270( obviously uses a different number of bytes to (0(. I believe inserting the required bytes can make a mess of the index tables that appear at the end of a PDF file. After that, you(re reliant on a viewer being able to interpret the damaged file.Rendering the PDF to an image and rotating that is going to rasterize any text or vector graphics, leading to either a much larger file size, or much lower quality.
posted date: 2009-01-24 03:06:00
|Re: How rotate a pdf document using php?||#6|
There are a few libraries for handling PDFs with PHP.Here(s a good code example using such a library. I found it, just by Googling "PHP PDF":http://www.fpdf.org/en/script/script2.php
posted date: 2009-01-24 03:13:00
|Re: How rotate a pdf document using php?||#7|
Rotate an Entire PDF Document(s Pages to 180 Degrees
$command = "pdftk in.pdf cat 1-endS output out.pdf"; system($command);
posted date: 2009-02-20 20:36:00
|select page: « 1 »|