Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.

Mon Aug 20, 2018 11:53 am

I am evaluating using the Spire.PDF library and am trying to extract some highlighted text but I only seem to extract 'Evaluation Warning : The document was created with Spire.PDF for .NET.' - Is this a limitiation of the free version?

Here is my source code. Select a file with a highlight on the first page. I want to fill the variable called Text with the contents of the highlight.

Dim pdfFile As String
Dim dialog As New OpenFileDialog()
dialog.Filter = "PDF document (*.pdf)|*.pdf"
Dim result As DialogResult = dialog.ShowDialog()
If result <> Windows.Forms.DialogResult.OK Then Exit Sub
pdfFile = dialog.FileName

Dim pdf As New PdfDocument()
pdf.LoadFromFile(pdfFile)
Dim count As Integer = pdf.Pages.Count
Dim Page0 = pdf.Pages(0)
Dim Annot = Page0.AnnotationsWidget
For Each Ann In Annot
Dim Text As String
Dim TextMU = TryCast(Ann, Spire.Pdf.Annotations.PdfTextMarkupAnnotationWidget)
If TextMU IsNot Nothing Then Text = Page0.ExtractText(TextMU.Bounds)
Dim TextPU = TryCast(Ann, Spire.Pdf.Annotations.PdfPopupAnnotationWidget)
If TextPU IsNot Nothing Then Text = Page0.ExtractText(TextPU.Bounds)
Dim i As Integer = 0
Next

ralphe
 
Posts: 1
Joined: Mon Aug 20, 2018 10:16 am

Tue Aug 21, 2018 7:44 am

Hello,

Thanks for your interests in Spire.PDF.
You should be using our commercial version rather than free version, since the evaluation warning and the ExtractText(RectangleF rectangeleF) method only exist in our commercial version. To help you remove the warning message, our sales team just sent a temporary license(one month free) of Spire.PDF to your email. Please apply the license by this way(How to Apply the License by license key) and test your scenario with the latest commercial version Spire.PDF Pack(Hot Fix) Version:4.8.8. If there is still a problem, please provide your original Pdf file to help us further investigate your issue.

Thanks and Regards,
Lisa
E-iceblue support team
User avatar

Lisa.Li
 
Posts: 1534
Joined: Wed Apr 25, 2018 3:20 am

Tue Aug 21, 2018 9:55 am

try this:

Public Sub getText(anno As PdfAnnotation)
Dim annotext As PdfFreeTextAnnotationWidget
annotext = TryCast(anno, PdfFreeTextAnnotationWidget)
If Not IsNothing(annotext) Then
Make(annotext.Location.X + annotext.Size.Width / 2, annotext.Location.Y + annotext.Size.Height / 2, annotext.Text)
End If
End Sub

iaven
 
Posts: 4
Joined: Tue Jan 16, 2018 8:54 am

Wed Aug 29, 2018 9:43 am

Hello Ralphe,

Greetings from E-iceblue.
Could you let us know how is the issue going? Thanks in advance for your valuable feedback and time.

Sincerely,
Lisa
E-iceblue support team
User avatar

Lisa.Li
 
Posts: 1534
Joined: Wed Apr 25, 2018 3:20 am

Return to Spire.PDF