arus
arus

Reputation: 3

Show a particular page in PDF using DOMPDF

I am using DOMPDF to generate a PDF file from PHP. It works very good.

But now when I click on the link that generates the PDF I want it to take me to the fifth page of the PDF (if there's content on that page). Is there a way to do this?

Upvotes: 0

Views: 682

Answers (1)

yms
yms

Reputation: 10418

According to the source code posted on this page, you can use the function Cpdf.openHere:

/**
* specify where the document should open when it first starts
*/
function  openHere($style, $a =  0, $b =  0, $c =  0) {
    // this function will open the document at a specified page, in a specified style
    // the values for style, and the required paramters are:
    // 'XYZ'  left, top, zoom
    // 'Fit'
    // 'FitH' top
    // 'FitV' left
    // 'FitR' left,bottom,right
    // 'FitB'
    // 'FitBH' top
    // 'FitBV' left
    $this->numObj++;
    $this->o_destination($this->numObj, 'new', array('page' => $this->currentPage, 'type' => $style, 'p1' => $a, 'p2' => $b, 'p3' => $c));
    $id =  $this->catalogId;
    $this->o_catalog($id, 'openHere', $this->numObj);
}

Upvotes: 0

Related Questions