Changes from v4.1 to v6.9

Hi,


We’ve used Aspose.PDF for a long time and love it. We want to also use Aspose.Words. But we first need to get our existing code working with the latest version of Aspose.PDF.

We have some fairly complex PDF generation. So it’s difficult to determine exactly where it goes wrong.

But we get different results using v6.9 than we do with v4.1

For example, a table Cell containing just the word “Qty” works fine on v4.1, but on v6.9 it wraps on to two lines.

The size of the cell is identical.

I’ve looked in to TextInfo() and see that on the latest version the default for .charspace and .wordspace seems to be 0.001 instead of 0.0. I’ve explicitly set these to 0 but still get the same issues using the newer DLL. I see there’s also a new property called StrokeWidth.

Are you able to give me any pointers to determine what other defaults may have changed to cause this problem?

I’d love to be able to give you a few lines of code to clearly illustrate the difference between the two versions, but am struggling to do so due to the complexity of our code.

I’ve managed to isolate the cause and have a complete block of code to illustrate it.


Run the following code with v4.1.2 of Aspose.PDF DLL and it works fine. The text is on one line.
Run it again with v6.9 and it wraps on to two lines. It seems the issue is with the DefaultCellPadding. It’s set to 4. On both versions of the DLL it says “the unit is point”, so it should be treated the same, but it isn’t.

Any advice (that doesn’t require us to manually change all of the hundreds of padding values in our code)?

// prepare our document , section and table
Pdf pdf1 = new Pdf();
Section sec1 = pdf1.Sections.Add();
Aspose.Pdf.Table invTable = new Aspose.Pdf.Table();

//set up a TextInfo class for use on our cell
TextInfo ti = new TextInfo();
ti.FontName = “Arial”;
ti.FontSize = 10;
ti.IsTrueTypeFontBold = true;
//prepeare a border to illustrate edges of cell
BorderInfo brdr = new BorderInfo((int)BorderSide.All, 0.5F, new Color("#000000"));
invTable.DefaultCellBorder = brdr;

// set the default padding for the table
invTable.DefaultCellPadding.Left = 4;
invTable.DefaultCellPadding.Right = 4;
invTable.DefaultCellBorder = brdr;

//add a row
Row headerRow = invTable.Rows.Add();
//add a cell
headerRow.Cells.Add(“Qty”, ti);
//set the column width
invTable.ColumnWidths = “24.66”;

//add the table to the section
sec1.Paragraphs.Add(invTable);

//show response (pdf file output) to user on the web page
HttpResponse response = Response;
response.Expires = 0;
response.Buffer = true;
response.ClearContent();
response.AddHeader(“content-disposition”, “inline; filename=” + “output.pdf”);
response.ContentType = “application/pdf”;
response.BinaryWrite(pdf1.GetBuffer());
response.End();

Even without the cellpadding there is an issue.


Comment out these two lines:

invTable.DefaultCellPadding.Left = 4;
invTable.DefaultCellPadding.Right = 4;

Change
invTable.ColumnWidths = “24.66”;
to
invTable.ColumnWidths = "16.16";

With the older version of the DLL it's fine. With the new version the text wraps.

Hi Duane,

Thanks for using our products and sharing the sample source code with us.

I tested the scenario with your provided source code in first post using Aspose.Pdf for .NET v7.0 and unable to notice any issue in the resultant document. The resultant document is attached for your reference. However, after changing the code as you mentioned in your last post. I am able to find the text wrap issue. For rectification, you can add a line of code as mentioned below:

Change
headerRow.Cells.Add("Qty", ti);<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

to
headerRow.Cells.Add("Qty", ti);

headerRow.Cells[0].IsWordWrapped = false;

Kindly use the latest version of Aspose.Pdf for .NET v7.0 and check if it works fine for you. Please feel free to contact support in case you need any further assistance.

Thanks & Regards,

When I run it with v7 I DO get the wrapping issue. How can we be getting different results with same code and same version of DLL?

Settings isWordWrapped = false does the trick. But it's not practical to go adding this to all of the cells. Especially as some we do want wrapped.

I tried adding .isWordWrapped= false to the table itself, then setting it to true on the cells that are OK to wrap. But it didn't have the desired effect. Those set to True still didn't wrap.

Hi Duane,

Thanks for your feedback.

I tested the scenario and able to notice the same problem. For rectification, I logged this problem with ID: PDFNEWNET-33807 in our Issue Tracking System. We will further look into the details of this issue and will keep you updated via this forum thread on the status of correction.

We apologize for your inconvenience.

Thanks & Regards,

Thanks. Are you able to give me any indication of when/if there might be some progress with it?


Is it likely to be weeks/months/years?

Hi Duane,

Thanks for your inquiry, as we just have able to discover PDFNEWNET-33807, so we require some time to investigate this issue in detail. However, as soon as we have made some significant progress towards the resolution of this problem, we would be more than happy to update you with the status of correction. Please be patient and spare us little time.

We are really sorry for this inconvenience.

Thanks & Regards,

Hi Duane,


Thanks for your patience.

I am pleased to share that the issue reported earlier has been resolved. We are about to release the new version of Aspose.Pdf for .NET 7.8.0 which will include the resolution of issue reported earlier. Furthermore, I would recommend you to please try using the following code snippet to fulfill your requirement.

[C#]

Document doc = new
Document();<o:p></o:p>

Page page = doc.Pages.Add();

Aspose.Pdf.Table invTable = new Aspose.Pdf.Table();

//set up a TextInfo class for use on our cell

TextState ts = new TextState();

ts.Font = FontRepository.FindFont("Arial");

ts.FontSize = 10;

//prepeare a border to illustrate edges of cell

Aspose.Pdf.BorderInfo brdr = new Aspose.Pdf.BorderInfo(Aspose.Pdf.BorderSide.All, 0.5F, System.Drawing.Color.Black);

invTable.DefaultCellBorder = brdr;

// set the default padding for the table

invTable.DefaultCellPadding = new Aspose.Pdf.MarginInfo();

invTable.DefaultCellPadding.Left = 4;

invTable.DefaultCellPadding.Right = 4;

invTable.DefaultCellBorder = brdr;

//invTable.IsWordWrapped = false;

//add a row

Aspose.Pdf.Row headerRow = invTable.Rows.Add();

//add a cell

headerRow.Cells.Add("Qty is there", ts);

headerRow.Cells[0].IsWordWrapped = true;

//set the column width

invTable.ColumnWidths = "24.66";

//add the table to the section

page.Paragraphs.Add(invTable);

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

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


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