Ciao, ho questo script in visual basic for application che mi converte dei file pdf in tif.
pdfimages estrae da file pdf le immagini contenute.
nconvert converte dal file ppm in tif
codice:
Public Sub convertiPDFTIF(PercorsoFilePdf As String)
Dim FSP As Object, WshShell
Dim nconvert As String, pdfImage As String, file As String, perc As String
Dim esito
Dim F
nconvert = CurrentProject.Path & "\nconvert.exe"
pdfImage = CurrentProject.Path & "\pdfimages.exe"
perc = ParsePath(PercorsoFilePdf)
Set WshShell = CreateObject("Wscript.Shell")
Public Sub convertiPDFTIF(PercorsoFilePdf As String)
Dim FSP As Object, WshShell
Dim nconvert As String, pdfImage As String, file As String, perc As String
Dim esito
Dim F
nconvert = CurrentProject.Path & "\nconvert.exe"
pdfImage = CurrentProject.Path & "\pdfimages.exe"
perc = ParsePath(PercorsoFilePdf)
Set WshShell = CreateObject("Wscript.Shell")
esito = WshShell.Run(pdfImage & " " & PercorsoFilePdf & " " & perc & "file", 0, True)
file = ParseFileName(PercorsoFilePdf)
F = ParseFileExt(file, "nome")
If esito = 0 Then
WshShell.Run nconvert & " -out tiff -binary nodither -multi -c 7 -noise reduce -normalize -D -o " & perc & "\" & F & ".tif " & perc & "*.ppm", 0, True
Else
MsgBox "Conversione PDF: si e' verificato l'errore " & esito
End If
Set WshShell = Nothing
'elimino il file pdf di partenza
Kill PercorsoFilePdf
End Sub
Il mio problema e' che quando arriva alla linea
esito = WshShell.Run(pdfImage & " " & PercorsoFilePdf & " " & perc & "file", 0, True)
ogni tanto mi restituisce errore 259, che cercando su web e' un errore di time out dello script.
Io ho cercato la guida della shell e l'ultimo parametro (true) mi spiega che serve per fare attendere allo script che il programma sia terminato, soltanto che questo non e' vero.
Avete qualche suggerimento per ovviare a questo inconveniente?
Ciao e grazie mille delle risposte.
abe