I just tried it with 2.0.2 and it worked... Maybe try to upgrade to that version.
On Thu, Aug 11, 2016 at 5:36 PM, Yoav Tsoref <[email protected]> wrote: > The field is set as multiline. The font is declared in the PDF - > Helvetica. I'm not changing the font programmatically... > > > On 11 Aug 2016, at 17:43, Gilad Denneboom <[email protected]> > wrote: > > > > Is the field set as multiline? Also, what font are you using for the text > > in that field? > > > >> On Thu, Aug 11, 2016 at 3:46 PM, Yoav Tsoref <[email protected]> > wrote: > >> > >> Hi, > >> I placed the PDF template at: > >> https://drive.google.com/file/d/0B__NK1_B6ccjVXgxekNLLUxKMzMyS0c5LTBEO > >> VVVYUJhVk04/view?usp=sharing > >> <https://drive.google.com/file/d/0B__NK1_B6ccjVXgxekNLLUxKMzMyS0c5LTBEO > >> VVVYUJhVk04/view?usp=sharing> > >> (in this shared folder > >> <https://drive.google.com/folderview?id=0B__NK1_ > B6ccjUXRSZVdpSEkyYzg&usp= > >> sharing> > >> ) > >> > >> You are right regarding the \n of course, this is my mistake. But I am > not > >> generating the \n character in the String, it is generated correctly > ("\n") > >> because it is generated from the keyboard (from the user input). > >> I tried with \n and \r. "\r" throws an exception that the > ('controlLF') is > >> missing. > >> > >> Thanks, > >> Yoav > >> > >> On Thu, Aug 11, 2016 at 4:34 PM, Gilad Denneboom < > >> [email protected]> > >> wrote: > >> > >>> The new-line character is "\n", not "/n"... And maybe it will work with > >>> "\r", instead. > >>> > >>> On Thu, Aug 11, 2016 at 3:14 PM, Maruan Sahyoun < > [email protected]> > >>> wrote: > >>> > >>>> Hi, > >>>> > >>>>> Am 11.08.2016 um 14:56 schrieb Yoav Tsoref <[email protected]>: > >>>>> > >>>>> Hi, > >>>>> > >>>>> I am using PDFBox version 2.0.1 to dynamically update the fields of > >> an > >>>>> existing PDF document. When I'm trying to fill one of the fields > >> with a > >>>>> String that contains New Line character the following exception is > >>>> thrown: > >>>>> > >>>>> java.lang.IllegalArgumentException: U+000D ('controlCR') is not > >>>> available > >>>>> in this font's encoding: StandardEncoding with differences > >>>>> at org.apache.pdfbox.pdmodel.font.PDType1Font.encode( > >>>> PDType1Font.java:345) > >>>>> at org.apache.pdfbox.pdmodel.font.PDFont.encode(PDFont.java:286) > >>>>> at org.apache.pdfbox.pdmodel.font.PDFont.getStringWidth( > >>> PDFont.java:315) > >>>>> at > >>>>> org.apache.pdfbox.pdmodel.interactive.form.PlainText$ > >>>> Paragraph.getLines(PlainText.java:169) > >>>>> at > >>>>> org.apache.pdfbox.pdmodel.interactive.form. > >> PlainTextFormatter.format( > >>>> PlainTextFormatter.java:182) > >>>>> at > >>>>> org.apache.pdfbox.pdmodel.interactive.form. > >> AppearanceGeneratorHelper. > >>>> insertGeneratedAppearance(AppearanceGeneratorHelper.java:373) > >>>>> at > >>>>> org.apache.pdfbox.pdmodel.interactive.form. > >> AppearanceGeneratorHelper. > >>>> setAppearanceContent(AppearanceGeneratorHelper.java:237) > >>>>> at > >>>>> org.apache.pdfbox.pdmodel.interactive.form. > >> AppearanceGeneratorHelper. > >>>> setAppearanceValue(AppearanceGeneratorHelper.java:144) > >>>>> at > >>>>> org.apache.pdfbox.pdmodel.interactive.form.PDTextField. > >>>> constructAppearances(PDTextField.java:263) > >>>>> at > >>>>> org.apache.pdfbox.pdmodel.interactive.form. > >>> PDTerminalField.applyChange( > >>>> PDTerminalField.java:225) > >>>>> at > >>>>> org.apache.pdfbox.pdmodel.interactive.form.PDTextField. > >>>> setValue(PDTextField.java:218) > >>>>> at > >>>>> com.myadwise.db.dao.FinancialTransactionMgr.createInvoice( > >>>> FinancialTransactionMgr.java:525) > >>>>> > >>>>> The API call that I'm using to insert the string into the field is: > >>>>> > >>>>> PDDocument pdfDocument = PDDocument.load(<PATH_TO_ > >> TEMPLATE_PDF_FILE); > >>>> //PDF > >>>>> file was created as a template using Adobe DC > >>>>> > >>>>> PDAcroForm acroForm = pdfDocument.getDocumentCatalog(). > >> getAcroForm(); > >>>>> > >>>>> acroForm.getField("invoice.to.address").setValue(billingAddress) > >>>> > >>>> could you upload a sample form to a public location? > >>>> > >>>> BR > >>>> Maruan > >>>> > >>>>> > >>>>> > >>>>> The last line is the one that throws the exception if the > >>> billingAddress > >>>>> String contains a '/n' or a New Line (or Carriage Return) character. > >>>>> I have searched for similar issues but couldn't find many references. > >>>>> > >>>>> Any help would be appreciated! > >>>>> Thanks, > >>>>> Yoav > >>>> > >>>> > >>>> --------------------------------------------------------------------- > >>>> To unsubscribe, e-mail: [email protected] > >>>> For additional commands, e-mail: [email protected] > >> > >> > >> > >> -- > >> > >> <http://intango.com/> > >> > >> > >> *Yoav Tsoref**R&D Projects Manager* > >> T: +972.3.533.0760 | M: +972.54.227.7208 > >> E: [email protected] | Skype: yoav.ts > >> www.intango.com > >> <https://www.facebook.com/Intango-855010531283314> > >> <https://www.linkedin.com/company/intango> > >> <https://twitter.com/IntangoMedia> > >> <https://plus.google.com/u/0/114134833470766396949/about> > >> >

