We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Error while to replacing TextFragment

Hi,


I am getting following error while creating TextFragmentAbsorber as below. I have uploaded screenshot of the error. Please help me out.

Implementation:

Document pdfDocument1 = new Document(pdf path);

TextFragmentAbsorber textFragmentAbsorber1 = new TextFragmentAbsorber("$demographics.patientname");

pdfDocument1.Pages.Accept(textFragmentAbsorber1);


System.IndexOutOfRange: {“At most 4 elements (for any collection) can be viewed in evaluation mode.”}
StackTrace: at Aspose.Pdf.Document. (Int32 )
at Aspose.Pdf.Document. ( )
at Aspose.Pdf.XFormCollection.get(String )
at Aspose.Pdf.XFormCollection.get_Item(String name)
at . .Parse()
at . . (BaseOperatorCollection , Resources , Page )
at . . ()
at . …ctor(Page , TextSearchOptions , Boolean )
at Aspose.Pdf.Text.TextFragmentAbsorber.Visit(Page page)
at Aspose.Pdf.PageCollection.Accept(TextFragmentAbsorber visitor)
at FileUploadApi.Controllers.AsposeConverterController.Post() in C:\Users\nithin.eate\Desktop\FileUploadWebAPI\FileUploadApi\FileUploadApi\Controllers\AsposeConverterController.cs:line 30
at lambda_method(Closure , Object , Object[] )
at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass10.b__9(Object instance, Object[] methodParameters)
at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.Execute(Object instance, Object[] arguments)
at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken)

Hello Nithin,


Thanks for contacting support.

The exception you are facing, is due to using evaluation version of the API. With the evaluation version of the API, you can process only 4 elements of any collection, as exception message is also stating that. Please make sure that you are setting license correctly before processing/generating any PDF document. For more information about license settings, please visit “Licensing” article in API documentation.

In a case if you do not have purchased license yet, please consider using/applying Temporary License, so that you can use/evaluate API and its features without facing any evaluation warning. In case if you still face any issue, please share your input document along with a working code snippet, so that we can reproduce issue in our environment and address it accordingly.


Best Regards,