Hi guys,
is it possible to use the PDF tools to export one or more pages from a PDF file to a new file via command line?
I need this function for my private VBNet program.
Thank you very much.
Nimrod_189
Export single page per VBNet
Moderators: PDF-XChange Support, Daniel - PDF-XChange, Sean - Tracker, Vasyl - PDF-XChange, Chris - PDF-XChange, Stefan - PDF-XChange
- Daniel - PDF-XChange
- Site Admin
- Posts: 10107
- Joined: Wed Jan 03, 2018 6:52 pm
Re: Export single page per VBNet
Hello, Nimrod_189
While it would be possible to create a custom tool via PDF-Tools and call it, most settings, including the page numbers to be used for Insert/extract pages cannot be modified directly via CMD.
You can find a complete list of available PDF-tools CMD actions here: https://help.pdf-xchange.com/pdfxt10/co ... ons_t.html
Kind regards,
While it would be possible to create a custom tool via PDF-Tools and call it, most settings, including the page numbers to be used for Insert/extract pages cannot be modified directly via CMD.
You can find a complete list of available PDF-tools CMD actions here: https://help.pdf-xchange.com/pdfxt10/co ... ons_t.html
Kind regards,
Dan McIntyre - Support Technician
PDF-XChange Co. LTD
+++++++++++++++++++++++++++++++++++
Our Web site domain and email address has changed as of 26/10/2023.
https://www.pdf-xchange.com
Support@pdf-xchange.com
PDF-XChange Co. LTD
+++++++++++++++++++++++++++++++++++
Our Web site domain and email address has changed as of 26/10/2023.
https://www.pdf-xchange.com
Support@pdf-xchange.com
-
- User
- Posts: 49
- Joined: Wed Sep 23, 2009 8:39 am
Re: Export single page per VBNet
Hello Daniel,
I solved my problem using the commandline tool "pdftk". I've worked with it before and it's still great.
Here's my solution for VBNet:
Or as Batchfile for example "CatPDF.bat":
Nimrod_189
I solved my problem using the commandline tool "pdftk". I've worked with it before and it's still great.
Here's my solution for VBNet:
Code: Select all
Sub ExtractPDFPages(sTargetPath As String, sSourcePDF As String, sDestFileName As String, listPages As List(Of String))
Dim strParam As String = ""
Dim PDFtk As String = ""
Dim tmpFile As String = System.IO.Path.Combine(sTargetPath, "Input.pdf")
Call CleanPath(sTargetPath)
PDFtk = My.Settings.PDFtk & " " '<<===== E:\Programmtools\PDFtk Server\bin\pdftk.exe
System.IO.File.Copy(sSourcePDF, tmpFile)
sSourcePDF = tmpFile
Dim p As New Process
For i As Integer = 0 To listPages.Count - 1
strParam += listPages(i) & " " '<<=== einzelne Seiten einfach mit Leerzeichen trennen
Next
strParam = sSourcePDF & " cat " & strParam.Trim & " output " & Path.Combine(sTargetPath, sDestFileName)
p.StartInfo.FileName = PDFtk
p.StartInfo.Arguments = strParam
p.StartInfo.WindowStyle = ProcessWindowStyle.Hidden
p.Start()
p.WaitForExit()
p.Close()
End Sub
Code: Select all
"E:\Programmtools\PDFtk Server\bin\pdftk.exe" "input.pdf" cat 2 3 output "Output.pdf"
- Daniel - PDF-XChange
- Site Admin
- Posts: 10107
- Joined: Wed Jan 03, 2018 6:52 pm
Re: Export single page per VBNet
Hello, Nimrod_189
Glad to hear you have found a solution. I wish I could say we plan to offer the same, but at this time it does not seem likely.
Kind regards,
Glad to hear you have found a solution. I wish I could say we plan to offer the same, but at this time it does not seem likely.
Kind regards,
Dan McIntyre - Support Technician
PDF-XChange Co. LTD
+++++++++++++++++++++++++++++++++++
Our Web site domain and email address has changed as of 26/10/2023.
https://www.pdf-xchange.com
Support@pdf-xchange.com
PDF-XChange Co. LTD
+++++++++++++++++++++++++++++++++++
Our Web site domain and email address has changed as of 26/10/2023.
https://www.pdf-xchange.com
Support@pdf-xchange.com
-
- User
- Posts: 49
- Joined: Wed Sep 23, 2009 8:39 am
Re: Export single page per VBNet
That's really sad to hear, because I would like to do everything with one tool. I do use the IText framework in VBNet sometimes, but it's very complicated. So sometimes I need the easier way.
But whatever, the goal is the way.
But whatever, the goal is the way.
- Daniel - PDF-XChange
- Site Admin
- Posts: 10107
- Joined: Wed Jan 03, 2018 6:52 pm
Re: Export single page per VBNet
Hello, Nimrod_189
Well, we can keep our fingers crossed at least, who knows what the future may bring. things ive said are unlikely have happened before (And I do hope they keep happening).
Kind regards,
Well, we can keep our fingers crossed at least, who knows what the future may bring. things ive said are unlikely have happened before (And I do hope they keep happening).
Kind regards,
Dan McIntyre - Support Technician
PDF-XChange Co. LTD
+++++++++++++++++++++++++++++++++++
Our Web site domain and email address has changed as of 26/10/2023.
https://www.pdf-xchange.com
Support@pdf-xchange.com
PDF-XChange Co. LTD
+++++++++++++++++++++++++++++++++++
Our Web site domain and email address has changed as of 26/10/2023.
https://www.pdf-xchange.com
Support@pdf-xchange.com
- Dimitar - PDF-XChange
- Site Admin
- Posts: 2129
- Joined: Mon Jan 15, 2018 9:01 am