
Originally Posted by
jdelano
Below the for loop that calls the convert code. You could check for the existence of the converted PDF file(s), if it's there then delete the image file the PDF was created from:
' delete the images that have been converted to PDFs
For j = 1 To col.Count
If Dir("C:\MIHAI\DOC\ASIG\DOSARE\X\" & Replace$(col(j), ".jpg", ".pdf")) <> "" Then
Kill "C:\MIHAI\DOC\ASIG\DOSARE\X\" & col(j)
End If
Next
Hi jdelano and thanks for your reply
i didnt upgraded my correct code, sorry
so I use this code to convert all jpg into 1 single pdf
Option Explicit
Public Sub subTestMagick()
Dim inPath As String
Dim outPath As String
inPath = "C:\MIHAI\DOC\ASIG\DOSARE\*.*"
outPath = "C:\MIHAI\DOC\ASIG\DOSARE\Outpu.pdf"
Call ConvertJpgToPdfUsingMagick(inPath, outPath)
End Sub
Sub ConvertJpgToPdfUsingMagick(ByVal inputImagePath As String, ByVal outputPdfPath As String)
Dim command As String
command = "C:\Program Files\ImageMagick-7.1.1-Q16-HDRI\magick.exe convert -resize 1240x1753 -extent 1240x1753 -gravity center -units _
PixelsPerInch -density 150x150 """ & inputImagePath & """ """ & outputPdfPath & """"
Shell command, vbHide
End Sub
So, after i run this code with a macro, I need to delete the initial pdf files.
How can I adapt your code to this ?
Thanks,
God Bless!