1

We are using ABCPDF.Net version 5 to create a PDF file from HTML. However, the links are not live except for those that appear as URLs in the HTML even when HtmlOptions.AddLinks is set to true. In fact, when it's set to true, the links render with a brown background not present when it's set to false. Here is the code we use to create the 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()

The oFile memory stream is then sent as an email attachment, but for testing I'm saving it to a file. Note that sBody is a string representation of the contents of the HTML file used in AddImageURL.

Any idea why this is happening?

Thanks in advance, Boris Zakharin

1 Answers1

0

This issue appeared for us, when we ported our app from Win Server 2003 to Win Server 2008.

This wasn't directly the cause, the move from IE8 to IE9 caused the brown background color on links.

We have fixed the issue by upgrading to AbcPdf 8.

Bertvan
  • 4,943
  • 5
  • 40
  • 61