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.

Mon Jun 13, 2016 9:36 pm

I'm unable to send over checkbox data to a new file. I can start with a blank pdf, save a form style checkbox that is checked. Save it as a doc or xps and neither will bring over the value. If I use adobe reader and check the box and print to xps, it works fine. I'm in an evaluation of this product, and without the ability to check a box on a form and print it to an xps format, I will not be able to go any farther.

PdfDocument doc = new PdfDocument("Blank.pdf");
PdfPageBase page = doc.Pages[0];
doc.AllowCreateForm = (doc.Form == null);
{
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 = "Textbox: ";
page.Canvas.DrawString(text, font, brush, x, y);
tempX = font.MeasureString(text).Width + 15;
tempY = font.MeasureString(text).Height + 15;
PdfTextBoxField textbox = new PdfTextBoxField(page, "TextBox");
textbox.Bounds = new RectangleF(tempX, y, tempX * 2, 15);
textbox.BorderWidth = 0.75f;
textbox.BorderStyle = PdfBorderStyle.Solid;
textbox.Text = "Hello";
doc.Form.Fields.Add(textbox);

text = "Checkbox: ";
y += tempY;
page.Canvas.DrawString(text, font, brush, x, y);
tempX = font.MeasureString(text).Width + 15;
tempY = font.MeasureString(text).Height + 15;
PdfCheckBoxField checkbox = new PdfCheckBoxField(page, "CheckBox");
checkbox.Bounds = new RectangleF(tempX, y, 15, 15);
checkbox.BorderWidth = 0.75f;
checkbox.Style = PdfCheckBoxStyle.Star;
checkbox.Checked = true;
checkbox.Flatten = true;

doc.Form.Fields.Add(checkbox);
}

string fileName;
fileName = "blanktest.pdf";
doc.SaveToFile(fileName,FileFormat.PDF);
doc.Close();

doc = new PdfDocument(fileName);

fileName = "3310.4_test.xps";
doc.SaveToFile(fileName, FileFormat.XPS);

doc.Close();
System.Diagnostics.Process.Start(fileName);

rethridge
 
Posts: 3
Joined: Fri Jun 10, 2016 9:42 pm

Tue Jun 14, 2016 2:22 am

Hi,

Thanks for interest in our products.
I have replicated the checkbox value missing issue in Xps format, and it has been forwarded to our dev team. Sorry for the inconvenience caused by the issue. We will inform you when it is resolved. And I tested to convert it to a doc using pdf.SaveToFile(fileName, FileFormat.DOC), it works fine.

Best Regards,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 3043
Joined: Wed Jun 27, 2012 8:50 am

Tue Jun 14, 2016 8:39 pm

I cannot get it to work properly as a DOC nor HTML. If the development team was to fix this, what would be the release schedule?

rethridge
 
Posts: 3
Joined: Fri Jun 10, 2016 9:42 pm

Wed Jun 15, 2016 1:48 am

Hi,

Through investigation we found out the cause which caused the checkbox value missing issue. It is because computer doesn't install the fonts support the Star characters. Please ensure your computer install ZapfDingbats.TTF font.

Best Regards,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 3043
Joined: Wed Jun 27, 2012 8:50 am

Wed Jun 15, 2016 3:56 pm

Sorry, installing the fonts did not work.

rethridge
 
Posts: 3
Joined: Fri Jun 10, 2016 9:42 pm

Thu Jun 16, 2016 2:26 am

Hi,

Did you install the fonts I attached under the path C:\Windows\Fonts? Could you please try it on more computers to check if it works? Looking forward to your further feedback.

Best Regards,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 3043
Joined: Wed Jun 27, 2012 8:50 am

Return to Spire.PDF