I thought there was a good PDF file splitter in the Tech Database, but I can't seem to find it.
I just want to extract every page in a pdf to a separate file.
1-3.PDF
into
1.pdf
2.pdf
3.pdf
A point in the right direction would be greatly appreciated!
Thanks!
You may not have found a cut&paste example in the Tech Database but there are multiple pdf related examples in there. If you spend some time looking at those, you may be able to develop a script. Otherwise, you could perform a Web search for .Net assemblies that could be called from WinBatch.
Just a random thought and have never tried it but MS Word can load and save pdf documents. Perhaps you could use it to split up your document into single page documents. Word has an extensive COM Automation programming model that can be used with WinBatch.
Below is vba code, but should be convertible to WB
Dim PDDoc As Acrobat.CAcroPDDoc, newPDF As Acrobat.CAcroPDDoc
Dim PDPage As Acrobat.CAcroPDPage
Dim thePDF as String, PNum as Long
Set PDDoc = CreateObject("AcroExch.pdDoc")
Result = PDDoc.Open(thePDF)
If Not Result Then
MsgBox "Can't open file: " & FileName
Exit Sub
End If
PNum = PDDoc.GetNumPages
For i = 0 To PNum - 1
Set newPDF = CreateObject("AcroExch.pdDoc")
newPDF.Create
NewName = "Page_" & i "_of_" & PNum & ".pdf"
newPDF.InsertPages -1, PDDoc, i, 1, 0
newPDF.Save 1, NewName
newPDF.Close
Set newPDF = Nothing
Next i
I was under the impression that ADOBE or whomever no longer supported the "AcroExch.pdDoc" COM Automation object - at least without paying them some $- but I could very easily be wrong.
PDFsharp is an open-source pdf library for C#. It can be found here http://www.pdfsharp.net/ (http://www.pdfsharp.net/). I haven't used it but it does say it can be used to split PDF documents. Might be worth a look.
You could avoid Winbatch altogether and download something like PDFtk...
Not sure if the free version can do what you want, but the paid version can do it from the command line.
https://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/