I am trying to create PDF Form according your example. But using existing PDF document. Here is the sample code:
File pdfFile = new File(currentDir + "\\" + "test.pdf");
Document document = pdfFile.Document;
public void Populate(Document document)
// 1. Define the form fields collection!
Form form = new Form(document);
document.Form = form;
Fields fields = form.Fields;
// 2. Define the page where to place the fields!
Page page = new Page(document);
// 3. Define the appearance style to apply to the fields!
DefaultStyle fieldStyle = new DefaultStyle();
fieldStyle.FontSize = 12;
fieldStyle.GraphicsVisibile = true;
PrimitiveComposer composer = new PrimitiveComposer(page);
StandardType1Font sf = new StandardType1Font(document, StandardType1Font.FamilyEnum.Helvetica, true, false);
I get an error on composer.SetFont(sf, 14); in PrimitiveComposer.cs in GetFontName.
Something about NullReference exception in scanner.ContentContext.Resources;
Can you please tell me what could be the problem, I will provide more details if needed. Is it possible to generate Form from existing pdf document.
apparently the resources dictionary was not defined; you should open a bug report and attach as much information as possible (the full stack trace, for example) so I can reproduce your issuee.
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.