title: How can I split a PDF file by file size using C#?
body: <p>I found a <a href="http://acrobatusers.com/tutorials/how-to-break-a-pdf-into-parts" rel="nofollow noreferrer">How to break a PDF into parts</a> tutorial that demonstrates how to split a PDF file into separate PDF files either by pages or by maximum file size using Adobe Acrobat:</p>
  
  <p><img src="https://i.stack.imgur.com/fiIMV.png" alt="Tools &gt; Split Document &gt; Split document by File size"></p>
  
  <p>I have <a href="https://stackoverflow.com/questions/122109/how-can-i-split-up-a-pdf-file-into-pages-preferably-c">found</a> <a href="https://stackoverflow.com/questions/6999296/split-huge-40000-page-pdf-into-single-pages-itextsharp-outofmemoryexception">many</a> <a href="https://stackoverflow.com/questions/3574505/split-pdf-into-multiple-files-in-c-sharp">examples</a> on StackOverflow on how to split a PDF by page with C#. But how can I do the latter? How can I split a PDF file into multiple PDF files by a maximum file size using C#?</p>
  
  <p>For example, say I have a PDF file that is 70 pages and 40 MB. Instead of splitting into 7 PDF files of 10 pages each, how can I split the file into around 5 PDF files that are no greater than 10 MB each using C#?</p>
  
  <p>So far, the best method I have seen was in <a href="https://stackoverflow.com/questions/9024839/using-itextsharp-to-split-a-pdf-into-smaller-pdfs-based-on-size?rq=1">Using itextsharp to split a pdf into smaller pdf's based on size</a> where <a href="https://stackoverflow.com/users/105172/cyfer13">Cyfer13</a> used <a href="http://itextpdf.com/" rel="nofollow noreferrer">iTextSharp</a> to split the file by page and then group those page files by size. But is a more direct way to accomplish this without having to first split by page?</p>