Menu

How use function setDestination() and bookmark () ?

Help
machin
2014-04-25
2014-04-28
  • machin

    machin - 2014-04-25

    Hello,

    I would like use function bookmark() and setDestination() but i don't understand how use correctly this function.

    I want to use this function for the same use that Robert Greenwood here:

    https://sourceforge.net/p/tcpdf/feature-requests/265/#9e88

    I know that Nicola Asuni replied to this question but i don't understand.

    I have tried something like this:

    first page with tcpdf library :

    $pdf->setDestination("test",);
    $pdf->Bookmark('Test', 0, 0, '', 'BI', array(128,0,0), -1, '#test');

    second page with HTML code:

    < div id="#test" >Test< /div >


    But the anchor is on the first page of my pdf and not where there are the word test (on the page 3 for example).

    I have read the documentation here:

    http://www.tcpdf.org/doc/code/classTCPDF.html#a94cc2168d0b49e11f6c4d1420a6eb509

    But it's a old version (5.9.097) and the new update for setDestination() have change with the version (5.9.193).

    If someone can explain me how use the function for my problem it would be great ! ^^

    Thanks.

     

    Last edit: machin 2014-04-25
  • machin

    machin - 2014-04-28

    No idea ?

    I know we can use setDestination like this:

    setDestination("chapter1",0,"3");

    And in my HTML code:

    < a hre f = ' # chapter1 ' > Go to the chapter1 < / a >

    And when we click on the href we coming in the page 3 of the pdf, ok.

    But my "chapter 1" can be on the page 1 or 2 or 3 etc...

    That depends of the choice of the user, if he click just one option or more.

    So it's possible with setDestination() to focus a balise HTML ?

    example:
    $pdf->Addpage();
    $pdf->setDestination("chapter1");
    $pdf->Bookmark('Chapter 1', 0, 0, '', 'BI', array(128,0,0), -1, '#chapter1');

    And in my HTML code:

    < div id="chapter1"> My chapter1 < / div >

    When you click on the chapter 1 in the bookmark you arrive on the page where there are the div with the id chapter1.

    If anyone can help me,

    Thanks you.

     

    Last edit: machin 2014-04-28

Log in to post a comment.