Hi,
Is there support for right to left language?
I was able to change the font but the letter are written in the wrong order (LTR).
+1
Requires implementation in the library pdfkit, issue: https://github.com/devongovett/pdfkit/issues/219.
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
Hi,
any update on this ?
Guys we are shifting to latex for Persian
https://www.latex-project.org/
Good Luck
Hi,
For RTL support you can try to use this code:
var inputString = 'ืฉืืื ืขืืื'; //Hello World
inputString = inputString.split(" ").reverse().join(" "); //Str to Arr->Reverse array->toString
var data = {
content: [
{text: inputString, alignment: 'right'}
]
};
pdfMake.createPdf(data).open();
Please note: inside join( ) you should have 2 spaces " "
Tested for hebrew, I assume it should work for other RTL languages.
P.S don't forget to include fonts for your language https://github.com/bpampuch/pdfmake/wiki/Custom-Fonts---client-side
@kedrovski For Farsi is not working because between some world have space
Could we use some thing like :
defaultStyle: {
alignment: 'right',
direction: 'rtl',
}
? ๐ฏ
@liborm85 I find a way to display correct our string in RTL format.
I use this :
var inputString = 'ุณูุงู
ุฏูุณุชุงู';
inputString = inputString.replace(" " , "ย "); //replace space with nbspace char
var data = { content: [ {text: inputString, alignment: 'right'} ] };
pdfMake.createPdf(data).open();
but it has bug with wraping , in tables if I use this function with a large text the table width will be in one big row .
Can we supply nbspace(alt255) char instead of space to wrap text ? (I mean edit this source https://github.com/bpampuch/pdfmake/blob/master/src/textTools.js)
Does it supports "RTL" now?
Any updates on this issue?
When I can get the good news from this feature?
+1
Is there any updates ?
There is no Update On This Issue????
I was able to manually handle Hebrew with code like:
npm install twitter_cldr
import * as TwitterCldrLoader from "twitter_cldr";
const TwitterCldr = TwitterCldrLoader.load("en");
class ... {
private isHebrew(text: string) {
var position = text.search(/[\u0590-\u05FF]/);
return position >= 0;
}
private maybeRtlize(text: string) {
if (this.isHebrew(text)) {
var bidiText = TwitterCldr.Bidi.from_string(text, { direction: "RTL" });
bidiText.reorder_visually();
return bidiText.toString();
} else {
return text;
}
}
}
Just pass all text that may be in Hebrew through the maybeRtlize function.
It's not perfect and I only tested it for Hebrew, but it seems to work pretty good. If you also need right alignment, use something like isHebrew(myText) ? { align: "right" } : null for alignment.
Is there any way to pass array of words and tell write from right point or from left point?
It is possible to use 3rd party libraries and custom solutions to get array of characters, words etc but I can't find a way to pass this data properly to the library.
Small update:
if you need a fast solution _right now_ my suggestion is to use this php library https://tcpdf.org/ and create a small micro service for this. Currently I wasn't able to find _any_ js based pdf library that can properly handle rtl languages.
+1 Please :)
+1 2020 !!
+1! It's really critical. Pleeeeeeaaase :)
+1 2020 Please
+1 2020,
It's been 5 years since the first request. Please take care
@jthoenes @andreialecu @soroushm @liborm85 @jihadrhamza did any of you guys find a solution to this, please?
Hi,
For RTL support you can try to use this code:
var inputString = 'ืฉืืื ืขืืื'; //Hello World
inputString = inputString.split(" ").reverse().join(" "); //Str to Arr->Reverse array->toString
var data = { content: [ {text: inputString, alignment: 'right'} ] };
pdfMake.createPdf(data).open();Please note: inside join( ) you should have 2 spaces " "
Tested for hebrew, I assume it should work for other RTL languages.P.S don't forget to include fonts for your language https://github.com/bpampuch/pdfmake/wiki/Custom-Fonts---client-side
work for me ๐
thanks
work for me ๐
thanks
Just to note, if your text contains: punctuation, english words, have paragraphs etc this method won't work properly
Any updates of any sort, yet. If so please add it in the documentation. Thanks.
+1 almost end of 2020
After almost 6 years, nothing has happened yet? Why?
@mortezakarimi64 @afsheen1 so put your amazing effort here!
@liborm85 @bpampuch
These links might help
https://engineering.atspotify.com/2019/04/15/right-to-left-the-mirror-world/
https://www.w3.org/International/articles/inline-bidi-markup/uba-basics
<bdi> tag example:
https://www.w3.org/International/articles/inline-bidi-markup/uba-basics-data/list_isolation
meterial.io explanation:
https://material.io/design/usability/bidirectionality.html#mirroring-layout
bbc opensource
https://github.com/bbc/unicode-bidirectional
Most helpful comment
When I can get the good news from this feature?