I have a PDF with a multi-line text field, lets say it's named "Address". Form.FillField("Address", "1600 Amphitheatre Parkway\r\nMountain View, CA 94043") will produce the following in the text-field:
1600 Amphitheatre Parkway\r\nMountain View, CA 94043
Instead of (the desired):
1600 Amphitheatre Parkway
Mountain View, CA 94043
Here is the exact syntax I am using:
Dim outputStream As New System.IO.MemoryStream
Dim form As New Form("PDFPath.pdf", outputStream)
...
form.FillField("SomeField", "Line1\r\nLine2")
...
form.FlattenAllFields()
form.Save()
Also, I have noticed that if I try to use Environment.NewLine in lieu of "\r\n", I get the following exception:
Assembly 'Aspose.Pdf.Kit, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ae9e610db67fc2c1' is marked with the AllowPartiallyTrustedCallersAttribute, and uses the level 2 security transparency model. Level 2 transparency causes all methods in AllowPartiallyTrustedCallers assemblies to become security transparent by default, which may be the cause of this exception.
According to some of the lite research that I have done, this could indicate a compatibility issue with the Aspose.Pdf.Kit assembly:
Please first call Single2Multiple method of FormEditor class with "SomeField" as argument and then use FillField(...) method of Form class to accomplish your requirement. In case it does not resolve your problem or you have any further query, please feel free to contact. We apologize for your inconvenience.
Please take a look over the attached sample PDF document that I have generated after calling this method.
I tried your suggestion, along with "\r\n", but the output still appeared as:
1600 Amphitheatre Parkway\r\nMountain View, CA 94043
Is there any chance that you can post a snippet of the code or pseudocode you used to generate the PDF you have provided?
Also, I have provided two PDFs: SF52.pdf and SF52_10.25.2010.pdf. The former is the template PDF I am populating with the Aspose PDF.Kit library. The latter is an example of the output I am experiencing - see page 2, "PART F - Remarks for SF 50".
I have tried to test your requirement with your sample PDF file, but it didn’t work at my end. I have logged this issue as PDFKITNET-21098 in our issue tracking system for further investigation. Our team will investigate this issue in detail and you’ll be updated with the results accordingly.
The code snippet I used is simple:
Dim editor As New FormEditor(“SF52.pdf”, “output.pdf”)
For testing purposes, I swapped out the Aspose.Pdf.Kit assembly with another third-party PDF assembly. The other third-party assembly was also not able to correctly convert "\r\n" to the desired line break. However, the other third-party assembly (with a target runtime of 1.1) was able to successfully convert Environment.NewLine to a line break on the outputted PDF. Thus, the line:
I’m sorry to inform you that this issue is not yet resolved. However, I have asked our development team to share the ETA of this issue. Please spare us some time and you’ll be updated with the status as soon as it is available.
Our team has looked into this issue in detail and I would like to inform you that we’ll be able to provide this new feature after Q2’2011; I’m afraid, we’ll not be able to provide the resolution earlier.