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

Free Support Forum - aspose.com

Text Wrapping Issues when using "-" (Hyphen) in a long sentence

Hi:


We are having some issues that we believe are coming from the Aspose PDF tool we are using.
Basically we have a textbox multiline where the user enters whatever they want.
If the user enters a message with multiple lines which contains a hyphen “-” + some white spaces when generating the PDF we are experiencing some text wrapping inconsistencies, like the following example:

Text Entered by the user:

Manufactured on a modern- efficient chassis line and a state of the art cab line using robotic processes and with unmatched confort features, we have made every investment to ensure that the Chief delivers on quality, durability and reliability. We are confident of making significant headway in the fast - growing ABC market - with the new Chief," said Robert Gross, TY, Chuck Spencer. Specifically engineered to meet evolving customer expectations in the areas of performance, comfort and realiability, the Chief promises to make our customers more profitable by offering them a tailor-made product solution to meet ther needs and certainly will be a game-changer for them," he said.

But the system will display it in the PDF like this:

Manufactured on a modern- efficient chassis line and a state of the art cab line using robotic processe
s and with unmatched confort features, we have made every investment to ensure that the Boss delivers on quality, durability and reliability. We are confident of making significant headway in the fast - growing ICV market - with the new Boss," said Vinod Dasari, MD, Ashok Leyland. Specificall
y engineered to meet evolving customer expectations in the areas of performance, comfort and realiability, the Boss promises to make our customers more profitable by offering them a tailor-made product solution to meet ther needs and certainly will be a game-changer for them," he said.

You can see how the word “processes” and “Specifically” are cut and the last letter is displayed in a new line below.
Are you aware of this kind of issues and how to troubleshoot them ?
We are using version 2.2 according on our license file, should we need to update the version ? Is this a known issue that was fixed in a newer build ?

Thanks.

Hi Narendra,


Thanks for your inquiry. I am afraid you are using a quite older version. I have tested the scenario with Aspose.Pdf for .NET 8.9.0 and unable to replicate the issue. Please download and try latest version from download area, It will help you to resolve the issue.

Please feel free to contact us for any further assistance.

Best Regards,

Hi Aspose,

I have downloaded the latest version 8.9.1.0
However when I run we are getting following error message, we are having a license( Old one) and we are referring to that file. Can we have some kind of a temp license?

Error Message: The subscription included in this license allows free upgrades until 05 Jun 2013, but this version of the product was released on 14 Feb 2014. Please renew the subscription or use a previous version of the product.

Stack Trace:

[InvalidOperationException: The subscription included in this license allows free upgrades until 05 Jun 2013, but this version of the product was released on 14 Feb 2014. Please renew the subscription or use a previous version of the product.]
   š..˜(Stream ) +1324
   š..˜(String , Assembly ) +315
   Aspose.Pdf.License.SetLicense(String licenseName) +108
   PWC.US.IFS.IPA.Common.PDFPrintModel.SoundingPDF.SoundingPDF.GeneratePDF(Int32[] soundingIDs, String userRole) +837
   PWC.US.IFS.IPA.Common.IPASoundingsCommon.Sounding2PDF(Int32[] SoundingIDs, String userRole) +83
   PWC.US.IFS.IPA.Common.IPASoundingsCommon.SoundingFormToPDF(String[] soundingIDs, String userRole) +639
   PWC.US.IFS.IPA.Soundings.Webparts.UpdateAndCompleteSoundingFormWebPartPkg3.UpdateAndCompleteSoundingFormWebPartPkg3UserControl.PrintPrevButton_Click(Object sender, EventArgs e) +1683
   System.Web.UI.WebControls.Button.OnClick(EventArgs e) +115
   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +140
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +29
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2981

Thanks & Regards,

Narendra B K

Hi Aspose,

We found a workaround for the license file and we worked on the items.

Please have a look at the following test which I gave and that is getting truncated when I use TWO SPACES after "-"

"mohamed - we are lookingoutofor test textwhich can be communica"

PDF Printing is as follows

mohamed - we ar

e lookingoutofor test textwhich can be

communica

Thanks & Regards,

Narendra B K

Hi Narendra,


Thanks for your feedback. I am afraid we are still unable to replicate the issue, please find enclosed output document. We will appreciate if you please share your sample code and input/output documents here to replicate the issue. So we will test it at our end and will provide you more information accordingly.

We are truly sorry for the inconvenience caused.

Best Regards,

Hi Narendra,


Thanks for contacting support.

In order to get a Temporary license, please following the instructions specified over Get a temporary license

Hi Support,

I have attached the sample files and files which we are using to generate the PDF files.

We have different forms and files shared are having all of the forms code with the common code.

We are having issues with "- " and ";" in these cases aspose is unable to indetify a single word and its breakig the word ubruptly

Thanks & Regards,

Narendra B K

Hi Narendra,


Thanks for sharing the resource files.

I have observed that in attached .zip file, there are many code files so in order to test the scenario, I have used the following code lines.

[C#]

// new DOM approach<o:p></o:p>

Aspose.Pdf.Document doc = new Document();

doc.Pages.Add();

doc.Pages[1].Paragraphs.Add(new TextFragment("Manufactured on a modern- efficient chassis line and a state of the art cab line using robotic processes and with unmatched confort features, we have made every investment to ensure that the Chief delivers on quality, durability and reliability. We are confident of making significant headway in the fast - growing ABC market - with the new Chief,\" said Robert Gross, TY, Chuck Spencer. Specifically engineered to meet evolving customer expectations in the areas of performance, comfort and realiability, the Chief promises to make our customers more profitable by offering them a tailor-made product solution to meet ther needs and certainly will be a game-changer for them,\" he said."));

doc.Save("c:/pdftest/TextWrap.pdf");

// Aspose.Pdf.Generator approach

Aspose.Pdf.Generator.Pdf pdf = new Pdf();

pdf.Sections.Add().Paragraphs.Add(new Text("Manufactured on a modern- efficient chassis line and a state of the art cab line using robotic processes and with unmatched confort features, we have made every investment to ensure that the Chief delivers on quality, durability and reliability. We are confident of making significant headway in the fast - growing ABC market - with the new Chief,\" said Robert Gross, TY, Chuck Spencer. Specifically engineered to meet evolving customer expectations in the areas of performance, comfort and realiability, the Chief promises to make our customers more profitable by offering them a tailor-made product solution to meet ther needs and certainly will be a game-changer for them,\" he said."));

pdf.Save(“c:/pdftest/TextWrapGenerator.pdf”);



I have observed that text is incorrectly wrapping when using Aspose.Pdf.Generator approach. However, it does not seem to be occurring when using new Document Object Model of Aspose.Pdf namespace. I would recommend you to please try using the new DOM approach and in case the problem still persists, please share some simple code snippet which can help us in replicating the same problem. We are sorry for your inconvenience.

For your reference, I have also attached the resultant PDF files generated over my end.

Hi Aspose,

Thanks for the quick reply, as you might have noticed in the sample file we are generating the PDF out of a web page. There are lot of tabs and each tab is having multple controls of multiple type. We have used generator so that we can push the html content in to Aspose and generate the PDF. Please notice the following code I will not be able to do something similar in Aspose.Pdf.Document? In that case we can proceed with Aspose.Pdf.Document, we considered that option initially but there were also performance issues with that. Please suggest.

Section 1#

Aspose.Pdf.Generator.Section sec1 = pdf1.Sections.Add();

Aspose.Pdf.License IPALic = new Aspose.Pdf.License();

IPALic.SetLicense("Aspose.Pdf.lic");

IPALic.Embedded = true;

Aspose.Pdf.Generator.MarginInfo marginInfo = new Aspose.Pdf.Generator.MarginInfo();

marginInfo.Top = 5;

marginInfo.Bottom = 10;

marginInfo.Left = 10;

marginInfo.Right = 10;

sec1.PageInfo.Margin = marginInfo;

Aspose.Pdf.Generator.HeaderFooter hf1 = new Aspose.Pdf.Generator.HeaderFooter(sec1);

sec1.OddHeader = hf1;

sec1.EvenHeader = hf1;

Section 2# OR at one more place we have done alignment

Aspose.Pdf.Generator.Table tab1 = new Table();

hf1.Paragraphs.Add(tab1);

tab1.ColumnWidths = "275 275";

Aspose.Pdf.Generator.Row row1 = tab1.Rows.Add();

Aspose.Pdf.Generator.Cell cell1 = row1.Cells.Add();

Aspose.Pdf.Generator.Cell cell2 = row1.Cells.Add();

Aspose.Pdf.Generator.Text txtCandName = new Text("Candidate :" + candidate.CandidateName);

Aspose.Pdf.Generator.Text txtProposalStatus = new Text("Status :" + candidate.ProposalStatus);

cell1.Paragraphs.Add(txtCandName);

cell1.Alignment = AlignmentType.Left;

cell2.Paragraphs.Add(txtProposalStatus);

cell2.Alignment = AlignmentType.Right;

Section 3# Same items are considered for Footer creation

HeaderFooter footer = new HeaderFooter(sec1);

sec1.OddFooter = footer;

sec1.EvenFooter = footer;

Text t1 = new Text(footer, "Page: $p of $P");

Aspose.Pdf.Generator.Table tabFooter = new Table();

footer.Paragraphs.Add(tabFooter);

tabFooter.DefaultColumnWidth = "550";

Aspose.Pdf.Generator.Row footerRow = tabFooter.Rows.Add();

Aspose.Pdf.Generator.Cell footerCell = footerRow.Cells.Add();

footerCell.Alignment = AlignmentType.Center;

footerCell.Paragraphs.Add(t1);

footer.TextInfo.Alignment = AlignmentType.Center;

footer.Paragraphs.Add(t1);

Thanks & Regards,

Narendra B K

Hi Aspose Support,

Looks like we are not considering the ";" for which we have the same wrapping issue.

Issue is same that when I use "; " or "- " the word wrapping is incorrect.

Please check this one too, I have given reply to other item

Thanks & Regards,

Narendra B K

Hi Narendra,


Narendra kallappa:

Hi Aspose,

Thanks for the quick reply, as you might have noticed in the sample file we are generating the PDF out of a web page. There are lot of tabs and each tab is having multple controls of multiple type. We have used generator so that we can push the html content in to Aspose and generate the PDF. Please notice the following code I will not be able to do something similar in Aspose.Pdf.Document? In that case we can proceed with Aspose.Pdf.Document, we considered that option initially but there were also performance issues with that. Please suggest.

Section 1#

Aspose.Pdf.Generator.Section sec1 = pdf1.Sections.Add();

Aspose.Pdf.License IPALic = new Aspose.Pdf.License();

IPALic.SetLicense("Aspose.Pdf.lic");

IPALic.Embedded = true;

Aspose.Pdf.Generator.MarginInfo marginInfo = new Aspose.Pdf.Generator.MarginInfo();

marginInfo.Top = 5;

marginInfo.Bottom = 10;

marginInfo.Left = 10;

marginInfo.Right = 10;

sec1.PageInfo.Margin = marginInfo;

Aspose.Pdf.Generator.HeaderFooter hf1 = new Aspose.Pdf.Generator.HeaderFooter(sec1);

sec1.OddHeader = hf1;

sec1.EvenHeader = hf1;

Section 2# OR at one more place we have done alignment

Aspose.Pdf.Generator.Table tab1 = new Table();

hf1.Paragraphs.Add(tab1);

tab1.ColumnWidths = "275 275";

Aspose.Pdf.Generator.Row row1 = tab1.Rows.Add();

Aspose.Pdf.Generator.Cell cell1 = row1.Cells.Add();

Aspose.Pdf.Generator.Cell cell2 = row1.Cells.Add();

Aspose.Pdf.Generator.Text txtCandName = new Text("Candidate :" + candidate.CandidateName);

Aspose.Pdf.Generator.Text txtProposalStatus = new Text("Status :" + candidate.ProposalStatus);

cell1.Paragraphs.Add(txtCandName);

cell1.Alignment = AlignmentType.Left;

cell2.Paragraphs.Add(txtProposalStatus);

cell2.Alignment = AlignmentType.Right;

Section 3# Same items are considered for Footer creation

HeaderFooter footer = new HeaderFooter(sec1);

sec1.OddFooter = footer;

sec1.EvenFooter = footer;

Text t1 = new Text(footer, "Page: $p of $P");

Aspose.Pdf.Generator.Table tabFooter = new Table();

footer.Paragraphs.Add(tabFooter);

tabFooter.DefaultColumnWidth = "550";

Aspose.Pdf.Generator.Row footerRow = tabFooter.Rows.Add();

Aspose.Pdf.Generator.Cell footerCell = footerRow.Cells.Add();

footerCell.Alignment = AlignmentType.Center;

footerCell.Paragraphs.Add(t1);

footer.TextInfo.Alignment = AlignmentType.Center;

footer.Paragraphs.Add(t1);

Thanks & Regards,

Narendra B K


Thanks for your inquiry. I'm afraid currently Aspose.Pdf.Document(DOM approach) renders HTML document to PDF document, but it doesn't support to include HTML contents in PDF document at the moment, as you are including HTML using Aspose.Pdf.Geneartor namespace. We've already logged this feature request as PDFNEWNET-35804 in our issue tracking system. We will update you via this forum thread as soon as it is resolved.

We are sorry for the inconvenience caused.

Best Regard,

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


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

Hi Narendra,


Thanks for your patience. As stated above PDFNEWNET-35804 is also resolved and now you can add HTML string in new/existing document using new DOM approach. Please check following documentation link for the purpose. It will help you to accomplish your requirements.


Please feel free to contact us for any further assistance.

Best Regards,