Need help assigning an annotation object
Posted: Sun Dec 29, 2013 2:52 am
I'm attempting to implement in MS Access 2007 example code from the GdPicture online documentation that imports a file, adds and rubber stamp, rotates it and then displays it. However, when I attempt to replicate this code in an access 2007 vba environment, my attempt to assign the returned AnnotationRubberStamp to the AnnotationRubberStamp object results in a 'run-time error 91, object or with block variable not set.
Following is the code supplied in the GdPicture examples:
I've converted this for use with Access vba to the following:
Use of the following AddRubberStampAnnot statement without assigning the return value works fine
so I know my method arguments are OK.
Any help to get me over this hump would be appreciated. I'm am currently evaluating this software and without understanding why this will not work I can't move forward.
Complete code from the GdPicture website follows:
My complete code where GdViewer8 is my GdViewer control:
Following is the code supplied in the GdPicture examples:
Code: Select all
Dim annot As AnnotationRubberStamp = oAnnotationManager.AddRubberStampAnnot(Color.Red, 0, 0, oGdPicturePDF.GetPageWidth / 72, oGdPicturePDF.GetPageHeight / 72, "APPROVED")
Code: Select all
Dim annot As AnnotationRubberStamp
annot = oAnnotationManager.AddRubberStampAnnot(-16777216, 0, 0, 3, 3, "APPROVED")
Code: Select all
oAnnotationManager.AddRubberStampAnnot -16777216, 0, 0, 3, 3, "APPROVED"
Any help to get me over this hump would be appreciated. I'm am currently evaluating this software and without understanding why this will not work I can't move forward.
Complete code from the GdPicture website follows:
Code: Select all
'The following code assumes that a GdViewer called GdViewer1 has been painted on the form.
Dim oGdPicturePDF As New GdPicturePDF
oGdPicturePDF.LoadFromFile("c:\test.pdf", False)
GdViewer1.DisplayFromGdPicturePDF(oGdPicturePDF)
Dim oAnnotationManager As New AnnotationManager
oAnnotationManager.InitFromGdViewer(GdViewer1)
oAnnotationManager.SelectPage(1)
Dim annot As AnnotationRubberStamp = oAnnotationManager.AddRubberStampAnnot(Color.Red, 0, 0, oGdPicturePDF.GetPageWidth / 72, oGdPicturePDF.GetPageHeight / 72, "APPROVED")
annot.Rotation = 20
oAnnotationManager.SaveAnnotationsToPage()
oAnnotationManager.Close()
GdViewer1.Redraw()
Code: Select all
Dim Forecolor As Long
Dim oGdPicturePDF As New GdPicture_NET_10.GdPicturePDF
Dim oAnnotationManager As New annotationManager
oGdPicturePDF.LoadFromFile "c:\_temp\DOC120613.pdf", True
GdViewer8.DisplayFromGdPicturePDF oGdPicturePDF
oAnnotationManager.InitFromGdPicturePDF oGdPicturePDF
oAnnotationManager.SelectPage 1
Forecolor = GdViewer8.ARGBI(255, 0, 0, 0)
'
' Calling the following without using the AnnotationRubberStamp return value
' works just fine
'
oAnnotationManager.AddRubberStampAnnot Forecolor, 0, 0, 3, 3, "APPROVED"
'
' Calling the following attempting to set the AnnotationRubberStamp
' return value to a AnnotationRubberStamp object causes a
' run-time error '91', object or with block variable not set
'
Dim annot As AnnotationRubberStamp
annot = oAnnotationManager.AddRubberStampAnnot(Forecolor, 0, 0, 3, 3, "APPROVED")
annot.Rotation = 20
oAnnotationManager.SaveAnnotationsToPage
oAnnotationManager.Close
GdViewer8.ReloadAnnotations
GdViewer8.Redraw