Save Annotation to PDF

Discussions about annotation support.
Post Reply
Joe
Posts: 14
Joined: Sat Apr 30, 2011 8:53 am

Save Annotation to PDF

Post by Joe » Sat Mar 10, 2012 11:13 am

Hi,

today i downloaded the curretn .NET Version 8.5 from your website and i used this sample code
to load a PDF, add a simple text annotation by code and save the annotation into the PDF.

Form-Load Event:

Code: Select all

oGdPicturePDF.LoadFromFile("c:\anleitung.pdf", False)

        Dim oAnnotationManager As AnnotationManager = New AnnotationManager
        If oAnnotationManager.InitFromGdPicturePDF(oGdPicturePDF) = GdPictureStatus.OK Then
            oAnnotationManager.SelectPage(1)
            Dim annot As AnnotationText = oAnnotationManager.AddTextAnnot(1, 1, 2, 2, "TESTTESTTEST")
            annot.CanSelect = True
            annot.Author = "John"
            annot.StrokeColor = Color.Blue
            annot.BorderWidth = 1
            annot.Fill = True
            '   oAnnotationManager.BurnAnnotationsToPage(True) 'Comment this line to keep annots as XMP format
            oAnnotationManager.SaveAnnotationsToPage()
            oAnnotationManager.SaveDocumentToPDF("c:\testout.pdf")
        End If
        oAnnotationManager.Close()

        GdViewer1.DisplayFromGdPicturePDF(oGdPicturePDF)
The annotation is displayed in the GdViewer1 but is not saved into the PDF-file.
When i open the PDF with Acrobat the annotation is not visible.
If i use oAnnotationManager.BurnAnnotationsToPage(True) then GDviewer shows only a white
empty page for PDF page 1.

Is there a bug or did i something wrong ?

P.s.: I'm using VS 2008 and .NET Framework 2.0

Thanks
Joe

User avatar
Loïc
Site Admin
Posts: 5881
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: Save Annotation to PDF

Post by Loïc » Sat Mar 10, 2012 2:09 pm

Hello,

You have to burn the annotation to the document in order to see it with other viewer than GdViewer.
If i use oAnnotationManager.BurnAnnotationsToPage(True) then GDviewer shows only a white
Could you attach the document for investigation ?
If there is private content you can send it through https://www.gdpicture.com/support/getting-support-from-our-team

kind regards,

Loïc

Joe
Posts: 14
Joined: Sat Apr 30, 2011 8:53 am

Re: Save Annotation to PDF

Post by Joe » Fri Mar 16, 2012 3:28 pm

Hi Loic,

i checked it with different PDF documents and had allways the same effekt.
To be sure that the effect is not caused by the PDF itself i created a new PDF, add an annotation and tried to burn that
on the page.
But the effect is still the same that means a white page in GDViewer1 whithout control.

Here is the code:

Code: Select all

      ' Create new PDFwith one empty page
        oGdPicturePDF.NewPDF()
        oGdPicturePDF.NewPage(800, 800)

        Dim oAnnotationManager As AnnotationManager = New AnnotationManager
        If oAnnotationManager.InitFromGdPicturePDF(oGdPicturePDF) = GdPictureStatus.OK Then
            oAnnotationManager.SelectPage(1)
            Dim annot As AnnotationText = oAnnotationManager.AddTextAnnot(1, 1, 2, 2, "TESTTESTTEST")
            annot.CanSelect = True
            annot.Author = "John"
            annot.StrokeColor = Color.Blue
            annot.BorderWidth = 1
            annot.Fill = True
           ' oAnnotationManager.SaveAnnotationsToPage()
            oAnnotationManager.BurnAnnotationsToPage(True)     'Comment this line to keep annots as XMP format
        End If
        oAnnotationManager.Close()

        GdViewer1.DisplayFromGdPicturePDF(oGdPicturePDF)
If i uncomment the line oAnnotationManager.BurnAnnotationsToPage(True) the annotation
of course is visible in GDviewer1.

Any idea about what's wrong here ?

User avatar
Loïc
Site Admin
Posts: 5881
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: Save Annotation to PDF

Post by Loïc » Fri Mar 16, 2012 4:04 pm

Hello,

Could you explain what do you expect ?

If I run your code I have a PDF displayed with a burned annotation (which is the normal behavior).

If I use

Code: Select all

 oAnnotationManager.SaveAnnotationsToPage()
' oAnnotationManager.BurnAnnotationsToPage(True)     'Comment this line to keep annots as XMP format
I have a PDF displayed with an annotation viewable and editable into the GdViewer object. (which is also the normal behaviour).

Kind regards,

Loïc

Joe
Posts: 14
Joined: Sat Apr 30, 2011 8:53 am

Re: Save Annotation to PDF

Post by Joe » Fri Mar 16, 2012 6:49 pm

Hello,

After I run the code i have a PDF displayed with only a blank white empty page and no burned annotation !
All PDF content seems to disapear after using the BurnAnnotationsToPage(True) !

I would expect to get the same result as you got that means a PDF displayed with a burned annotation (which is the normal behavior)

Might that be caused by a license ? I'm using the 30 days eval license.
Or might it be that available version 8.5 in the donwload area is not the newest one ?

If I use

oAnnotationManager.SaveAnnotationsToPage()
' oAnnotationManager.BurnAnnotationsToPage(True) 'Comment this line to keep annots as XMP format

I have the same result that you have ... a PDF displayed with an annotation viewable and editable into the GdViewer object. (which is the normal behaviour).

Kind regards,
Joe

User avatar
Loïc
Site Admin
Posts: 5881
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: Save Annotation to PDF

Post by Loïc » Fri Mar 16, 2012 7:14 pm

Hello,

Check you are using the latest version available: https://www.gdpicture.com/download/downl ... urenet.php
If the problem persists, please reproduce it in a standalone application including your license key and sent it through https://www.gdpicture.com/support/getting-support-from-our-team

Kind regards,

Loïc

Joe
Posts: 14
Joined: Sat Apr 30, 2011 8:53 am

Re: Save Annotation to PDF

Post by Joe » Fri Mar 30, 2012 8:59 pm

Hello Loic,

some times ago i have posted some more questions like "Adding grid and rulers to GDviewer for PDF editing"
in other forum channels but up to now didn'd get any answer from you.

Could you please check my posts and send me your answers ?

Thanks
Joe

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests