PDFsharp & MigraDoc Foundation
https://forum.pdfsharp.net/

WidthAndHeightCannotBeNegative
https://forum.pdfsharp.net/viewtopic.php?f=2&t=2750
Page 1 of 1

Author:  Effecto [ Thu Feb 27, 2014 2:18 pm ]
Post subject:  WidthAndHeightCannotBeNegative

Hello,

4 times out of 10 , I receive an error with the size of a control.

The XSize.FromSizeF(SizeF size) throws a WidthAndHeightCannotBeNegative exception and the width is coming as a small negative number.

This is the call stack :

PdfSharp.Drawing.XSize..ctor(Double width, Double height) in C:\...\PDFsharp\code\PdfSharp\PdfSharp.Drawing\XSize.cs:ligne 60
PdfSharp.Pdf.PdfRectangle.get_Size() in C:\...\PDFsharp\code\PdfSharp\PdfSharp.Pdf\PdfRectangle.cs:ligne 301
PdfSharp.Pdf.AcroForms.PdfTextField.RenderAppearance() in C:\...\PDFsharp\code\PdfSharp\PdfSharp.Pdf.AcroForms\PdfTextField.cs:ligne 144
PdfSharp.Pdf.AcroForms.PdfTextField.set_Text(String value) in C:\...\PDFsharp\code\PdfSharp\PdfSharp.Pdf.AcroForms\PdfTextField.cs:ligne 64

I can't figured it out , because when I modify the field size of a control and retry (Fake modification) , it's always works then.

Does someone have any clue :?:

Thanks

Author:  Thomas Hoevel [ Thu Feb 27, 2014 2:24 pm ]
Post subject:  Re: WidthAndHeightCannotBeNegative

Hi!

I don't have a clue. An SSCCE might help us to replicate the problem.

Author:  Effecto [ Thu Mar 20, 2014 5:35 pm ]
Post subject:  Re: WidthAndHeightCannotBeNegative

I resolved my problem by adding Math.abs(). in the PdfRectangle class where my problem was detected.

Attachments:
2014-03-20_1330_001.png
2014-03-20_1330_001.png [ 4.97 KiB | Viewed 5533 times ]
2014-03-20_1330.png
2014-03-20_1330.png [ 6.28 KiB | Viewed 5533 times ]

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/