This is a discussion on google books within the PHP General forums, part of the PHP Programming Forums category; Not a PHP question. but could someone point me in the direction of how to download/display only a portion ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Not a PHP question. but could someone point me in the direction of how to
download/display only a portion of a PDF, much like google books does? For example, if you have a 200 page pdf, but the user wishes to see the portion that is on page 150. rather than downloading the entire PDF, only download/display page 150? I would like to avoid having to split them into 200 individual PDF's (whether manually or automatically). Any suggestions? - JP |
|
|||
|
John Pillion wrote:
> Not a PHP question. but could someone point me in the direction of how to > download/display only a portion of a PDF, much like google books does? For > example, if you have a 200 page pdf, but the user wishes to see the portion > that is on page 150. rather than downloading the entire PDF, only > download/display page 150? > > > > I would like to avoid having to split them into 200 individual PDF's > (whether manually or automatically). > > > > Any suggestions? > > > > - JP > > You could use FPDF and FPDI to just load up the one page: http://www.setasign.de/support/manuals/fpdi/ Just use importPage($thePageNumberYouWanted); <code> $pdf = new fpdi('P', 'pt', 'letter'); $pdf->setSourceFile(self::PATH); $tpl = $pdf->ImportPage(1); $pdf->AddPage(); $pdf->useTemplate($tpl, 0, 0); $data = $pdf->buffer; $pdf->closeParsers(); header("Content-type: application/pdf"); header("Content-disposition: inline; filename=FileName.pdf"); header("Content-length: " . strlen($data)); echo $data; </code> I just realized that the version of FPDI I've been using is a little old. There's a new update out, so some of the above code might change a little. -- Ray Hauge www.primateapplications.com |
![]() |
| Thread Tools | |
| Display Modes | |
|
|