-
-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ordered Output of Split Pages #25
Comments
This seems like a nice idea. Using $NumberOfPages = 10000
$number = 100
([string]$number).PadLeft($NumberOfPages.ToString().length,'0') |
@TheOwl57 would you consider making a PR? |
Sorry, very new to GitHub and trying to figure it out, but yeah I would happy to create a PR. I have gone further and have some ideas on how to get the padding on the fly. Something like: $Reader = [iText.Kernel.Pdf.PdfReader]::New($File) |
The easiest way to "manage PR" is to follow what I've written in #12 and do it from GitHub GUI. However I would encourage you to "learn" GitHub a bit as it will come useful in the future. Let me know if you would be able to make that PR? |
This is what I use (PSWritePDF.psm1) class CustomSplitter : iText.Kernel.Utils.PdfSplitter { CustomSplitter([iText.Kernel.Pdf.PdfDocument] $pdfDocument, [string] $destinationFolder, [string] $OutputName) : base($pdfDocument) { [iText.Kernel.Pdf.PdfWriter] GetNextPdfWriter([iText.Kernel.Utils.PageRange] $documentPageRange) { |
Awesome module which I have used to sort through large PDF files at incredible speeds.
First time posting anything on GitHub, so I hope this is acceptable.
Only issue I have is when splitting documents with a large amount of pages, the naming convention of the [CustomeSplitter] Class names the file based on the page number. This can make it hard to then correctly read through split files in order.
Suggest expanding the file name to include leading zeros. I have successfully been able to modify the [CustomSplitter] Class to do this with the below code:
"$this._order = 1" as a start for page 1.
"$this._order.ToString("D4")" will handle files that are up to 9999 pages long, so shouldn't push the limits too often.
"$this._order++" to increment to the next page number.
Ideally if I had time, I would expand this to look at the file prior to splitting to get the total amount of pages and adjust how many leading zeros are required so that the naming convention was dynamic based on the content at the time.
Tested this to work with both 0.0.10 and 0.0.17.
Thanks again for the module.
The text was updated successfully, but these errors were encountered: