> I am wrapping a little bit of poppler just aiming to extract some images from 
> PDF's.

Unfortunately Google was not able to find your valid email or postal address.

I have added poppler to gintro.

You may test with
    
    
    nimble uninstall gintro
    nimble install gintro@#head
    
    
    Run

At least this tiny test program seems to work:
    
    
    import gintro/[poppler, cairo]
    
    proc main =
      var doc = newDocumentFromFile("file:///home/salewski/hhh9/lm741.pdf", nil)
      echo "Number of pages: ", doc.nPages()
      var page: Page = doc.getPage(2)
      var imseq = getImageMapping(page)
      echo imseq.len
      for i in imseq:
        echo i.imageId
        echo i.area
      var surface = getImage(page, 0)
      let status = cairo.writeToPng(surface, "test.png")
      echo status
    
    main()
    
    
    Run
    
    
    nim c t.nim
    Hint: mm: orc; threads: on; opt: none (DEBUG BUILD, `-d:release` generates 
faster code)
    105225 lines; 1.142s; 168.074MiB peakmem; proj: /home/salewski/hhh9/t.nim; 
out: /home/salewski/hhh9/t [SuccessX]
    salewski@hx90 ~/hhh9 $ ./t
    Number of pages: 17
    2
    1
    (x1: 101.5, y1: 136.8, x2: 246.5, y2: 224.8)
    0
    (x1: 348.8, y1: 136.96, x2: 526.8, y2: 227.96)
    success
    salewski@hx90 ~/hhh9 $ nim c -d:gintroDebug t.nim
    
    
    salewski@hx90 ~/hhh9 $ ./t
    Number of pages: 17
    2
    1
    (x1: 101.5, y1: 136.8, x2: 246.5, y2: 224.8)
    0
    (x1: 348.8, y1: 136.96, x2: 526.8, y2: 227.96)
    success
    destroy Surface:ObjectType 140070177714368
    destroy ImageMapping:ObjectType 140070177706080
    destroy ImageMapping:ObjectType 140070177706144
    destroy Page:ObjectType 140070177714320
    destroy Document:ObjectType 140070177714272
    
    
    Run

For poppler.Rectangle and poppler.ImageMapping we still use proxy objects -- I 
have provided getter procs to access the fields, see end of poppler.nim file. I 
have not the time and motivation to examine poppler in much detail, there may 
exist more data types with fields, for which you may have to create getter 
procs. For that, we would have to generate the fields first, which needs a 
modification of the gen.nim generator script. Search for poppler.Rectangle to 
find were fields are generated. You should know enough Nim to manage that 
yourself, you can find in the issue tracker instructions how you can run 
gen.nim inside of a local directory. Libraries like libnice, gstreamer and 
poppler are difficult for bindings, as the gobject-introspection is a late 
add-on for these. Native GObject libs generally avoid use of objects with 
fields or provide getter and setter functions by gobject-introspection, which 
manual intervention unnecessary.

Well, enough "ramblings" from me for today. At least I have learned a new word, 
German translation seems to be "Geschwafel", which is not a very friendly term.

When you should need more support, use the gintro issue tracker or email, as I 
will not continue reading this thread.

Reply via email to