google books

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 ...


Go Back   Usenet Forums > PHP Programming Forums > PHP General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 03-24-2008
John Pillion
 
Posts: n/a
Default google books

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


Reply With Quote
  #2 (permalink)  
Old 03-24-2008
Ray Hauge
 
Posts: n/a
Default Re: [PHP] google books

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
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 10:09 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0