Giter Site home page Giter Site logo

Comments (3)

oneplus1000 avatar oneplus1000 commented on August 18, 2024

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.

from gopdf.

jayeshkarandemyglamm avatar jayeshkarandemyglamm commented on August 18, 2024

i dont have much knowlege for arabic either but i could see discrepency when the multiline text was showing differently in browser and in the pdf
below is how a browser renders the multiline
Screenshot 2024-04-06 at 10 17 11 AM

and this is how it renders in go pdf
Screenshot 2024-04-06 at 10 16 29 AM

code snippet
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.MultiCell(rect,reverseString(goarabic.ToGlyph("مثال 1 مع 2 مع 3 مع 4 و5 و6 و7")))

from gopdf.

oneplus1000 avatar oneplus1000 commented on August 18, 2024

https://github.com/oneplus1000/gopdf/tree/issue_291

I've tried modifying the function MultiCellWithOption. To be able to add new lines RTL style.
(new code in the branch in link above.)

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.

from gopdf.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.