I am trying to split a 'n' paged pdf file to 'n' number of pdf files containing 1 page each in ".net". For normal pdf files, PDFSharp is working fine but for corrupt file its showing errors listed down. When I use Adobe Reader and 'Save As' the file, the new file is uncorrupted one. But I do not want to do it manually. I tried to open the pdf in Adobe reader using 'Process' but I can't save from there without manually saving it. If I use other DLLs the job gets done but it adds watermark.
Errors while opening the PDF Doc:
• "Invalid entry in XRef table, ID=9, Generation=0, Position=0, ID of referenced object=1, Generation of referenced object=0"
• {"Unexpected character '0xffff' in PDF stream. The file may be corrupted. If you think this is a bug in PDFsharp, please send us your PDF file."}
• Object already in use exception.
For handling corrupt files through process I tried this:
Process p = new Process();
p.StartInfo.FileName = file;
p.Start();
p.Close();
corrupt = true;
inputDocument = PdfReader.Open(file, PdfDocumentOpenMode.Import);
Please help me ASAP... Thanks in advance.

Salman BegRank #284 · 8.8K reputationPosted May 12, 2020, 4:54 AM EDT
Leon DRank #851 · 2.6K reputationPosted May 12, 2020, 4:03 PM EDT
Anshit Hayaran21 reputationPosted May 12, 2020, 7:23 PM EDT
Marvin ReidRank #1,963 · 746 reputationPosted Jan 19, 2021, 3:50 PM EST
You can split any number of pages within a PDF file into different PDFs using the LEADTOOLS SDK. This will also fix your corrupt file issue as the SDK supports the ability to load corrupted files. You can try the following code for this: