hi i am getting this next error when i try to use regular expression to replace email and phone number.
ERROR:Incorrect input string passed for font PHENLF+TimesNewRoman
code sample
Dim pdfDocument As new Aspose.pdf.Document(fileFolder + fileName)
'---=== Email replace ===--
Dim absorber As TextFragmentAbsorber = New TextFragmentAbsorber("\B[\._a-zA-Z0-9-]+@[\._a-zA-Z0-9-]+\S", New TextSearchOptions(True))
Try
absorber.TextReplaceOptions = New TextReplaceOptions(TextReplaceOptions.ReplaceAdjustment.None)
absorber.TextReplaceOptions.ReplaceScope = TextReplaceOptions.Scope.REPLACE_ALL
pdfDocument.Pages.Accept(absorber)
pdfDocument.Pages(1).Accept(absorber)
' absorber.TextFragments(1).Text = "*****@*****.com"
For Each textfragment As TextFragment In absorber.TextFragments
textfragment.Text = "*****@*****.com"
Next
' ' ---=== phone replace ===--
Dim absorber2 As TextFragmentAbsorber = New TextFragmentAbsorber("\B\d{2,3}[-]?\d{6,7}", New TextSearchOptions(True))
absorber2.TextReplaceOptions = New TextReplaceOptions(TextReplaceOptions.ReplaceAdjustment.None)
' absorber2.TextReplaceOptions.ReplaceScope = TextReplaceOptions.Scope.REPLACE_FIRST
' pdfDocument.Pages.Accept(absorber2)
pdfDocument.Pages(1).Accept(absorber2)
' absorber2.TextFragments(1).Text = "**-*******"
For Each textfragment As TextFragment In absorber2.TextFragments
textfragment.Text = "**-*******"
Next
' ' '---=== phone 2 replace ===--
Dim absorber4 As TextFragmentAbsorber = New TextFragmentAbsorber("[\[+]?[9][7][2]\W?\d{2,3}\W?\d{3}\W?\d{4}", New TextSearchOptions(True))
absorber4.TextReplaceOptions = New TextReplaceOptions(TextReplaceOptions.ReplaceAdjustment.None)
' absorber4.TextReplaceOptions.ReplaceScope = TextReplaceOptions.Scope.REPLACE_FIRST
' pdfDocument.Pages.Accept(absorber4)
pdfDocument.Pages(1).Accept(absorber4)
' absorber4.TextFragments(1).Text = "**-*******"
For Each textfragment As TextFragment In absorber4.TextFragments
textfragment.Text = "**-*******"
Next
' '---=== phone 2 replace ===--
Dim absorber6 As TextFragmentAbsorber = New TextFragmentAbsorber("\B\S+\d{6,7}", New TextSearchOptions(True))
absorber6.TextReplaceOptions = New TextReplaceOptions(TextReplaceOptions.ReplaceAdjustment.None)
' absorber6.TextReplaceOptions.ReplaceScope = TextReplaceOptions.Scope.REPLACE_FIRST
' pdfDocument.Pages.Accept(absorber6)
pdfDocument.Pages(1).Accept(absorber6)
' absorber6.TextFragments(1).Text = "**-*******"
For Each textfragment As TextFragment In absorber6.TextFragments
textfragment.Text = "******"
Next
' ' '---=== id replace ===--
Dim absorber3 As TextFragmentAbsorber = New TextFragmentAbsorber("\d{9}", New TextSearchOptions(True))
absorber3.TextReplaceOptions = New TextReplaceOptions(TextReplaceOptions.ReplaceAdjustment.None)
' absorber3.TextReplaceOptions.ReplaceScope = TextReplaceOptions.Scope.REPLACE_FIRST
' pdfDocument.Pages.Accept(absorber3)
pdfDocument.Pages(1).Accept(absorber3)
' absorber3.TextFragments(1).Text = "**-*******"
For Each textfragment As TextFragment In absorber3.TextFragments
textfragment.Text = "**-*******"
Next
' '---=== id linkedIn ===--
Dim absorber5 As TextFragmentAbsorber = New TextFragmentAbsorber("\B\S+(linkedin.com)\S{3,7}", New TextSearchOptions(True))
' absorber5.TextReplaceOptions = New TextReplaceOptions(TextReplaceOptions.ReplaceAdjustment.None)
' absorber5.TextReplaceOptions.ReplaceScope = TextReplaceOptions.Scope.REPLACE_FIRST
' pdfDocument.Pages.Accept(absorber5)
pdfDocument.Pages(1).Accept(absorber5)
' absorber5.TextFragments(1).Text = "**-*******"
For Each textfragment As TextFragment In absorber5.TextFragments
textfragment.Text = "**-*******"
Next
Catch exp As Exception
'---=== response binary for debuging ===--
'================================================================================================================
Response.Clear()
Response.ClearContent()
Response.ClearHeaders()
Response.TrySkipIisCustomErrors = true
Response.StatusCode = 200
Response.ContentType = "text/plain"
Response.Write("ERROR:"&exp.Message)
Response.end
'================================================================================================================
End Try
100015AllJobs_1534589_wety3av.pdf.pdf (83.3 KB)