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

Free Support Forum - aspose.com

Error while generating the PDF

Hi Aspose Team,

we are getting the below error while generating the PDF.

Caused by: java.lang.NoSuchMethodError: com.aspose.pdf.TextFragmentCollection.iterator()Lcom/aspose/pdf/internal/p639/z15;

when executing the below code

for(Iterator iterator = textFragmentCollection.iterator(); iterator.hasNext():wink:

Aspose versions : 17.7

@pkd0709

Thanks for contacting support.

Please try following code snippet, in order to iterate through all text fragments:

Iterator<TextFragment> iterator = absorber.getTextFragments().iterator();
while(iterator.hasNext())
{
 System.out.println(iterator.next().getText());
}

In case you still face any issue, please share complete code snippet along with sample input document, so that we can test the scenario in our environment and address it accordingly.