We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

FreeTextAnnotation New Line

Hi,

I am creating a free text annotation object and setting its content (string) parameter value. However, the value I have to use has line breaks inside; but whatever I try I cannot make the freetextannotation to display those correctly. I have tried "\r", "\n", "\r\n" and even "
" without any luck. Every time I try, the text is always on single line with those line break characters.

Please advise on how to set multiline text to a freetextannotation object.

Thanks.

Hi,


Thanks for contacting support.

I have tested the scenario using Aspose.Pdf for .NET 7.7.0 where I have tried using following code snippet and as per my observations, the line break is properly appearing in TextAnnotation contents. For your reference, I have also attached the PDF file which is being generated over my end.

[C#]

//open document<o:p></o:p>

Document pdfDocument = new Document("c:/pdftest/Doc1.pdf");

//create annotation

TextAnnotation textAnnotation = new TextAnnotation(pdfDocument.Pages[1], new Aspose.Pdf.Rectangle(200, 400, 400, 600));

textAnnotation.Title = "Sample Annotation Title";

textAnnotation.Subject = "Sample Subject";

textAnnotation.State = AnnotationState.Accepted;

textAnnotation.Contents = "Sample contents for the \n annotation";

textAnnotation.Open = true;

textAnnotation.Icon = TextIcon.Key;

Border border = new Border(textAnnotation);

border.Width = 5;

border.Dash = new Dash(1, 1);

textAnnotation.Border = border;

textAnnotation.Rect = new Aspose.Pdf.Rectangle(200, 400, 400, 600);

//add annotation in the annotations collection of the page

pdfDocument.Pages[1].Annotations.Add(textAnnotation);

////save output file

pdfDocument.Save("c:/pdftest/LineBreak_output.pdf");

Can you please try that with FreeTextAnnotation? I have to use it instead of TextAnnotation as in your sample; due to cosmetic reasons.

Testing your code with FreeTextAnnotation also fails to render multiline texts.

Please advise.

Hi,


I
have again tested the scenario and I am able to reproduce the same problem that Line break is not working when using FreeTextAnnotation object. For the
sake of correction, I have logged it in our issue tracking system as PDFNEWNET-34958. We
will investigate this issue in details and will keep you updated on the status
of a correction.

We apologize for your inconvenience.

Any updates on this?

Hi,

Thanks for your patience.

As we recently have been able to notice the problem reported earlier, so the development team requires sometime to investigate and figure out the actual reasons of this problem. Furthermore please note that the issues reported under Enterprise and Priority Support have high precedence in terms of resolution as compare to the issues reported under normal support model and this issue will be resolved as per its schedule.

As soon as we have made some significant progress in terms of resolution, we would be more than happy to update you with the status of correction. Please be patient and spare us little time. We are sorry for this delay and inconvenience.

Can you please provide information about the status on this issue?

Thanks.

Hi Alp,


Thanks for your inquiry. Your reported issue has been resolved and fix will be included in upcoming Aspose.Pdf for .NET 7.8.0 release, that is due in coming week. However we will notify you via this forum thread as soon as it gets available for download.

Thanks for your patience and cooperation.

Best Regards,

The issues you have found earlier (filed as PDFNEWNET-34958) have been fixed in Aspose.Pdf for .NET 7.8.0update.


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

Thanks for the fix; however it is in a worse state now. When multiple lines exist, the text is totall broken.

Please check the attached screenshots; where I have two annotations containing extactly same characters (capture_env.jpg file shows the correct annotations from the non-pdf format) but one of them has line breaks. The problem in PDF can be seen in second attachment (capture_pdf.jpg) which is taken from adobe reader.

I do not want to rollback to older version due to some other fix (PDFNEWNET-34994) in this dll.

Please advise asap.

Thanks.

Hi Alp,


Sorry for the inconvenience faced. I’m afraid, multiple line text in FreeTextAnnotation is working fine at my side. Could you please share your sample code here? So we will test it at our end and provide you more information accordingly.

Best Regards,

Testing a little bir more; I noticed that the problem shows up when text is multiline and contains international characters.

When text is not multiline, international characters work fine.

When there are no international characters, multiline works fine.

When text is multiline and also international characters exist the result is broken.

Please try this text (without the quotations) for generating the error:

"üçüncü birinci \r ikinci \r üçüncü"

Please advise.

Thanks.

Hi Alep,


Sorry for the inconvenience faced. I've managed to reproduce the multiline international character text issue at my end and logged it as PDFNEWNET-35084 in our bug tracking system for further investigation and resolution. You will be notified via this thread as soon as it is resolved.


Best Regards,

The issues you have found earlier (filed as PDFNEWNET-35084) have been fixed in Aspose.Pdf for .NET 8.0.0.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.