Free Support Forum - aspose.com

Right-to-left STILL not supported?

I am getting desperate at this point (please see thread http://www.aspose.com/community/forums/3/118844/arabic-text-direction-reversed-when-converted-to-pdf-urgent-please/showthread.aspx). Please see the attached Word document and the resulting PDF file when exported. I don’t think a single line of this document was converted correctly. The layout in the Word document is almost as simple as you could possibly get. I’ll be honest I am becoming so frustrated with this company because I have been promised fixes for this time and time again for nearly a year now. Please be straight with me–will you ever truly support Right-to-Left?? If you don’t plan on it, then you should not tell customers that you do. I convinced my firm and client to purchase thousands of dollars in licenses for a product that quite simply doesn’t work as promised.

OK, that rant aside, please review the attached documents and explain to me why not only the alignments are reversed (regardless of the table/cell/paragraph direction) but also why the Arabic characters themselves are reversed–the language for the runs are Arabic (Saudi Arabia) but still the runs have their directions set to LTR once converted to PDF.

Please, either tell me this is impossible and your product will NOT support RTL in basically any way, shape, or form, or provide me with a workaround. I CANNOT keep going through this with you guys!!!

Thanks,
Larkin

Hi<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your request. I suppose you are trying to use new SaveToPdf method to convert your document to PDF. Right? Unfortunately, currently our rendering engine does not fully support RTL. This is a known issue #7065 in our defect database. Of course we plan to support RTL.

Note it is only 1.1 version of our rendering engine and not all features are supported yet.

I also tried to convert your document to PDF using “old” method – using Aspose.Words and Aspose.Pdf and this conversion gives me better result. Letters order and alignment is correct.

Best regards.

Thanks I will try it with the latest version of Aspose.PDF and see what happens. I am sorry for my heated comments but I was promised a fix for these problems nearly a year ago. Believe me I understand the complexity involved in implementing correct RTL rendering, but your support staff should be careful to promise fixes because I put my reputation on the line when I recommended Aspose (based on the understanding that the problems I found would be resolved) and I have ended up suffering for it.

Are there any recommendations on how to best format paragraphs and tables in the Word document template so that they are rendered correctly to PDF? Keep in mind that there will be a mix of LTR and RTL characters (i.e. an Arabic word with a colon after it, or digits within a run of Arabic text).

Thanks in advance for your help,
Larkin Young
Associate
Booz | Allen | Hamilton
young_larkin@bah.com

This question may or may not be better directed at the Aspose.PDF team, but can you please take a look at the attached set of documents and figure out why the first row in the second table disappears when converting to PDF, and also why the values in the second row of the same table have disappeared?

This is the code that processes the generated document prior to export:

NodeCollection runs = document.GetChildNodes(NodeType.Run, true);
Regex arabicMatchExpr = new Regex(@"\p{IsArabic}+");
foreach (Run run in runs)
{
Match arabicMatch = arabicMatchExpr.Match(run.Text);
if (arabicMatch.Success)
{
run.Font.Bidi = true;
}
else
{
Match dateMatch = dateExpr.Match(run.Text);
if (dateMatch.Success)
{
run.Font.Bidi = true;
run.Text = DateTime.Parse(run.Text).ToString(“dd/MM/yyyy”);
}
}
}
MemoryStream tempStream = new MemoryStream();
document.Save(tempStream, SaveFormat.AsposePdf);
Pdf pdfDoc = new Pdf();
pdfDoc.BindXML(tempStream, null);
pdfDoc.IsRightToLeft = true;
pdfDoc.Save(String.Format("{0}_{1:yyyyMMddHHmmss}.pdf", docType, DateTime.Now), Aspose.Pdf.SaveType.OpenInAcrobat, httpResponse);
httpResponse.End();

Thanks,
Larkin

Hi<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your request. Yes, it seems you should ask this question to Aspose.Pdf team. Intermediate XML contains all rows of your table.

There is no special requirement to formatting of RTL documents. Just use Bidi property where it is needed.

Best regards.

Good news–thanks for letting me know.

Also, can you please look into an issue with text runs with mixed LTR/RTL characters. For example, look at the test documents I provided in the previous post and look for the last line in the document–it is the page number (i.e. Page 1 of 1) label and the words “Page” and “of” are in Arabic, and regular numerals in between. The direction of this text run is switched (in the PDF it basically displays as “1 of 1 Page”)–how can I force text segments such as this one to be overall RTL? obviously the numbers should be LTR, but the overall direction of the segment as a whole should be RTL. Is there another bug here, or is there some special formatting of the Word template that I can do to achieve this?

Thanks,
Larkin

Hi<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your request. I tried to convert your document to PDF and it seems footer is converted correctly; order of words is not changed. I attached results of conversion (I removed all content from the document except footer)

Best regards.

It’s not exactly a reproduction when you change the input. Please leave the word document with no changes and do the conversion–the order of words is reversed.

Hi<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for additional information. Now I can reproduce the problem. I will consult with our developers and provide you more information. Maybe the problem should be fixed on Apsose.Pdf side.

Best regards.

Hello Larkin!<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

We are sorry for inconvenience. RTL support in PDF export is incomplete. The problem is in dependency on Aspose.Pdf component and incompleteness on their side. I asked Aspose.Pdf developers again about the plans on fully implementing this feature. Earlier I made a proposal on how we’d like RTL to be implemented in Aspose.Pdf. Last time they wrote about September 2008. So I won’t promise anything.

Currently we output IsRightToLeft attribute on Segment nodes. On Text it is also allowed but ignored by Aspose.Pdf. By design, it should force the paragraph to be laid out right-to-left. It is also planned to expose this attribute on Section and Table to control order of their columns. I’ll convince Aspose.Pdf Team to raise the priority of RTL support.

I have linked this thread to the corresponding issue on Aspose.Words side:

#344: Right to left is not exported to PDF well

Best regards,

Thanks for the email, Viktor. Perhaps that is why Aspose.Words team put the Save as PDF feature into their component? :wink:

Of course, that functionality is quite new and definitely needs a lot of work. Even the Aspose.PDF component is very close, but there are too many small problems that prevent me from being able to use it. I can’t even get their team to provide me with some workarounds–i.e. how I can tweak the generated Word document and/or the intermediary PDF-XML to get the correct behavior. Sadly, I am forced to go with the far less ideal MS Word automation and use their Save As PDF add-in to convert to PDF for now…this is a server-side ASP.NET solution so of course this has huge risks…but I have no other options as I must provide secured PDF documents as an output.

I hope either Aspose.PDF or Aspose.Words gets the PDF conversion corrected soon!

Thanks,
Larkin

Hi Larkin!<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Aspose.Words component has introduced the new layouting/rendering engine starting from version 6.0.0. It’s more than just export to PDF. Now we can potentially export to any paginated format, visualize or print documents, extract particular pages etc. You can read about it on our site and probably migrate in the future. We continue improving this subsystem as not all features are ready yet. Unfortunately RTL will come out later, maybe in 2010. That’s why I didn’t mention direct export to PDF in my previous post.

Aspose.Pdf team leader has replied to me. They promise to inspect your case and raise the priority of issue PDFNET-4861 (the RTL issue on their side). Hopefully they will implement it fully in two months. Shall we believe? Sorry, I won’t comment it. All technical information is given. I remember I explained in the forum how RTL should work and should be exposed via API:

http://www.aspose.com/community/forums/permalink/118844/139617/showthread.aspx#139617

All they need is changing the criteria of what particular section, table, paragraph or segment is RTL. Layouting part is already implemented. Now Aspose.Pdf tries to guess what contents should be RTL searching for characters of RTL languages and using some other magic. New criteria are much easier: just look on attributes I output in the XML. Nothing will be inherited and nothing calculated.

Within the last 1.5 years we’ve done much effort improving PDF export via Aspose.Pdf XML in the both components. But there are still some communication difficulties: we cannot promise anything on behalf of Aspose.Pdf Team and cannot guarantee they will address any particular problem, give a workaround etc. All I can do is reminding of some important issues and features.

Regards,

The issues you have found earlier (filed as WORDSNET-1980) have been fixed in this .NET update and this Java update.


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

The issues you have found earlier (filed as WORDSNET-170) have been fixed in this .NET update and this Java update.


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