I am doing some work with Aspose PDF (latest version) where I find some text (using a TextFragmentAbsorber) and replace it with a CheckboxField.
My code looks like this (where tf is the TextFragment I'm filling):
CheckboxField checkboxField = new CheckboxField(tf.getPage(), tf.getRectangle());
// Set the field name
String name = "checkbox";
checkboxField.setPartialName(name);
String fontName = tf.getTextState().getFont().getFontName();
double fontSize = tf.getTextState().getFontSize();
checkboxField.setDefaultAppearance(new DefaultAppearance(fontName,
fontSize, Color.black));
// Create a border object
com.aspose.pdf.Border border = new com.aspose.pdf.Border(checkboxField);
border.setWidth(2);
border.setStyle(BorderStyle.Inset);
checkboxField.setBorder(border);
checkboxField.setStyle(BoxStyle.Cross);
// Add the field to the document
pdfDoc.getForm().add(checkboxField, tf.getPage().getNumber());
My problem is that the checkbox that I add doesn't show up when printing the document if it is not checked. In other words, you cannot see the border when printing. You can see the border within my PDF viewer, but it is grey and subdued...
Am I missing some way to specify the border of the checkboxfield?
My code looks like this (where tf is the TextFragment I'm filling):
CheckboxField checkboxField = new CheckboxField(tf.getPage(), tf.getRectangle());
// Set the field name
String name = "checkbox";
checkboxField.setPartialName(name);
String fontName = tf.getTextState().getFont().getFontName();
double fontSize = tf.getTextState().getFontSize();
checkboxField.setDefaultAppearance(new DefaultAppearance(fontName,
fontSize, Color.black));
// Create a border object
com.aspose.pdf.Border border = new com.aspose.pdf.Border(checkboxField);
border.setWidth(2);
border.setStyle(BorderStyle.Inset);
checkboxField.setBorder(border);
checkboxField.setStyle(BoxStyle.Cross);
// Add the field to the document
pdfDoc.getForm().add(checkboxField, tf.getPage().getNumber());
My problem is that the checkbox that I add doesn't show up when printing the document if it is not checked. In other words, you cannot see the border when printing. You can see the border within my PDF viewer, but it is grey and subdued...
Am I missing some way to specify the border of the checkboxfield?