PDFsharp & MigraDoc Foundation https://forum.pdfsharp.net/ |
|
PdfAcroForm and multiline problem https://forum.pdfsharp.net/viewtopic.php?f=2&t=3724 |
Page 1 of 1 |
Author: | looc [ Wed Jan 31, 2018 3:27 pm ] |
Post subject: | PdfAcroForm and multiline problem |
Hi Im trying to fill a acrobat document form field with a multiline text and hav no success. Im using: Code: PdfTextField _f = (PdfTextField)(form.Fields[name]); _f.MultiLine = true; _f.Text = value; And Code: PdfSharp.Pdf.AcroForms.PdfAcroField fieldLocation = form.Fields["address"]; PdfSharp.Pdf.AcroForms.PdfTextField txtFieldLocation; if ((txtFieldLocation = fieldLocation as PdfSharp.Pdf.AcroForms.PdfTextField) != null) { txtFieldLocation.MultiLine = true; var sb = new System.Text.StringBuilder(); sb.AppendLine("John Doe123"); sb.AppendLine("Text from new line1"); sb.AppendLine("Text from new line2"); sb.AppendLine("Text from new line3"); txtFieldLocation.Text = sb.ToString(); } And have tried all kind of linebreaks, stringbuilder with AddLine, html br \r \n \r\n The source document has the field marked as multiline but i can only get the text on one line. Any ideas? |
Author: | looc [ Thu Feb 01, 2018 8:13 am ] |
Post subject: | Multiline in forms is not working |
Hi I have now tried alla i can think of so this must be a bug. I hav e a document with multiple form-fields. One is a multiline box that i want to fill. Sending in a text with newline is not shown as seperate lines in box, just one long line. I have tired alla kind of newline i can think of , stringbuilder addline, enviroment.newline, \r \n \r\n \n\r ,vbcrlf Im using 1.50.4740-beta5 And code: Code: PdfTextField _f = (PdfTextField)(form.Fields["olle"]); _f.MultiLine = true; _f.Value = new PdfString("firstline\nnextline"); and Code: PdfSharp.Pdf.AcroForms.PdfAcroField fieldLocation = form.Fields["olle"];
PdfSharp.Pdf.AcroForms.PdfTextField txtFieldLocation; if ((txtFieldLocation = fieldLocation as PdfSharp.Pdf.AcroForms.PdfTextField) != null) { var sb = new System.Text.StringBuilder(); sb.AppendLine("Text from new line1"); sb.AppendLine("Text from new line2"); txtFieldLocation.MultiLine = true; txtFieldLocation.Value = new PdfString(sb.ToString(), PdfStringEncoding.Unicode); } |
Author: | Thomas Hoevel [ Thu Feb 01, 2018 10:05 am ] |
Post subject: | Re: Multiline in forms is not working |
Hi! looc wrote: I have a document with multiple form-fields. You have a document, I don't.One is a multiline box that i want to fill. Please use the Issue Submission Template if you think there is a bug. |
Author: | looc [ Thu Feb 01, 2018 5:40 pm ] |
Post subject: | Re: PdfAcroForm and multiline problem |
Ok, sorry about that. I now got it to work, sort of... The problem is firefox, i was testing in firefox built in pdf-reader and it seeams like it cant handle forms in pdf properly. Running in Edge or chrome shows the line breaks. //b. |
Page 1 of 1 | All times are UTC |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |