Skip to main content
vamsi_krishnas90254928
Participant
November 4, 2016
Question

convert .tif files to PDF using Adobe acrobat API. We own the Adobe acrobat pro enterprise license. OS : Windows

  • November 4, 2016
  • 1 reply
  • 860 views

Could some one please tell me how to convert .tif files to PDF using Adobe acrobat API. We own the Adobe acrobat pro enterprise license. OS : Windows

I tried the code below in python. The code works well when I was trying to convert PDF to other formats. But not from .tif to PDF.

def acrobat_extract_pdf(f_path, f_path_out, f_basename, f_ext):

    avDoc = Dispatch("AcroExch.AVDoc") # Connect to Adobe Acrobat

    # Open the input file (as a pdf)

    ret = avDoc.Open(f_path, f_path)

    assert(ret) # FIXME: Documentation says "-1 if the file was opened successfully, 0 otherwise", but this is a bool in practise?

    pdDoc = avDoc.GetPDDoc()

    dst = os.path.join(f_path_out, ''.join((f_basename, f_ext)))

    print(dst)

    # Adobe documentation says "For that reason, you must rely on the documentation to know what functionality is available through the JSObject interface. For details, see the JavaScript for Acrobat API Reference"

    jsObject = pdDoc.GetJSObject()

    # Here you can save as many other types by using, for instance: "com.adobe.acrobat.xml"

    jsObject.SaveAs(dst, "com.adobe.acrobat.pdf")

    pdDoc.Close()

    avDoc.Close(True) # We want this to close Acrobat, as otherwise Acrobat is going to refuse processing any further files after a certain threshold of open files are reached (for example 50 PDFs)

    del pdDoc

This topic has been closed for replies.

1 reply

Legend
November 4, 2016

I recommend you use the Acrobat SDK forum. Also be sure this is an interactive session, not on a server, not in a Service.