Copy link to clipboard
Copied
Hello,
I am new to the Adobe SDK but I have been programming in C# for many years. My issue is that we have one huge PDF that we need to split into many smaller PDF files. So far, my code has been running fine but now I have a couple of questions.
First, are there any examples of creating a blank PDF? I looked thru the SDK samples and I could not find an example of create a clean, empty PDF using the Create() method. I also used a search tool to look for the phrase "Create(" inside of the .cs files but I could not find anything. If you do not have sample code then could you please point me to where it is in the SDK?
Next, I have this very large PDF with over 188,000 pages in it. It is over 300Mb in size. I am trying to split this file into 188 files with 1000 pages in each file. I found the example is the SDK and I am using the InsertPages Method to create the new file like this:
newPDFDoc.InsertPages(0, masterPDF, (pgCount-1000), 1000, 0);
(pgCount in this example is a counter indicating the next block of 1000 pages to use.)
The trouble is that this works very fast when the starting page is very low (ie. page 1000, 2000, etc) but then the InsertPages method gets VERY slow as the pages get higher. I believe that this is caused by the code having to move thru the original document (masterPDF) to the next starting page. In other words, when I say 'copy 1000 pages from the masterPDF into the newPDF starting in the masterPDF at page 40000', then I think that this method is taking way too long to leaf thru the masterPDF to get to page 40000 so that it can grab the next 1000 pages. Every iteration gets slower and slower as it has to move from page 0 to page 40000 all over again.
Does anyone know a way to make this faster? Also, I am trying to avoid the javascript method simply because I have read that it would be much slower so please do not suggest that language.
Thanks for taking the time to read this and I hope that I can find a faster way to split this enormous file.
Marty
Copy link to clipboard
Copied
Short answer – the C# APIs are very long in the tooth and not well supported. You would be MUCH better served writing a plugin to Acrobat or using the Adobe PDFLibrary (both of which are C/C++ APIs) which offer many many more features and performance.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now