• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

convert multiple TIF files into one searchable PDF file

Community Beginner ,
Nov 05, 2017 Nov 05, 2017

Copy link to clipboard

Copied

I'm new to Acrobat VBA. What's a recommended approach to converting multiple single page .TIF files into a new, searchable .PDF file?

Something like:

create new .pdf file

for each .tif file

     open .tif file

     convert to .pdf format

     add this page to new .pdf file

next

make the new .pdf file searchable

save the new .pdf file

I've seen in some of the other posts that opening a .tif file with the "AcroExch.PDDoc" works but that it's not supported. I'd like to build on supported approaches, if possible.

Thanks for assistance.

TOPICS
Acrobat SDK and JavaScript

Views

2.7K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Adobe Employee , Nov 05, 2017 Nov 05, 2017

There is not officially supported method for conversion from VBA.

Votes

Translate

Translate
Adobe Employee ,
Nov 05, 2017 Nov 05, 2017

Copy link to clipboard

Copied

There is not officially supported method for conversion from VBA.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Nov 06, 2017 Nov 06, 2017

Copy link to clipboard

Copied

So would it be a supported approach if I created an Add-In using VB.NET, exposed it as a COM object to my Access application via VBA, then process the items? If so, what would the commands be in the Add-In to do this.

Thanks for any ideas. As I said, I'm experienced with VBA and VB.NET, just new to Adobe Acrobat programming.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Nov 06, 2017 Nov 06, 2017

Copy link to clipboard

Copied

Plugins are written only in C++. It is not impossible to expose a COM interface but it’s a serious challenge.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Nov 08, 2017 Nov 08, 2017

Copy link to clipboard

Copied

Here is some VB.Net code I recently wrote to convert TIF to PDF using the Acrobat SDK.  This was written and tested with the Visual Studio Community 2017 ( https://www.visualstudio.com/downloads/ )

However this code does not create a PDF which is searchable (OCRed).   I think that the Acrobat SDK does not allow (expose) Acrobat's OCR engine because Acrobat Corporation does not want to let you write software to use their OCR engine for automated OCRing.   To do the OCRing you may need to purchase an OCR engine/library.  Alternatively the recently active OCRMYPDF ( https://github.com/jbarlow83/OCRmyPDF ) software might perhaps be possible for you to use.

    Private Sub btnTIFtoPDF_Click(sender As Object, e As EventArgs) Handles btnTIFtoPDF.Click

        ' From: https://groups.google.com/forum/#!topic/comp.text.pdf/wXtsfEpIYT0

        ' November 2017, converted to VB.Net by Phil Grenfell

        Dim FileName_input As String = "c:\temp\vb_TIFtoPDF\Input.tif"

        Dim FileName_output As String = "c:\temp\vb_TIFtoPDF\Output.pdf"

        Dim AcroApp As Object = CreateObject("AcroExch.App")    ' Application oject

        Dim AVDoc As Object = CreateObject("AcroExch.AVDoc")    ' AVDoc has visible user interface.  Every AVDoc has associated PDDoc which can be retrieved with AVDoc.GetPDDoc method.

        display_log("Opening " & FileName_input & " ...")

        Call AVDoc.Open(FileName_input, "")                     ' Takes a long time - I think it's actually converting the TIF to PDF

        display_log("Opened " & FileName_input)

        AVDoc = AcroApp.GetActiveDoc

        If AVDoc.IsValid Then

            Dim PDDoc As CAcroPDDoc ' Invisible interface to a document

            PDDoc = AVDoc.GetPDDoc                                  ' PDDoc is a VISBILE interface to the AVDoc document

            display_log("Saving " & FileName_output & " ...")

            If PDDoc.Save(Acrobat.PDSaveFlags.PDSaveFull Or Acrobat.PDSaveFlags.PDSaveLinearized Or Acrobat.PDSaveFlags.PDSaveCollectGarbage, FileName_output) <> True Then MsgBox("Failed to Save " & FileName_output)

            PDDoc.Close()           ' You can ignore "PDDoc is used before it has been assigned a value." warning, that's because PDDoc.Save is used inside an IF block

            PDDoc = Nothing         ' Cleanup the object

        End If

        AVDoc.Close(True)       ' Close the PDF

        AcroApp.Exit            ' Close Acrobat application

        AVDoc = Nothing         ' Clean up the object

        AcroApp = Nothing       ' Clean up application Object

        display_log("Saved " & FileName_output)

    End Sub

    Private Sub display_log(log_message As String)

        ' Append a message to our log textbox

        TextBox_Log.AppendText(log_message & Environment.NewLine)

    End Sub

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Nov 08, 2017 Nov 08, 2017

Copy link to clipboard

Copied

AvDoc.Open is only supported for PDF files even if it accidentally, in some versions, triggers other behaviour.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Nov 08, 2017 Nov 08, 2017

Copy link to clipboard

Copied

LATEST

ha ha .. I guess I got lucky that AvDoc.Open “accidentally” opens a TIF file! 🙂    I’m not very experienced with the Acrobat SDK so even though my code might not be perfect or useful I wanted to share something that I’ve got working as a small thank you to the forum’s members. Thank you to everyone who has taken the time to share their knowledge on this forum. 🙂

BTW, in case anyone is curious I also found that my code can often result is significant compression of the file during conversion from TIF to PDF.   If my input TIF file is 10MB the resulting PDF is only 7.7MB.

Furthermore, I forgot to mention earlier that at the very top of my form’s code window I put the command:

Imports Acrobat

Furthermore, in Visual Studio Community 2017 it’s necessary to right-click the project, choose “Properties” then click “References” and check the “Adobe Acrobat 10.0 Type Library” box.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines