AutoSize property

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

AutoSize property

Post by KevinLK » Wed Jan 04, 2017 9:17 am

Hi

I'm currently adding annotations via XML, and bumped into some problems regarding AutoSize.

If AutoSize isn't the last tag in the XML, Width and Height will be set to 0. I managed to fix that by setting AutoSize as the last tag.

Now it seems though that the width and height isn't changed even though i have set AutoSize to true.

Am i doing something wrong or is AutoSize only used in DocuViewer to change the size of the textbox?

Kind regards,
Kevin

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

Re: AutoSize property

Post by Loïc » Fri Jan 06, 2017 3:48 pm

Hi Kevin,

Could you provide a code snippet or a standalone application that reproduces the issue and demonstrates how you are adding the annotation?

Kind regards,

Loïc

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

Re: AutoSize property

Post by Loïc » Sat Jan 07, 2017 6:07 pm

Actually I think I've understood what the problem was. The next minor version should fix it.

Kind regards,

Loïc

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

Re: AutoSize property

Post by KevinLK » Mon Jan 09, 2017 9:33 am

First off we use Fabricjs for the UI.

When we then try to save the image, we add the all data to an collection, accordingly to the documentation of GdPicture (The right properties etc.)

Code: Select all

 
 collection.Add(new AnnotationTypeTextDTO()
                    {
                        Id = Guid.NewGuid().ToString(),
                        Left = ScaleAndConvertToInches(ratio, (Pixel)(obj.CenterX + additionalWidth / 4)),
                        Top = ScaleAndConvertToInches(ratio, (Pixel)(obj.CenterY + additionalHeight / 4)),
                        Width = ScaleAndConvertToInches(ratio, (Pixel)(obj.Width + additionalWidth)),
                        Height = ScaleAndConvertToInches(ratio, (Pixel)(obj.Height + additionalHeight)),
                        Rotation = obj.Angle,
                        Opacity = 1,
                        StrokeColor = ConvertColorToInt(obj.IETextStroke),
                        BorderWidth = ScaleAndConvertToInches(ratio, (Pixel)obj.IETextStrokeWidth),
                        FontColor = ConvertColorToInt(obj.Fill),
                        FillColor = ConvertColorToInt(obj.IETextBackground),
                        Alignment = GetTextAlign(obj.TextAlign),
                        FontStyle = GetFontStyle(obj),
                        RadiusFactor = 0,
                        Visible = true,
                        Fill = obj.IETextBackground == "rgba(0, 0, 0, 0)" || obj.IETextBackground == "transparent" ? false : true,
                        Stroke = obj.Fill == "rgba(0, 0, 0, 0)" || obj.Fill == "transparent" ? false : true,
                        Zorder = zOrder,
                        FontSize = Math.Floor(obj.FontSize / ratio),
                        FontName = obj.FontFamily,
                        Text = obj.Text,
                        AutoSize = true,
                    });
When all the annotations are added to the collection, we then send it over to the server through WCF and try to add the annotations with annotation manager.

Code: Select all

            
            foreach (IAnnotationDTO annotationDTO in Collection)
            {
                Handle.Get().AddAnnotationFromXML(annotationDTO.GetWriter());
            }


Example of the XML that comes from annotationDTO.GetWriter()

Code: Select all

<Annotation>
<Type>AnnotationTypeText</Type>
<Text>Test4</Text>
<FontName>Times New Roman</FontName>
<FontStyle>Regular</FontStyle>
<FontSize>138</FontSize>
<ForeColor>-65536</ForeColor>
<CanEditText>True</CanEditText>
<ID>8244994b-a027-42a7-8266-6debe39157d6</ID>
<Top>5.2</Top>
<Left>10.1</Left>
<Width>13.8</Width>
<Height>2.2</Height>
<FlipX>False</FlipX>
<FlipY>False</FlipY>
<Rotation>0</Rotation>
<Zorder>1</Zorder>
<CanMove>True</CanMove>
<CanResize>False</CanResize>
<CanRotate>False</CanRotate>
<CanSelect>True</CanSelect>
<Printable>True</Printable>
<Visible>True</Visible>
<Opacity>1</Opacity>
<Fill>True</Fill>
<FillColor>0</FillColor>
<Stroke>True</Stroke>
<StrokeColor>0</StrokeColor>
<BorderWidth>0.2</BorderWidth>
<CreationTime>01-01-0001 00:00:00</CreationTime>
<ModificationTime>01-01-0001 00:00:00</ModificationTime>
<PreventBurning>False</PreventBurning>
<RadiusFactor>0</RadiusFactor>
<SquaredBox>False</SquaredBox>
<AutoSize>True</AutoSize>
</Annotation>
If I change the width to for instance to 1, i would assume that since AutoSize is set to true that it automatically change the width accordingly to the width of the text. But it doesn't

Kind regards,
Kevin

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

Re: AutoSize property

Post by KevinLK » Mon Jan 09, 2017 9:34 am

Loïc wrote:Actually I think I've understood what the problem was. The next minor version should fix it.

Kind regards,

Loïc
Oh nice. When would that be if I may ask?

Kind regards,
Kevin

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

Re: AutoSize property

Post by Loïc » Thu Jan 12, 2017 11:03 am

Hi Kevin,

We've just published the new update. Could you try it and let me know how things are now from your end?

Kind regards,

Loïc

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

Re: AutoSize property

Post by KevinLK » Fri Jan 13, 2017 9:31 am

Hi Loïc

I have performed various test, and it works :)

Thank you very much for solving the issue so quickly.

Have i nice weekend.

Kind regards,
Kevin

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

Re: AutoSize property

Post by Loïc » Fri Jan 13, 2017 2:18 pm

You are very welcome Kevin!

Thank you for the return and have a nice week-end too!

Cheers,

Loïc

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

Re: AutoSize property

Post by KevinLK » Thu Jan 19, 2017 11:37 am

Hi Loïc

Unfortunately i found a issue regarding AutoSize.

When I align my text in the center or right, the width of the textannotation box is not right :(

Kind regards,
Kevin

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

Re: AutoSize property

Post by Loïc » Thu Jan 19, 2017 12:53 pm

Hi Kevin,

Could you open a ticket on our helpdesk by providing all required information to be able to reproduce the issue from our end?

Here you go: https://support.gdpicture.com

With best regards,

Loïc

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest