MaximoAccess

Caro Usuário, antes de postar pela primeira vez, leia as regras do fórum.

https://www.maximoaccess.com/t48-regras-do-forum

Obrigado

Administração


Participe do fórum, é rápido e fácil

MaximoAccess

Caro Usuário, antes de postar pela primeira vez, leia as regras do fórum.

https://www.maximoaccess.com/t48-regras-do-forum

Obrigado

Administração

MaximoAccess

Gostaria de reagir a esta mensagem? Crie uma conta em poucos cliques ou inicie sessão para continuar.

Dicas Ms Access, Exemplos Ms Access, Codigos VBA Ms Access, SQL Ms Access


2 participantes

    [Resolvido]arquivo ACROBAT.TLB

    baldocchi
    baldocchi
    Intermediário
    Intermediário


    Respeito às regras : Respeito às Regras 100%

    Sexo : Masculino
    Localização : Brasil
    Mensagens : 128
    Registrado : 03/11/2014

    [Resolvido]arquivo ACROBAT.TLB Empty [Resolvido]arquivo ACROBAT.TLB

    Mensagem  baldocchi 24/3/2016, 14:07

    Pessoal, bom dia a todos.


    Estou precisando do arquivo "acrobat.tlb" para gerar um script que converte um pdf em vários formatos.
    Alguém tem o arquivo?


    Obrigado Smile

    Depois eu deixo o código e o exemplo prontos aqui para quem quiser.

    Abraços.
    Alvaro Teixeira
    Alvaro Teixeira
    Moderador Global
    Moderador Global


    Respeito às regras : Respeito às Regras 100%

    Sexo : Masculino
    Localização : Portugal
    Mensagens : 7919
    Registrado : 15/03/2013

    [Resolvido]arquivo ACROBAT.TLB Empty Re: [Resolvido]arquivo ACROBAT.TLB

    Mensagem  Alvaro Teixeira 24/3/2016, 14:32

    Olá Leandro,

    Não sei o código VBA qual a versão que usa, mas veja se está incluído em algum SDK
    http://www.adobe.com/devnet/acrobat/downloads.html

    Abraço
    baldocchi
    baldocchi
    Intermediário
    Intermediário


    Respeito às regras : Respeito às Regras 100%

    Sexo : Masculino
    Localização : Brasil
    Mensagens : 128
    Registrado : 03/11/2014

    [Resolvido]arquivo ACROBAT.TLB Empty Re: [Resolvido]arquivo ACROBAT.TLB

    Mensagem  baldocchi 24/3/2016, 14:44

    Olá ahteixeira, segue o código.

    Dim objAcroApp As Acrobat.AcroApp
    Dim objAcroAVDoc As Acrobat.AcroAVDoc
    Dim objAcroPDDoc As Acrobat.AcroPDDoc
    Dim objJSO As Object
    Dim boResult As Boolean
    Dim ExportFormat As String
    Dim NewFilePath As String

    'Initialize Acrobat by creating App object.
    Set objAcroApp = CreateObject("AcroExch.App")

    'Set AVDoc object.
    Set objAcroAVDoc = CreateObject("AcroExch.AVDoc")

    'Open the PDF file.
    boResult = objAcroAVDoc.Open(PDFPath, "")

    'Set the PDDoc object.
    Set objAcroPDDoc = objAcroAVDoc.GetPDDoc

    'Set the JS Object - Java Script Object.
    Set objJSO = objAcroPDDoc.GetJSObject

    '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

    'Format is correct and no errors.

    'Set the path of the new file. Note that Adobe instead of xls uses xml files.
    'That's why here the xls extension changes to xml.
    If LCase(FileExtension) <> "xls" Then
    NewFilePath = WorksheetFunction.Substitute(PDFPath, ".pdf", "." & LCase(FileExtension))
    Else
    NewFilePath = WorksheetFunction.Substitute(PDFPath, ".pdf", ".xml")
    End If

    'Save PDF file to the new format.
    boResult = objJSO.SaveAs(NewFilePath, ExportFormat)

    'Close the PDF file without saving the changes.
    boResult = objAcroAVDoc.Close(True)

    'Close the Acrobat application.
    boResult = objAcroApp.Exit

    Else

    'Something went wrong, so close the PDF file and the application.

    'Close the PDF file without saving the changes.
    boResult = objAcroAVDoc.Close(True)

    'Close the Acrobat application.
    boResult = objAcroApp.Exit

    End If

    'Release the objects.
    Set objAcroPDDoc = Nothing
    Set objAcroAVDoc = Nothing
    Set objAcroApp = Nothing



    eu preciso desse arquivo: C:\Program Files\Adobe\Acrobat xx.0\Acrobat\acrobat.tlb - nas versões do Acrobat ele não existe.
    Alvaro Teixeira
    Alvaro Teixeira
    Moderador Global
    Moderador Global


    Respeito às regras : Respeito às Regras 100%

    Sexo : Masculino
    Localização : Portugal
    Mensagens : 7919
    Registrado : 15/03/2013

    [Resolvido]arquivo ACROBAT.TLB Empty Re: [Resolvido]arquivo ACROBAT.TLB

    Mensagem  Alvaro Teixeira 24/3/2016, 15:12

    Olá Leandro,

    Obrigado pela partilha do código.

    Acho que o ficheiro que pretende consegue baixando o SDK da versão 7, veja:
    [Resolvido]arquivo ACROBAT.TLB Ou4lso


    Aqui o ficheiro após a instalação:
    [Resolvido]arquivo ACROBAT.TLB 24v5edl

    Abraço
    baldocchi
    baldocchi
    Intermediário
    Intermediário


    Respeito às regras : Respeito às Regras 100%

    Sexo : Masculino
    Localização : Brasil
    Mensagens : 128
    Registrado : 03/11/2014

    [Resolvido]arquivo ACROBAT.TLB Empty Re: [Resolvido]arquivo ACROBAT.TLB

    Mensagem  baldocchi 24/3/2016, 16:14

    Amigo,

    Obrigado pela força. Eu instalei o skd como vc falou, mas ainda dá erro.

    Veja o projeto todo no link: https://www.dropbox.com/s/1uh9acpf17gm608/Folders%2C%20Subfolders%20%26%20Files.zip?dl=0
    Alvaro Teixeira
    Alvaro Teixeira
    Moderador Global
    Moderador Global


    Respeito às regras : Respeito às Regras 100%

    Sexo : Masculino
    Localização : Portugal
    Mensagens : 7919
    Registrado : 15/03/2013

    [Resolvido]arquivo ACROBAT.TLB Empty Re: [Resolvido]arquivo ACROBAT.TLB

    Mensagem  Alvaro Teixeira 24/3/2016, 21:26

    Olá Leandro,
    Aqui no meu PC de casa funciona, mas eu tenho a versão professional do acrobat.

    Como podemos ver abaixo no código o programador também fala nisso, veja:
    Código:
    Private Sub SavePDFAs(PDFPath As String, FileExtension As String)
        
        '---------------------------------------------------------------------------------------
        'Saves a PDF file as other format using Adobe Professional.
        
        'In order to use the macro you must enable the Acrobat library from VBA editor:
        'Go to Tools -> References -> Adobe Acrobat xx.0 Type Library, where xx depends
        'on your Acrobat Professional version (i.e. 9.0 or 10.0) you have installed to your PC.
        
        'Alternatively you can find it Tools -> References -> Browse and check for the path
        'C:\Program Files\Adobe\Acrobat xx.0\Acrobat\acrobat.tlb
        'where xx is your Acrobat version (i.e. 9.0 or 10.0 etc.).
        
        'By Christos Samaras
        'Date: 30/03/2013
        'http://www.myengineeringworld.net
        '---------------------------------------------------------------------------------------
        
        Dim objAcroApp      As Acrobat.AcroApp
        Dim objAcroAVDoc    As Acrobat.AcroAVDoc
        Dim objAcroPDDoc    As Acrobat.AcroPDDoc
        Dim objJSO          As Object
        Dim boResult        As Boolean
        Dim ExportFormat    As String
        Dim NewFilePath     As String
            
        'Initialize Acrobat by creating App object.
        Set objAcroApp = CreateObject("AcroExch.App")
        
        'Set AVDoc object.
        Set objAcroAVDoc = CreateObject("AcroExch.AVDoc")
        
        'Open the PDF file.
        boResult = objAcroAVDoc.Open(PDFPath, "")
            
        'Set the PDDoc object.
        Set objAcroPDDoc = objAcroAVDoc.GetPDDoc
        
        'Set the JS Object - Java Script Object.
        Set objJSO = objAcroPDDoc.GetJSObject
        
        '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
            
            'Format is correct and no errors.
            
            'Set the path of the new file. Note that Adobe instead of xls uses xml files.
            'That's why here the xls extension changes to xml.
            If LCase(FileExtension) <> "xls" Then
                NewFilePath = WorksheetFunction.Substitute(PDFPath, ".pdf", "." & LCase(FileExtension))
            Else
                NewFilePath = WorksheetFunction.Substitute(PDFPath, ".pdf", ".xml")
            End If
            
            'Save PDF file to the new format.
            boResult = objJSO.SaveAs(NewFilePath, ExportFormat)
            
            'Close the PDF file without saving the changes.
            boResult = objAcroAVDoc.Close(True)
            
            'Close the Acrobat application.
            boResult = objAcroApp.Exit
            
        Else
            
            'Something went wrong, so close the PDF file and the application.
            
            'Close the PDF file without saving the changes.
            boResult = objAcroAVDoc.Close(True)
            
            'Close the Acrobat application.
            boResult = objAcroApp.Exit

        End If
            
        'Release the objects.
        Set objAcroPDDoc = Nothing
        Set objAcroAVDoc = Nothing
        Set objAcroApp = Nothing
            
    End Sub

    Irei verificar num PC com o acrobat reader se com o ficheiro do SDK funciona.

    Poderá ser uma alternativa a utilização de uma aplicação OpenSource, tipo PDFcreator ou outro instalada e fazer via VBA.
    Irei verificar esta 2ª alternativa e depois posto.

    Abraço
    Alvaro Teixeira
    Alvaro Teixeira
    Moderador Global
    Moderador Global


    Respeito às regras : Respeito às Regras 100%

    Sexo : Masculino
    Localização : Portugal
    Mensagens : 7919
    Registrado : 15/03/2013

    [Resolvido]arquivo ACROBAT.TLB Empty Re: [Resolvido]arquivo ACROBAT.TLB

    Mensagem  Alvaro Teixeira 24/3/2016, 22:28

    Olá de novo, parece que com Access 2013 é possível para word:

    Código:
    Sub convertToWord()
      Dim MyObj As Object, MySource As Object, file As Variant
      file = Dir("D:\OfficeDev\Word\201505\Pdf\" & "*.pdf") 'pdf path
      Do While (file <> "")
      ChangeFileOpenDirectory "D:\OfficeDev\Word\201505\Pdf\"
              Documents.Open FileName:=file, ConfirmConversions:=False, ReadOnly:= _
            False, AddToRecentFiles:=False, PasswordDocument:="", PasswordTemplate:= _
            "", Revert:=False, WritePasswordDocument:="", WritePasswordTemplate:="", _
            Format:=wdOpenFormatAuto, XMLTransform:=""
        ChangeFileOpenDirectory "D:\OfficeDev\Word\201505\Pdf\Word"'path for saving word
        ActiveDocument.SaveAs2 FileName:=Replace(file, ".pdf", ".docx"), FileFormat:=wdFormatXMLDocument _
            , LockComments:=False, Password:="", AddToRecentFiles:=True, _
            WritePassword:="", ReadOnlyRecommended:=False, EmbedTrueTypeFonts:=False, _
            SaveNativePictureFormat:=False, SaveFormsData:=False, SaveAsAOCELetter:= _
            False, CompatibilityMode:=15
        ActiveDocument.Close
        file = Dir
      Loop
    End Sub

    Origem do código
    Abraço
    baldocchi
    baldocchi
    Intermediário
    Intermediário


    Respeito às regras : Respeito às Regras 100%

    Sexo : Masculino
    Localização : Brasil
    Mensagens : 128
    Registrado : 03/11/2014

    [Resolvido]arquivo ACROBAT.TLB Empty Re: [Resolvido]arquivo ACROBAT.TLB

    Mensagem  baldocchi 1/3/2019, 12:35

    tópico resolvido

    Conteúdo patrocinado


    [Resolvido]arquivo ACROBAT.TLB Empty Re: [Resolvido]arquivo ACROBAT.TLB

    Mensagem  Conteúdo patrocinado


      Data/hora atual: 19/4/2024, 15:41