Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.

Thu Jul 04, 2019 12:15 pm

Hello,

I am testing your example https://www.e-iceblue.com/Knowledgebase ... e.PDF.html

It works, but the cross in the Checkbox is too small
Is it possible to have that cross (or any other of the styles) to fill the whole box?
See screenshot.

Thank you

Heinz4711
 
Posts: 20
Joined: Thu Feb 07, 2019 5:22 pm

Fri Jul 05, 2019 3:21 am

Hello,

Thanks for your post.
When adding the CheckBox field on an existing PDF file like the tutorial you mentioned, I did notice that all the checked styles (cross, star...) are too small. This issue has been submitted to our bug tracking system for further investigating and fixing. Once there is any update, we will keep you posted. However, when adding the CheckBox field on a new PDF file like the following sample code, the checked styles could fill the whole box. Thus, you can try this way as a workaround. Here, I also attached my output PDF for your reference.
Code: Select all
 //create new PDF file
 PdfDocument pdf = new PdfDocument();
 PdfPageBase page = pdf.Pages.Add();
 PdfFont font = new PdfFont(PdfFontFamily.Helvetica, 13f);
 PdfBrush brush = PdfBrushes.Black;
 float x = 10;
 float y = 10;
 float tempX = 0;
 float tempY = 0;
 string text = "Checkbox: ";
 y += tempY;
 page.Canvas.DrawString(text, font, brush, x, y);
 tempX = font.MeasureString(text).Width + 15;
 tempY = font.MeasureString(text).Height + 15;
 //Add check box field
 PdfCheckBoxField checkbox = new PdfCheckBoxField(page, "CheckBox");
 checkbox.Bounds = new RectangleF(tempX, y, 15, 15);
 checkbox.BorderWidth = 0.75f;
 checkbox.Style = PdfCheckBoxStyle.Cross;
 pdf.Form.Fields.Add(checkbox);
 pdf.SaveToFile("Output.pdf", Spire.Pdf.FileFormat.PDF);

Sincerely,
Lisa
E-iceblue support team
User avatar

Lisa.Li
 
Posts: 1261
Joined: Wed Apr 25, 2018 3:20 am

Wed Jul 31, 2019 9:23 am

Hello,

Greetings from E-iceblue.
Kindly note that we just released Spire.PDF Pack(Hot Fix) Version:5.7.20, it fixed the cross size issue when adding the CheckBox field on an existing PDF file. Welcome to download it from the following links and test.
Website link: https://www.e-iceblue.com/Download/download-pdf-for-net-now.html
Nuget link: https://www.nuget.org/packages/Spire.PDF/

Sincerely,
Lisa
E-iceblue support team
User avatar

Lisa.Li
 
Posts: 1261
Joined: Wed Apr 25, 2018 3:20 am

Fri Aug 02, 2019 8:20 am

Hello,

Greetings from E-iceblue.
Did the hotfix version work for you? Thanks in advance for your feedback and time.

Sincerely,
Lisa
E-iceblue support team
User avatar

Lisa.Li
 
Posts: 1261
Joined: Wed Apr 25, 2018 3:20 am

Return to Spire.PDF