Aspose TextStamp Hyperlink

I am creating a textstamp overlay on a Pdf Document. The textstamp contains an email address, and as a result, Adobe Reader automatically makes it into a hyperlink (because of the “Create links from URLs” settings). Is there a way to either:

1) Create a faux hyperlink on a TextStamp object? Documentation shows how to create hyperlinks on Segments and FreeTextAnnotation, but not a TextStamp / FormattedText object.
2) Add invisible spaces to the FormattedText such as U+200B before and after the “@” sign
3) Disable the reader option programatically as a document option – is this even possible?

Update: I found that I can use Unicode with Aspose.Pdf.TextStamp (previously I was using Aspose.Pdf.Kit which has bugs with this). However, I encountered a strange bug on Windows Server 2003 which I didn’t have on my development PC (Windows 7)

Key cannot be null.
Parameter name: key

Description:
An unhandled exception occurred during the execution of the current web
request. Please review the stack trace for more information about the error and
where it originated in the code.

Exception Details:
System.ArgumentNullException: Key cannot be null.
Parameter name:
key

Source Error:

Line 42:         Dim pdfDoc As New Aspose.Pdf.Document(context.Server.MapPath("~/UploadFiles/testPDF.pdf"))
Line 43:         For Each pdfPage As Aspose.Pdf.Page In pdfDoc.Pages
Line 44:             textStamp.Put(pdfPage)
Line 45:         Next
Line 46:         pdfDoc.Save(stampedStream)

Here is a sample that triggers this:
Dim StampString As String = "Test Stamp" & vbCrLf & DateTime.Now.ToString() & vbCrLf & "test@test.com"
Dim StampStrings() = StampString.Split(New String() {vbCrLf, vbCr, vbLf}, StringSplitOptions.RemoveEmptyEntries)

Dim StampText As New Aspose.Pdf.Facades.FormattedText(StampStrings(0), System.Drawing.ColorTranslator.FromHtml("#000000"), Aspose.Pdf.Facades.FontStyle.Unknown, Aspose.Pdf.Facades.EncodingType.Identity_h, False, 10)
For x As Integer = 1 To StampStrings.Length - 1
StampText.AddNewLineText(StampStrings(x).Replace("@", "@" & ChrW(&H200B)))
Next
Dim textStamp As New TextStamp(StampText)

'add stamp to particular page
Dim stampedStream As New System.IO.MemoryStream()
Dim pdfDoc As New Aspose.Pdf.Document(context.Server.MapPath("~/UploadFiles/testPDF.pdf"))
pdfDoc.Pages(1).AddStamp(textStamp)
pdfDoc.Save(stampedStream)

I’ve also tried to simplify and pass an enter separated string directly to the FormattedText constructor. However, that strangely results in the first character of every subsequent line being chopped off. This seems to be another bug with Aspose Pdf 7.9.0

[VB.NET]

Dim StampString As String = “Test Stamp” & vbCrLf & DateTime.Now.ToString() & vbCrLf & “test@test.com”


Dim StampText As New Aspose.Pdf.Facades.FormattedText(StampString, System.Drawing.ColorTranslator.FromHtml(“#000000”), Aspose.Pdf.Facades.FontStyle.Unknown, Aspose.Pdf.Facades.EncodingType.Identity_h, False, 10)
Dim textStamp As New TextStamp(StampText)

'add stamp to particular page
Dim stampedStream As New System.IO.MemoryStream()
Dim pdfDoc As New Aspose.Pdf.Document(context.Server.MapPath(“~/UploadFiles/testPDF.pdf”))
pdfDoc.Pages(1).AddStamp(textStamp)
pdfDoc.Save(stampedStream)

microalps:
I’ve also tried to simplify and pass an enter separated string directly to the FormattedText constructor. However, that strangely results in the first character of every subsequent line being chopped off. This seems to be another bug with Aspose Pdf 7.9.0

[VB.NET]
Dim StampString As String = “Test Stamp” & vbCrLf & DateTime.Now.ToString() & vbCrLf & “test@test.com”


Dim StampText As New Aspose.Pdf.Facades.FormattedText(StampString, System.Drawing.ColorTranslator.FromHtml(“#000000”), Aspose.Pdf.Facades.FontStyle.Unknown, Aspose.Pdf.Facades.EncodingType.Identity_h, False, 10)
Dim textStamp As New TextStamp(StampText)

'add stamp to particular page
Dim stampedStream As New System.IO.MemoryStream()
Dim pdfDoc As New Aspose.Pdf.Document(context.Server.MapPath(“~/UploadFiles/testPDF.pdf”))
pdfDoc.Pages(1).AddStamp(textStamp)
pdfDoc.Save(stampedStream)
Hi John,

Thanks for contacting support.

I
have tested the scenario and I am able to reproduce the same problem. For the
sake of correction, I have logged it in our issue tracking system as PDFNEWNET-35247. We
will investigate this issue in details and will keep you updated on the status
of a correction. <o:p></o:p>

We apologize for your inconvenience.

microalps:
I am creating a textstamp overlay on a Pdf Document. The textstamp contains an email address, and as a result, Adobe Reader automatically makes it into a hyperlink (because of the “Create links from URLs” settings). Is there a way to either:

Update: I found that I can use Unicode with Aspose.Pdf.TextStamp (previously I was using Aspose.Pdf.Kit which has bugs with this). However, I encountered a strange bug on Windows Server 2003 which I didn’t have on my development PC (Windows 7)

Key cannot be null.
Parameter name: key

Description:
An unhandled exception occurred during the execution of the current web
request. Please review the stack trace for more information about the error and
where it originated in the code.

Exception Details:
System.ArgumentNullException: Key cannot be null.
Parameter name:
key
Hi John,

Thanks for using our products.


I
have tested the scenario and I am also unable to replicate the problem over Windows 7. However for the sake of investigation on Windows Server 2003, I have logged it in our issue tracking system as PDFNEWNET-35249. We
will investigate this issue in details and will keep you updated on the status
of a correction. <o:p></o:p>

We apologize for your inconvenience.

Is there any estimated time for a fix on either of these issues? This is affecting our release schedule, so any sort of timing, alternative, hotfix, etc. would be appreciated

Hi John,


Sorry for the inconvenience faced. One of your reported issues, FormattedText constructor related issue (PDFNEWNET-35247) has been resolved and its fix will be available in Apose.Pdf for .NET 8.1.0, that is due in start of next month. Furthermore, our development team is looking into other reported issue, exception over Windows server 2003. We will notify you via this forum thread as soon as it is resolved.

Thanks for your patience and cooperation.

Best Regards,

The issues you have found earlier (filed as PDFNEWNET-35247) have been fixed in Aspose.Pdf for .NET 8.1.0.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.