Hi,
it is possible to combine ordinary paragraphs and form fields? When I add paragraphs and then form fields there are in the same position. May I calculare the size a paragraph needs on the page.
Best regards,
Torsten
Hi,
it is possible to combine ordinary paragraphs and form fields? When I add paragraphs and then form fields there are in the same position. May I calculare the size a paragraph needs on the page.
Best regards,
Torsten
Thanks for contacting support.
Would you please share sample code snippet which you have tried along with generated output PDF and expected output. We will test the scenario in our environment and address it accordingly.
Sure. The following methods takes a document, a page and a kind of array. I like to create an input form with dynamic amount of label/textbox combinations
private void AddElementsToPage(Document document, Page page, SomeArray elements)
{
const int SINGLELINESIZE = 30;
double upperrightx = page.Rect.Width - 20;
double upperrighty = page.Rect.URY - 10;
double lowerleftx = 20;
double lowerlefty = upperrighty - SINGLELINESIZE;
foreach (var element in elements)
{
// create element
var rectangle = new Rectangle(lowerleftx, lowerlefty, upperrightx, upperrighty);
if ("text".Equals(surveyElement["type"].ToString()))
{
// Creation as label works but looks not so good
//TextBoxField labelField = new TextBoxField(page, rectangle);
//labelField.Value = title;
//labelField.Multiline = true;
//labelField.ReadOnly = true;
//labelField.Name = "textField";
//labelField.Height = 18;
//document.Form.Add(labelField);
// Creation a text looks better but does not work
TextFragment questionheader = new TextFragment(title);
page.Paragraphs.Add(questionheader);
// Eingabefeld
upperrighty -= 30;
lowerlefty -= 30;
rectangle = new Rectangle(lowerleftx, lowerlefty, upperrightx, upperrighty);
TextBoxField textField = new TextBoxField(page, rectangle);
textField.Value = name;
textField.Multiline = false;
textField.ReadOnly = false;
textField.Name = "textField";
textField.Height = 15;
Border border = new Border(textField);
border.Width = 1;
border.Dash = new Dash(1, 1);
textField.Border = border;
textField.Color = Color.FromRgb(System.Drawing.Color.AntiqueWhite);
document.Form.Add(textField);
}
upperrighty -= 20;
lowerlefty -= 20;
}
Thanks for your efforts.
Best regards,
Torsten
Attached a fully functional sample (except licence of course).
Best regards,
zimmyAsposeTest.zip (5.0 KB)
Thanks for sharing sample project.
We have tested the scenario in our environment and were able to notice the API behavior in generated output. We have logged an investigation ticket as PDFNET-45395 in our issue tracking system for your requirements. We will further look into details of the scenario and keep you posted with the status of ticket resolution. Please be patient and spare us little time.
We are sorry for the inconvenience.