-
Notifications
You must be signed in to change notification settings - Fork 280
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Right to Left does not work properly on multicell, Works correctly on Text #291
Comments
I would like you to explain more for people who have zero knowledge of Arabic language, where the points are wrong and where the points are correct. |
https://github.com/oneplus1000/gopdf/tree/issue_291 I've tried modifying the function MultiCellWithOption. To be able to add new lines RTL style. pdf.Br(20.0)
pdf.Text("example 1 with 2 with 3 with 4 and 5 and 6 and 7")
pdf.Br(20.0)
pdf.Text(reverseString(goarabic.ToGlyph("مثال 1 مع 2 مع 3 مع 4 و5 و6 و7")))
pdf.Br(20.0)
rect := &gopdf.Rect{W: 100, H: 100}
pdf.MultiCell(rect, "example 1 with 2 with 3 with 4 and 5 and 6 and 7")
pdf.Br(20.0)
pdf.MultiCellWithOption(rect, reverseString(goarabic.ToGlyph("مثال 1 مع 2 مع 3 مع 4 و5 و6 و7")), gopdf.CellOption{
Align: gopdf.Right,
RtlLineBrk: true, // <-- Make a new line RTL style.
})
pdf.WritePdf("test.pdf") I would like you to help me. Check if I did it right or wrong. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
i want to print arabic text in a multicell, i was able to get the rtl with goarabic glyph function which work correctly on pdf.Text but does not work on pdf.Multicell
`
package main
import (
"log"
)
func main() {
pdf := gopdf.GoPdf{}
pdf.Start(gopdf.Config{ PageSize: gopdf.Rect{W: 595.28, H: 841.89}}) //595.28, 841.89 = A4
pdf.AddPage()
err := pdf.AddTTFFont("HDZB_5", "./DejaVuSansCondensed.ttf")
if err != nil {
log.Print(err.Error())
return
}
err = pdf.SetFont("HDZB_5", "", 14)
if err != nil {
log.Print(err.Error())
return
}
pdf.Cell(nil, "هذا يوم جيد لبدء شيء جديد وإظهار ذلك للجميع")
pdf.Br(20.0)
pdf.Text(reverseString(goarabic.ToGlyph("احمد")))
pdf.Br(20.0)
pdf.Text(reverseString(goarabic.ToGlyph("الايام السبعة")))
rect := &gopdf.Rect{W: 100, H: 100}
pdf.Br(20.0)
pdf.MultiCell(rect,reverseString(goarabic.ToGlyph("هذا يوم جيد لبدء شيء جديد وإظهار ذلك للجميع")))
pdf.Br(20.0)
pdf.Text(reverseString(goarabic.ToGlyph("هذا يوم جيد لبدء شيء جديد وإظهار ذلك للجميع")))
pdf.WritePdf("test1.pdf")
}
func reverseString(s string) string {
runes := []rune(s)
for i, j := 0, len(runes)-1; i < j; i, j = i+1, j-1 {
runes[i], runes[j] = runes[j], runes[i]
}
return string(runes)
}
`
The text was updated successfully, but these errors were encountered: