title: Extract Text from Flattenned PDF created with ItextSharp Or PDFSharp
body: <p>I want to retrieve some data from many PDFs that were created from a certain template, that i have, with ItextSharp.</p>
  
  <p>Those PDFs were Flattened</p>
  
  <pre><code>FormFlattening = true;
  </code></pre>
  
  <p>I have tried many different aproaches that i have found on the internet and none has worked. I get an error message:</p>
  
  <pre><code>System.InvalidOperationException: 'Stack empty.'
  </code></pre>
  
  <p>Always when i try to extract, usually at the following line no matter the strategy:</p>
  
  <pre><code>string thePage = PdfTextExtractor.GetTextFromPage(reader, i, strategy);
  </code></pre>
  
  <p>I tryed also pdfSharp with no luck and no real documentation on extracting.
  Also i tried and two libraries that use IKVM  but those cant work on my project. </p>
  
  <p>Edit 1 : My current workaround is using pdftotext.exe from Xpdf, calling it as a process and then reading the txt file. This is somewhat slow.</p>