PDF Generating Tool Support Forum

HOME   Login   Register    Search




  Subject: Arabic text in header template not rendered as expected.
   PostPosted: 25 Jul 2019, 07:33 
Attachment:
ABCD (4).pdf [23.51 KiB]
Downloaded 427 times
I have same Arabic text in htmlmarkup (body) and header using below APIs
Setting header like this
pd4ml.setPageHeader( header );
and then render API like this
java.io.StringReader htmlStringReader = new java.io.StringReader(htmlMarkup1);
java.io.ByteArrayOutputStream pdfBOSStream = new
java.io.ByteArrayOutputStream();
pd4ml.render(htmlStringReader, pdfBOSStream);

Same Arabic text is render differently at header and body of PDF.
Text used in header and body is - محضر ضبط افراد
But see attached pdf


  Subject: Re: Arabic text in header template not rendered as expected.
   PostPosted: 30 Jul 2019, 10:33 
Hi Sandeepnu! From your PDF sample is not quite clear which PD4ML version you use. It is marked non-standard way as 3100.PRPC.1 Is it a custom build, derived from v3.10.0?

It is a good idea to give a try to the most recent v3.11.0

Another point, how do you specify the header instance? There are methods to define text-only header/footer content, and there is a way to define header/footer body in HTML. I would recommend to use the HTML approach as it applies bidi ligaturizing and the text only headers only support English language.


  Subject: Re: Arabic text in header template not rendered as expected.
   PostPosted: 30 Jul 2019, 11:20 
t is marked non-standard way as 3100.PRPC.1 Is it a custom build, derived from v3.10.0?- Yes

I would recommend to use the HTML approach as it applies bidi ligaturizing and the text only headers only support English language. - can you please provide some example of both ways or redirect me to example url.
Thanks in advance.


  Subject: Re: Arabic text in header template not rendered as expected.
   PostPosted: 30 Jul 2019, 12:21 
I have just confirmed by looking at the code that we are setting header using html.
Also found the url which talks about all approaches - https://pd4ml.com/cookbook/pdf_header_f ... ration.htm


Even after that Arabic text is reversed.
Content - "<!DOCTYPE html> <html> <body> محضر ضبط افراد <BR /> This is english text </body> </html>"

Above content is given for body as well as header html
We have code something like this

PD4PageMark header = new PD4PageMark();
header.setHtmlTemplate(headerHTMLTemplate);
header.setAreaHeight(-1);
pd4ml.setPageHeader(header);


  Subject: Re: Arabic text in header template not rendered as expected.
   PostPosted: 30 Jul 2019, 13:15 
Does it change anything if you add dir attribute?

...<body dir="rtl">...


  Subject: Re: Arabic text in header template not rendered as expected.
   PostPosted: 30 Jul 2019, 14:35 
Adding dir="rtl" is pushing the content to right align .. nothing else is happening.
See attached PDF.

Header template - "<!DOCTYPE html><html><body dir='rtl'> محضر ضبط افراد <BR /> This is english text </body></html>"

body markup - "<!DOCTYPE html><html><body> محضر ضبط افراد <BR /> This is english text </body></html>"

Footer template - "<!DOCTYPE html><html><body> محضر ضبط افراد <BR /> This is english text </body></html>"


Attachments:
ABCD (1).pdf [23.69 KiB]
Downloaded 950 times
  Subject: Re: Arabic text in header template not rendered as expected.
   PostPosted: 31 Jul 2019, 14:37 
Any suggestion ? Please help.


  Subject: Re: Arabic text in header template not rendered as expected.
   PostPosted: 01 Aug 2019, 09:37 
It seems PD4ML v3 has issues with rendering of Arabic in header/footer. Please try PD4ML v4.0.4 or v4.0.5 snapshot

https://github.com/zxfr/pd4ml-examples

In the example the header/footer defined inline. However it is also possible to specify them via API.

<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>	
</head>
<body dir=rtl>
<pd4ml:page.header><div dir=rtl> محضر ضبط افراد <BR /> This is english text </div></pd4ml:page.header>
<pd4ml:page.footer><div dir=rtl> محضر ضبط افراد <BR /> This is english text </div></pd4ml:page.footer>

 محضر ضبط افراد <BR /> This is english text


Attachments:
pd4ml6569437319563931860.pdf [41.95 KiB]
Downloaded 975 times
  Subject: Re: Arabic text in header template not rendered as expected.
   PostPosted: 02 Aug 2019, 10:32 
Thank for reply, I will check with latest version as you suggested.
One observation - Why the size of PDF is more which you generated with latest jar ?
If you see my Jar has only 23kb but yours is 41kb .. Is it expected that latest jar will create pdf bigger in size ?


  Subject: Re: Arabic text in header template not rendered as expected.
   PostPosted: 02 Aug 2019, 12:39 
In my test environment it was preconfigured to output tagged PDF/UA, which adds some kilobytes of metadata. Also as I see it embeds the minimal set of glyphs of the default Arial font in addition to Times New Roman - I guess it depends on config, but I need to check.



[Reply]     [ 11 posts ]  Go to page 1, 2  Next

cron
Copyright ©2004-10 zefer|org. All rights reserved. Bookmark and Share