VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



This program generates a pdf file using the Adobe Acrobat 4.0 Type Library

by Kaustubh Zoal (10 Submissions)
Category: Miscellaneous
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Fri 21st June 2002
Date Added: Mon 8th February 2021
Rating: (1 Votes)

This program generates a pdf file using the Adobe Acrobat 4.0 Type Library

Rate This program generates a pdf file using the Adobe Acrobat 4.0 Type Library




'definitions
Dim acroApp As CAcroApp
Dim pdDoc As CAcroPDDoc
Dim avDoc As CAcroAVDoc
Dim pdTextSelect As CAcroPDTextSelect
Dim acroRect As CAcroRect
Dim intPage As Integer
Dim bFileOpen As Boolean
Dim bSelectSet As Boolean
Dim bShowSelect As Boolean

'Creating the objects
Set acroApp = CreateObject("AcroExch.App", "")
Set pdDoc = CreateObject("AcroExch.PDDoc", "")
Set avDoc = CreateObject("AcroExch.AVDoc", "")
Set acroRect = CreateObject("AcroExch.Rect", "")

'Setting the booleans
bFileOpen = False
bSelectSet = False
bShowSelect = False

'Show the Application
acroApp.Show

'Open the test document
bFileOpen = avDoc.Open(App.Path & "\test.pdf", "test file")
'if the test file opened
If (bFileOpen) Then
    'Get the PDDoc
    Set pdDoc = avDoc.GetPDDoc
    'Set to the first page
    intPage = 0
    
    'Define the area I want the text to be selected from
    acroRect.bottom = 225
    acroRect.Left = 140
    acroRect.Top = 230
    acroRect.Right = 145
    
    'Create the text selection
    Set pdTextSelect = pdDoc.CreateTextSelect(intPage, acroRect)
        
    'Set the text selection
    bSelectSet = avDoc.SetTextSelection(pdTextSelect)
    'If the set was successful
    If (bSelectSet) Then
       'Then show the selection
       bShowSelect = avDoc.ShowTextSelect
       Debug.Print pdTextSelect.GetText(intPage)
    End If
    
    acroRect.bottom = 125
    acroRect.Left = 240
    acroRect.Top = 330
    acroRect.Right = 345
    
    'Create the text selection
    Set pdTextSelect = pdDoc.CreateTextSelect(intPage, acroRect)
        
    'Set the text selection
    bSelectSet = avDoc.SetTextSelection(pdTextSelect)
    
    'If the set was successful
    If (bSelectSet) Then
       'Then show the selection
       bShowSelect = avDoc.ShowTextSelect
       Debug.Print pdTextSelect.GetText(intPage)
    End If
    
    'close the document
    avDoc.Close (False)
End If

'clean up
Set pdTextSelect = Nothing
Set acroRect = Nothing
Set pdPage = Nothing
Set pdDoc = Nothing
Set avDoc = Nothing
Set acroApp = Nothing
End Sub


Download this snippet    Add to My Saved Code

This program generates a pdf file using the Adobe Acrobat 4.0 Type Library Comments

No comments have been posted about This program generates a pdf file using the Adobe Acrobat 4.0 Type Library. Why not be the first to post a comment about This program generates a pdf file using the Adobe Acrobat 4.0 Type Library.

Post your comment

Subject:
Message:
0/1000 characters