tyre / gutenex

Native PDF generation for Elixir
MIT License
243 stars 35 forks source link

expose line drawing, add line_width #9

Closed edebill closed 8 years ago

edebill commented 8 years ago

I saw that you had functions for drawing lines, but I couldn't figure out how to use them in the same paradigm as everything else. I added similar functions to the Gutenex module so I could access them. Then I noticed there was no way to control line width, so I looked up how to do that and added some similar functions for that.

Example usage:

    {:ok, pid} = Gutenex.start_link
    Gutenex.line_width(pid, 0.5)
    |> Gutenex.line({{0,0}, {90, 100}})
    |> Gutenex.line_width(0.75)
    |> Gutenex.line({{0,10}, {90, 110}})
    |> Gutenex.line_width(1)
    |> Gutenex.line({{0,20}, {90, 120}})
    |> Gutenex.export("./tmp/template.pdf")
    |> Gutenex.stop

At this point I can do what I want - I want to make some templates for practicing calligraphy with horizontal lines and lines at an angle.

tyre commented 8 years ago

Nice!