【问题标题】:FPDI: internal link using TCPDF addLink()FPDI:使用 TCPDF addLink() 的内部链接
【发布时间】:2015-07-17 06:58:53
【问题描述】:

我正在尝试使用 TCPDF 在我的 PDF 中创建内部链接

我在文档开头创建了链接:

    $pdf = new ManualPDF ();

    $link = $pdf->addLink();
    $pdf->SetLink($link);

稍后再创建一个指向它的链接:

    $pdf->Write(0,'Click Here',$link);

但是这不起作用,并且“单击此处”文本甚至在 PDF 上都无法单击(光标是插入符号)。

有什么指导吗?

编辑

ManualPDF 是 FPDI 的扩展,对不起,我本来应该提到的

【问题讨论】:

  • 内部链接是什么意思
  • ManualPDF 是什么?让 ypu 扩展了默认的 TCPDF。我检查了你的代码,它在我的最后运行良好

标签: php tcpdf fpdi


【解决方案1】:

documentation,您可以在您的TCPDF 对象上使用Write() 方法来实现此目的。

例如:

//Line height 
$lh = 10;

//Indicates if the cell background must be painted (true) or transparent (false). 
$bg = false;

//L or empty string: left align (default value)
$align = 'L';

//If true set cursor at the bottom of the line, otherwise set cursor at the top of the line. 
$ln = true;

$link = 'http://www.example.com/';
$tcpdf->Write($lh, 'Example Link', $link, $bg, $align, $ln);

将用文本 Google 写一行(左对齐并带有换行符,只是为了更好的示例而添加)。

这可以帮助你更好!

【讨论】:

    猜你喜欢
    • 2015-07-10
    • 1970-01-01
    • 1970-01-01
    • 2013-09-29
    • 1970-01-01
    • 2013-11-23
    • 1970-01-01
    • 2011-01-22
    • 2019-09-26
    相关资源
    最近更新 更多