Click here to Skip to main content
15,887,214 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: How To Read Local Machine Time Pin
ktomecek19-Apr-08 15:47
professionalktomecek19-Apr-08 15:47 
Questionlooking for more efficient way to concatinate values in a datatable Pin
camatulli18-Apr-08 4:30
camatulli18-Apr-08 4:30 
GeneralRe: looking for more efficient way to concatinate values in a datatable Pin
Dave Kreskowiak18-Apr-08 8:05
mveDave Kreskowiak18-Apr-08 8:05 
GeneralRe: looking for more efficient way to concatinate values in a datatable Pin
camatulli18-Apr-08 8:11
camatulli18-Apr-08 8:11 
GeneralMail Merge Question Pin
jchigg200018-Apr-08 4:14
jchigg200018-Apr-08 4:14 
GeneralRe: Mail Merge Question Pin
jchigg200018-Apr-08 4:27
jchigg200018-Apr-08 4:27 
GeneralRe: Mail Merge Question Pin
camatulli18-Apr-08 4:34
camatulli18-Apr-08 4:34 
GeneralAdding Metadata Using Visual Basic 2008 Pin
Harold_Wishes18-Apr-08 3:35
Harold_Wishes18-Apr-08 3:35 
Hello,
I have attached a VB program done in VB 2008 which adds annotations to an Acrobat PDF file specified by the user. So far, it works like a champ. However, my ultimate goal is to build a VB 2008 application that inserts metadata into the "Title", "Author", "Subject" and "Keywords" fields that are accessible from the Description tab of the Document Properties dialog box on the Acrobat "File" menu. I can do this in Acrobat's built-in JavaScript debugger just fine. For instance, the following will insert Harry Wishes into the author field.


this.info.author = "Harry Wishes" 

My question: How do I invoke the Javascript object from Visual Basic 2008 that could access and modify this PDF metadata from Visual Basic? Help Apprectiated. Thanks! Smile | :)

Public Class Form1
    Dim gApp As Acrobat.CAcroApp

<p>
    Private Sub Form1_Load()
        gApp = CreateObject("AcroExch.App")
    End Sub

<p>
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim pdDoc As Acrobat.CAcroPDDoc
        Dim page As Acrobat.CAcroPDPage
        Dim jso As Object
        Dim path As String
        Dim point(1) As Integer
        Dim popupRect(3) As Integer
        Dim pageRect As Object
        Dim annot As Object
        Dim props As Object
<p>
        OpenFileDialog1.ShowDialog()
        path = OpenFileDialog1.FileName

        pdDoc = CreateObject("AcroExch.PDDoc")

        If pdDoc.Open(path) Then
            jso = pdDoc.GetJSObject
            If Not jso Is Nothing Then
                ' Get size for page 0 and setup arrays
                page = pdDoc.AcquirePage(0)
                pageRect = page.GetSize
                point(0) = 0
                point(1) = pageRect.y
                popupRect(0) = 0
                popupRect(1) = pageRect.y - 100
                popupRect(2) = 200
                popupRect(3) = pageRect.y
                ' Create a new text annot
                annot = jso.AddAnnot
                props = annot.getProps
                props.Type = "Text"
                annot.setProps(props)
                ' Fill in a few fields
                props = annot.getProps
                props.page = 1
                props.point = point
                props.popupRect = popupRect
                props.author = "Rob McAfee"
                props.noteIcon = "Comment"
                props.strokeColor = jso.Color.red
                props.Contents = "I added this comment from Visual Basic!"
                annot.setProps(props)

                pdDoc.Close()
                MsgBox("Annotation added to " & path)

            Else
                MsgBox("Failed to open " & path)
            End If
        End If
        pdDoc = Nothing
    End Sub
<p>
End Class</p></p></p></p>


GeneralRe: Adding Metadata Using Visual Basic 2008 Pin
Dave Kreskowiak18-Apr-08 4:27
mveDave Kreskowiak18-Apr-08 4:27 
GeneralPrinting Text File In Dot Matrix Printer Pin
Member 366452518-Apr-08 2:08
Member 366452518-Apr-08 2:08 
GeneralRe: Printing Text File In Dot Matrix Printer Pin
Dave Kreskowiak18-Apr-08 4:23
mveDave Kreskowiak18-Apr-08 4:23 
Questioncapture Pin
swathi chandra18-Apr-08 1:21
swathi chandra18-Apr-08 1:21 
GeneralRe: capture Pin
Smithers-Jones18-Apr-08 1:40
Smithers-Jones18-Apr-08 1:40 
GeneralRe: capture Pin
manavharsh18-Apr-08 3:24
manavharsh18-Apr-08 3:24 
QuestionQuick question on config file Pin
AHeavey17-Apr-08 23:54
AHeavey17-Apr-08 23:54 
GeneralRe: Quick question on config file Pin
Christian Graus18-Apr-08 0:34
protectorChristian Graus18-Apr-08 0:34 
GeneralRe: Quick question on config file Pin
AHeavey18-Apr-08 0:36
AHeavey18-Apr-08 0:36 
GeneralHelp with Integrating MS Word in VB.NET Pin
Jats_4ru17-Apr-08 23:27
Jats_4ru17-Apr-08 23:27 
GeneralRe: Help with Integrating MS Word in VB.NET Pin
parth.p18-Apr-08 0:19
parth.p18-Apr-08 0:19 
GeneralRe: Help with Integrating MS Word in VB.NET [modified] Pin
Jats_4ru18-Apr-08 1:53
Jats_4ru18-Apr-08 1:53 
GeneralRe: Help with Integrating MS Word in VB.NET Pin
parth.p18-Apr-08 2:46
parth.p18-Apr-08 2:46 
GeneralRe: Help with Integrating MS Word in VB.NET Pin
Jats_4ru18-Apr-08 3:14
Jats_4ru18-Apr-08 3:14 
QuestionHashing password, HOW ? Pin
masoodp66617-Apr-08 22:49
masoodp66617-Apr-08 22:49 
AnswerRe: Hashing password, HOW ? Pin
Guffa18-Apr-08 0:42
Guffa18-Apr-08 0:42 
GeneralRe: Hashing password, HOW ? [modified] Pin
Rob Smiley18-Apr-08 5:51
Rob Smiley18-Apr-08 5:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.