Edit

kc3-lang/kc3/test/pdf/write.out.expected

Branch :

  • test/pdf/write.out.expected
  • require PDF.Write
    PDF.Write
    doc = PDF.Write.new_file("write.pdf")
    (PDF.Write*) 1
    image = PDF.Write.image_from_file(doc, "image.jpeg")
    (U32) 4
    font = PDF.Write.font_from_file(doc, "font.ttf")
    (U32) 5
    a4 = %PDF.Rect{w: (F32) 210,
                   h: (F32) 297}
    %PDF.Rect{x: (F32) 0.0,
              y: (F32) 0.0,
              w: (F32) 2.099999e+2,
              h: (F32) 2.97e+2}
    page1 = PDF.Write.Page.new(doc, a4)
    (PDF.Write.Page*) 1
    x = (F32) 100
    (F32) 1.0e+2
    y = (F32) 200
    (F32) 2.0e+2
    font_size = (F32) 12
    (F32) 1.2e+1
    PDF.Write.Page.set_color_rgb(page1, (F32) 0, (F32) 0, (F32) 0)
    (PDF.Write.Page*) 1
    PDF.Write.Page.text(page1, x, y, font, font_size, "Test 123\nPlop")
    (PDF.Write.Page*) 1
    x = (F32) 10
    (F32) 1.0e+1
    y = (F32) 50
    (F32) 5.0e+1
    PDF.Write.Page.image(page1, x, y, image)
    (PDF.Write.Page*) 1
    rect = %PDF.Rect{x: (F32) 10,
                     y: (F32) 10,
                     w: (F32) 267,
                     h: (F32) 10}
    %PDF.Rect{x: (F32) 1.0e+1,
              y: (F32) 1.0e+1,
              w: (F32) 2.67e+2,
              h: (F32) 1.0e+1}
    PDF.Write.Page.set_color_rgb(page1, (F32) 0, (F32) 0, (F32) 0)
    (PDF.Write.Page*) 1
    PDF.Write.Page.rectangle(page1, rect)
    (PDF.Write.Page*) 1
    PDF.Write.add_page(doc, page1)
    (PDF.Write*) 1
    PDF.Write.Page.delete(page1)
    void
    PDF.Write.close(doc)
    void
    PDF.Write.delete(doc)
    void