Free Support Forum - aspose.com

Form.FillField New Line

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:


Here are a few of the other things I have unsuccessfully attempted:

\n
#$NL

At this point, I've exhausted all resources. Am I going about this incorrectly? Does anyone have any ideas? Any help is greatly appreciated.

Hi,

Sorry for replying you late.

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.

Hi Nayyer,

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".

Hi Tim,

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”)

editor.Single2Multiple(“ActsReq”)

editor.Save()


Dim form As New Form(“output.pdf”, “output1.pdf”)

form.FillField(“ActsReq”, “Line1\r\nLine2”)

form.FlattenAllFields()

form.Save()


We're sorry for the inconvenience.
Regards,
Hi Shahzad,

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:

form.FillField("SomeField", "Line1" + Environment.NewLine + "Line2")

produced:

Line1
Line2

As I mentioned before, this could indicate a compatibility issue with the Aspose.Pdf.Kit assembly (target runtime of 4.0).

Hi Tim,

Our team is looking into this issue and hopefully they’ll be able to figure it out. We’ll inform you with the status accordingly.

We’re sorry for the inconvenience.
Regards,

Has this issued been resolved? I am also in need of new line in my project and this would help out a great deal.

Hi Brandon,

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.

We’re sorry for the inconvenience.
Regards,

Hi Brandon,

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.

We’re sorry for the inconvenience.
Regards,

The issues you have found earlier (filed as 21098) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.