Skip to main content
Inspiring
March 1, 2009
Question

Cfdocument / pdf - Do internal links work?

  • March 1, 2009
  • 3 replies
  • 1929 views
Does anyone know if internal links actually work within cfdocument? External links work fine, but nothing seems to happens when you click an internal link. I have tried various combination of # signs, but no joy.

<!--- external works --->
<a href=" http://www.google.com">google</a>
<!--- internal does not --->
<a href="#B1" name="A1">This</a> .....
<a href="#A1" name="B1">That</a>
    This topic has been closed for replies.

    3 replies

    Inspiring
    March 1, 2009
    > You're not doing anything silly. Your code SHOULD work
    > (case in point: it works fine in HTML).

    Well, by silly I mean "forgetting to be more creative" when working with cfdocument. Because I know full well it has a few quirks ..

    > I've raised it as a bug with <cfdocument>.

    Good
    Inspiring
    March 1, 2009
    > Does anyone know if internal links actually work within cfdocument?

    > <a href=" http://www.google.com">google</a>
    > <!--- internal does not --->
    > <a href="#B1" name="A1">This</a> .....
    > <a href="#A1" name="B1">That</a>

    As BKBK suggests, one needs to have separate NAME and HREF anchors. Then
    it works fine.

    --
    Adam
    Inspiring
    March 1, 2009
    Thanks guys. I knew I was doing something silly there, but it was too late in the day for my brain to see it ;-)
    BKBK
    Community Expert
    Community Expert
    March 1, 2009
    Do you wish to bounce back and forth between A1 and A2? Then this is a safer bet

    <cfdocument format="PDF">
    Page 1<br>
    <a name="A1">Section A1</a><br><br>
    <a href="#A2">To Section A2</a>

    <cfdocumentitem type="pagebreak" />

    Page 2<br>
    <a name="A2">Section A2</a><br><br>
    <a href="#A1">To Section A1</a>
    </cfdocument>

    Alternatively, include the id attribute, thus

    <cfdocument format="PDF">
    Page 1<br>
    <a href="#B1" name="A1" id="A1">This</a>

    <cfdocumentitem type="pagebreak" />

    Page 2<br>
    <a href="#A1" name="B1" id="B1">That</a>
    </cfdocument>