Following code throws exception when I input this file 201752919911.pdf (526.8 KB) using Aspose.Pdf for .NET ver 18.5.0.
Please take a look at the log.txt appears in the code below. 201752919911_log.zip (494 Bytes)
I presume this error is relevant to this topic.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using Aspose;
using Aspose.Pdf;
using Aspose.Pdf.Text;
namespace pdf
{
class Program
{
static void Main(string[] args)
{
License license = new License();
license.SetLicense("Aspose.Pdf.lic");
string pdffile = "201752919911.pdf";
Document doc = new Document(pdffile);
TextFragmentAbsorber textFragmentAbsorber = new TextFragmentAbsorber(".+");
textFragmentAbsorber.TextSearchOptions = new TextSearchOptions(true);
doc.Pages.Accept(textFragmentAbsorber);
TextFragmentCollection textFragmentCollection = textFragmentAbsorber.TextFragments;
foreach (TextFragment textFragment in textFragmentCollection)
{
try
{
textFragment.Text = string.Empty;
}
catch (Exception ex)
{
StreamWriter stream = new StreamWriter(pdffile.Replace(".pdf", "_log.txt"));
stream.WriteLine("[" + DateTime.Now.ToString() + "]");
stream.WriteLine("[message]\r\n " + ex.Message);
stream.WriteLine("[source]\r\n " + ex.Source);
stream.WriteLine("[stacktrace]\r\n" + ex.StackTrace);
stream.Close();
}
}
}
}
}
Thank you in advance.