Hi,
I managed to make an action in BP using Adobe Pro DC and a VBS By Christos Samaras (https://myengineeringworld.net)
INPUT:
PDFPath (text)
FileExtension (Text) ==> format to witch to convert (see code)
NewFilePath (text)
OUTPUT:
Message (text)
CODE:
Dim objAcroApp
Dim objAcroAVDoc
Dim objAcroPDDoc
Dim objJSO
Dim boResult
Dim ExportFormat
Try
If Not File.Exists(PDFPath) Then
Throw New ApplicationException("File not found: " & PDFPath)
End If
'Check the type of conversion.
Select Case LCase(FileExtension)
Case "eps": ExportFormat = "com.adobe.acrobat.eps"
Case "html", "htm": ExportFormat = "com.adobe.acrobat.html"
Case "jpeg", "jpg", "jpe": ExportFormat = "com.adobe.acrobat.jpeg"
Case "jpf", "jpx", "jp2", "j2k", "j2c", "jpc": ExportFormat = "com.adobe.acrobat.jp2k"
Case "docx": ExportFormat = "com.adobe.acrobat.docx"
Case "doc": ExportFormat = "com.adobe.acrobat.doc"
Case "png": ExportFormat = "com.adobe.acrobat.png"
Case "ps": ExportFormat = "com.adobe.acrobat.ps"
Case "rft": ExportFormat = "com.adobe.acrobat.rft"
Case "xlsx": ExportFormat = "com.adobe.acrobat.xlsx"
Case "xls": ExportFormat = "com.adobe.acrobat.spreadsheet"
Case "txt": ExportFormat = "com.adobe.acrobat.accesstext"
Case "tiff", "tif": ExportFormat = "com.adobe.acrobat.tiff"
Case "xml": ExportFormat = "com.adobe.acrobat.xml-1-00"
Case Else: ExportFormat = "Wrong Input"
End Select
'Check if the format is correct and there are no errors.
If ExportFormat <> "Wrong Input" And Err.Number = 0 Then
'Initialize Acrobat by creating App object.
objAcroApp = CreateObject("AcroExch.App")
'Set AVDoc object.
objAcroAVDoc = CreateObject("AcroExch.AVDoc")
'Open the PDF file.
If objAcroAVDoc.Open(PDFPath, "") Then
'the PDDoc object.
objAcroPDDoc = objAcroAVDoc.GetPDDoc
'Set the JS Object - Java Script Object.
objJSO = objAcroPDDoc.GetJSObject
'Save PDF file to the new format.
boResult = objJSO.SaveAs(NewFilePath & "." & FileExtension, ExportFormat)
'Close the PDF file without saving the changes.
boResult = objAcroAVDoc.Close(True)
Else
Throw New ApplicationException("Failed to open " & PDFPath)
End If
'Close the Acrobat application.
boResult = objAcroApp.Exit
Else
'Inform the user that something went wrong.
Throw New ApplicationException("The conversion of the following PDF file FAILED: " & PDFPath)
End If
Catch e As Exception
Message = e.Message
Finally
'Release the objects.
objAcroPDDoc = Nothing
objAcroAVDoc = Nothing
objAcroApp = Nothing
objJSO = Nothing
End Try