AddAnnotationFromXML

Discussions about annotation support.
Post Reply
KevinLK
Posts: 15
Joined: Wed Jan 13, 2016 5:08 pm

AddAnnotationFromXML

Post by KevinLK » Mon Nov 21, 2016 2:46 pm

Hi,

Im currently trying to read the annotations from a document, and burn them to a new transparent png image.

The problem is though that the annotations that have been loaded with XML aren't added.

If i try to add an annotation through method it works fine.

Is there something wrong with the XML data or is that a bug?

Code: Select all

  GdPicturePDF pdf = new GdPicturePDF();
            pdf.LoadFromFile(@"C:\Test\Test.pdf", false);
            Int32 iId = pdf.RenderPageToGdPictureImage(72, true, true);

            AnnotationManager am = new AnnotationManager();

            GdPictureImaging oGdPictureImaging = new GdPictureImaging();
            //Int32 iId = oGdPictureImaging.CreateGdPictureImageFromFile(@"T:\Temp\TSN\test.pdf");

            am.InitFromGdPictureImage(iId);

            am.AddAnnotationFromXML(arrow);
            am.BurnAnnotationsToPage(false);
            am.SaveAnnotationsToPage();
            oGdPictureImaging.SaveAsPNG(iId, @"C:\Test\test.png");

Code: Select all

<Annotation>
               <Type>AnnotationTypeLineArrow</Type>
               <ID>624781a1-5013-4d96-9fc1-baf679ce793a</ID>
               <Left>4.26917</Left>
               <Top>7.77454</Top>
               <Width>0.31844</Width>
               <Height>0.9842</Height>
               <Rotation>205.9388</Rotation>
               <Opacity>1</Opacity>
               <SquaredBox>False</SquaredBox>
               <StrokeColor>-16777216</StrokeColor>
               <FillColor>-16777216</FillColor>
               <BorderWidth>0.05</BorderWidth>
               <RadiusFactor>0</RadiusFactor>
               <CreationTime>24-09-2014 16:53:02</CreationTime>
               <ModificationTime>12-01-2016 14:48:25</ModificationTime>
               <CanMove>True</CanMove>
               <CanResize>True</CanResize>
               <CanRotate>True</CanRotate>
               <CanSelect>True</CanSelect>
               <Printable>True</Printable>
               <PreventBurning>False</PreventBurning>
               <Visible>True</Visible>
               <Fill>False</Fill>
               <Stroke>True</Stroke>
               <Zorder>4</Zorder>
               <FlipX>False</FlipX>
               <FlipY>True</FlipY>
               <ArrowWidth>5</ArrowWidth>
               <ArrowHeight>7</ArrowHeight>
               <ArrowFilled>True</ArrowFilled>
            </Annotation>
Kind regards,
Kevin

Cedric
Posts: 260
Joined: Sun Sep 02, 2012 7:30 pm

Re: AddAnnotationFromXML

Post by Cedric » Wed Nov 23, 2016 1:25 pm

I don't think this is a valid annotation XML, what is expected as an input is the result of the GetAnnotationXML method call, is that what you are doing?

KevinLK
Posts: 15
Joined: Wed Jan 13, 2016 5:08 pm

Re: AddAnnotationFromXML

Post by KevinLK » Wed Nov 23, 2016 3:41 pm

That is what im doing.

The XML i have added as a quote to this thread is one a pulled trough GetAnnotationXML

Cedric
Posts: 260
Joined: Sun Sep 02, 2012 7:30 pm

Re: AddAnnotationFromXML

Post by Cedric » Wed Nov 23, 2016 3:59 pm

You should monitor the returned status after each method call, especially the AddAnnotationFromXML one, it should return an arrow annotation and if not, call the GetStat method in order to find out why, that's the only way to find out what went wrong.

KevinLK
Posts: 15
Joined: Wed Jan 13, 2016 5:08 pm

Re: AddAnnotationFromXML

Post by KevinLK » Wed Nov 23, 2016 4:15 pm

I just tried that, and the returned status is an GenericError. Any idear how i can debug it to get a more specific error?

Cedric
Posts: 260
Joined: Sun Sep 02, 2012 7:30 pm

Re: AddAnnotationFromXML

Post by Cedric » Wed Nov 23, 2016 4:19 pm

Could you please provide all the required elements to reproduce the issue in the same conditions as you do (that includes the input document, source code to annotate and get the annotation in addition to the source code already provided) so we can replicate the issue on our side?
A standalone project that we can run as-is would be the best.
You can open a ticket on the support platform to send us the investigation material if you prefer not to expose those information on the public forum.

KevinLK
Posts: 15
Joined: Wed Jan 13, 2016 5:08 pm

Re: AddAnnotationFromXML

Post by KevinLK » Wed Jan 04, 2017 8:57 am

Sorry for the late answer.
I managed to figuere it out.

But thanks anyway

StevenH
Posts: 4
Joined: Mon Mar 20, 2017 3:28 pm

Re: AddAnnotationFromXML

Post by StevenH » Thu Mar 30, 2017 11:19 am

I'm actually having this same problem in my asp.net mvc project.

I'm saving annotations to xml files and attempting reload them later.

I call the annotationmanager.AddAnnotationFromXML(fileXmlContent) and annotationManager.SaveAnnotationsToPage() methods and the status is all 'OK'

When I call the GpPicture.GetAnnotationCount() method shows that the annotations have been added but they don't appear / display in my DocuVieware instance.

Was there ever a solution to this issue?

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest