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

Free Support Forum - aspose.com

Arabic language words jumble when converting HTML data(stream) to PDF

I have HTML content converted to stream- with R2L language content- (Arabic language).
When I create an PDF - Arabic language words jumble. I used google translator
So suppose if I write “هذا هو السطر الأول” - in PDF it is like “ذه وه رطسلا لوأل”—
We are using 17.8.0
But problem is not in 19.5.0
Is it existing bug?

          private static Document _document;
	private static bool _disposed;
	private static byte[] _pdfByteArray;
	public  void ConverrtToPDF()
		//read HTMl 
		var htmlString = File.ReadAllText(@"<path>\HTMLToPDF.html");

		if (_pdfByteArray == null)
			using (var ms = new MemoryStream())

				using (var stamp = new PdfFileStamp(_document))
					var pageNumber = Invariant($"Page: # of {_document.Pages.Count}");
					var ft = new FormattedText(
							new FontColor(0, 0, 0),
					stamp.AddPageNumber(ft, 1); //PosBottomRight
																			//stamp.SaveOptions = new PdfSaveOptions();
					_document.Save(ms, SaveFormat.Pdf);
					_pdfByteArray = ms.ToArray();
					//stamp.Close(); causes CA error

		System.IO.File.WriteAllBytes(@"<path>\Test17.8.pdf", _pdfByteArray);

	public static void ConvercentPdfService(string pdfMarkup)
		//we need to make sure that markup has control of page margins
		var options = new HtmlLoadOptions { PageInfo = { Margin = new MarginInfo(25, 25, 25, 25) } };
		using (var stream = new MemoryStream(Encoding.UTF8.GetBytes(pdfMarkup)))
			_document = new Document(stream, options);
			_document.Direction = Direction.R2L;
			_disposed = false;
		_document.DisplayDocTitle = true;
		_document.FitWindow = true;
		_document.CenterWindow = true;
		_document.Info.Title = "Convercent PDF";
		_document.Info.Author = "";
		_document.Info.Subject = "";



Please note that support is provided on the basis of the latest available version of the API which 22.4 at the moment. Can you please try using it and let us know in case issue still persists? Please share the sample HTML file in .zip format for our reference so that we can test the scenario in our environment and address it accordingly.

@asad.ali Asad - it’s not in 22.4 also
this problem is there until 19.4 - and corrected in 19.5
I was trying to find the bug from release 19.5 bug I don’t get it - which bug corresponds to my issue


It is quite hard to determine what change in the API had resolved this issue. Please note that there are a lot of internal API components and they depend upon each other. Any change in one component may effect other ones. It is possible that the issue got fixed due to some other fixes made in 19.5 version related to HTML conversion engine/component.

@asad.ali I totally understand
Would you mind telling me about bug - PDFNET-41523 if possible - In release notes it says Incorrect text position


It was related to the incorrect position of “$” sign while adding through TextFragment.