问题描述
错误:无法打开文件
错误:无法打开PDF文件
输入错误,所以没有创建输出。
我尝试过:
我的代码:
input =C:\ Users \sathishr \Desktop \Small \ a_20160310 _ *。pdf
output =C:\用户\ atathrhr \Desktop \Small \Test_US.pdf
MergePdf(输入,输出)
Private Sub MergePdf( ByVal InputFileNames As Object,ByVal OutputFileName As Object)
尝试
'合并生成的pdf文件
Dim oProcess As New System.Diagnostics.Process
oProcess.StartInfo.FileName =pdftk
oProcess.StartInfo.Arguments = InputFileNames +output+ OutputFileName
oProcess.Start()
oProcess.WaitForExit()
oProcess.Clo se()
Catch ex As Exception
抛出ex
结束尝试
结束Sub
Error: unable to open file
Error: Failed to open PDF File
Input Error, so no output created.
What I have tried:
My Code:
input = "C:\Users\sathishr\Desktop\Small\a_20160310_*.pdf"
output = "C:\Users\sathishr\Desktop\Small\Test_US.pdf"
MergePdf(input, output)
Private Sub MergePdf(ByVal InputFileNames As Object, ByVal OutputFileName As Object)
Try
'Merging the generated pdf files
Dim oProcess As New System.Diagnostics.Process
oProcess.StartInfo.FileName = "pdftk"
oProcess.StartInfo.Arguments = InputFileNames + "output" + OutputFileName
oProcess.Start()
oProcess.WaitForExit()
oProcess.Close()
Catch ex As Exception
Throw ex
End Try
End Sub
推荐答案
oProcess.StartInfo.Arguments = InputFileNames + "output" + OutputFileName
argumentsAFAIK中没有空格,pdftk的正确语法是
There are no spaces in the argumentsAFAIK the correct syntax for pdftk would be
pdftk C:\Users\sathishr\Desktop\Small\a_20160310_*.pdf cat output C:\Users\sathishr\Desktop\Small\Test_US.pdf
所以我认为该行应该是(注意未经测试)
so I think that line should be (note untested)
oProcess.StartInfo.Arguments = InputFileNames + " cat output " + OutputFileName
这篇关于我在pdftk中遇到了这个问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!