Hi,
When attempting to add a label with a truetype font to a page I get the exception below. Switching to a "standard" pdf-font removes the exception. (The ttf in question is Gothham from http://www.typography.com/).
(I do not set the font size to 0, nor use the Leading property.)
regards,
Dag Osterhagen
----------------------
TestCase 'Zocas.BusinessLogic.FR.Test.PDFTester.GeneratePDF' failed: System.OverflowException : Value was either too large or too small for an Int32.
at System.Convert.ToInt32(Double value)
at ceTe.DynamicPDF.Text.TextLineList.GetLineCount(Int32 startLine, Single height)
at ceTe.DynamicPDF.Text.TextLineList.SetLines(Boolean setAllLines)
at ceTe.DynamicPDF.Text.TextLineList.Draw(PageWriter writer, Single x, Single y, TextAlign align, Color textColor, Boolean underline, Boolean rightToLeft)
at ceTe.DynamicPDF.PageElements.Label.DrawRotated(PageWriter writer)
at ceTe.DynamicPDF.PageElements.RotatingPageElement.Draw(PageWriter writer)
at ceTe.DynamicPDF.PageElements.Group.Draw(PageWriter writer)
at ceTe.DynamicPDF.Page.DrawAppend(PageWriter writer)
at ceTe.DynamicPDF.Page.b(DocumentWriter A_0, Int32 A_1, Int32 A_2, Int32 A_3)
at ceTe.DynamicPDF.Page.c(DocumentWriter A_0, Int32 A_1, Int32 A_2, Int32 A_3)
at ceTe.DynamicPDF.PageList.a(DocumentWriter A_0, Int32 A_1)
at ceTe.DynamicPDF.IO.DocumentWriter.h()
at ceTe.DynamicPDF.Document.Draw(Stream stream)
Value was either too large or too small for an Int32 (Revisited)
Re: Value was either too large or too small for an Int32 (Revisited)
Support · Nov 21, 2005If you are using VB.NET, this error can be produced by mixing up the order of the parameters of the Label constructor. This is because VB.NET will automatically convert Enumerations to numeric values if they are given when a number is expected. This can result in the font size accidentally being set to 0. Here is an example:
MyPage.Elements.Add(New Label("Test", 0, 0, 100, 15, Font.Helvetica, TextAlign.Left, 12))
In the example the alignment and font size parameters are switched. Note that in C#, a compiler error is thrown when a similar thing is done, where as VB.NET will substitute a 0 for the font size, since Left has an enumeration value of 0.
If you continue to have problems, please send your code over to [^a|mailto:support@cete.com|Support^] and we will look into it further and post the resolution here.
Thanks,
ceTe Software Support Team
Re: Value was either too large or too small for an Int32 (Revisited)
Forum member · Nov 21, 2005Thank you for the quick response!
I use C#, so VB.NET is not an issue.
I'll mail some code, and the ttf, to your support.
-- dag