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
Login to view the files attached to this post.