1

我们正在使用 ABCPDF.Net 版本 5 从 HTML 创建 PDF 文件。但是,除了那些在 HTML 中显示为 URL 的链接之外,即使 HtmlOptions.AddLinks 设置为 true,这些链接也不会生效。事实上,当它设置为 true 时,链接呈现的棕色背景在设置为 false 时不存在。这是我们用来创建 PDF (vb.net) 的代码:

                Dim oFile As Stream = New MemoryStream()
                Dim objPDFInvoice As Doc = New Doc

                With objPDFInvoice
                    Dim w As Double = .MediaBox.Width
                    Dim h As Double = .MediaBox.Height
                    Dim l As Double = .MediaBox.Left
                    Dim b As Double = .MediaBox.Bottom

                    .Rect.Left += 15
                    .Rect.Bottom += 15
                    .Rect.Width -= 15
                    .Rect.Height -= 15

                    .HtmlOptions.AddLinks = True

                    Dim theID As Integer = .AddImageUrl("file://" & sFileName, True, 800, True)
                    While True
                        If Not .Chainable(theID) Then
                            Exit While
                        End If
                        .Page = .AddPage()
                        theID = .AddImageToChain(theID)
                    End While

                    For iPage As Integer = 1 To .PageCount
                        .PageNumber = iPage
                        .Flatten()
                    Next
                    If .PageCount > 0 Then .Page = 1

                    .SetInfo(.Root, "/HtmlContent:Text", sBody.ToString)
                    .SetInfo(.Root, "/HtmlFilename:Text", "Certification" & ".pdf")

                    .Encryption.Type = 2
                    .Encryption.CanAssemble = False
                    .Encryption.CanChange = False
                    .Encryption.CanCopy = False
                    .Encryption.CanEdit = False

                End With
                objPDFInvoice.Save(oFile)
                objPDFInvoice.Clear()

然后将 oFile 内存流作为电子邮件附件发送,但为了进行测试,我将其保存到文件中。请注意,sBody 是 AddImageURL 中使用的 HTML 文件内容的字符串表示形式。

知道为什么会这样吗?

提前致谢, 鲍里斯·扎哈林

4

1 回答 1

0

当我们将应用程序从 Win Server 2003 移植到 Win Server 2008 时,这个问题就出现了。

这不是直接原因,从 IE8 到 IE9 的移动导致链接上的棕色背景颜色。

我们通过升级到 AbcPdf 8 解决了这个问题。

于 2012-03-22T14:34:31.390 回答