Yes, it is not impossible. I did a short test with <https://www.ti.com/lit/ds/symlink/lm741.pdf> import gintro/[poppler, cairo] import std/[uri, strformat] proc main = # Load the PDF document #var fname = parseUri("file:///home/jose/Descargas/Escrituras Espartales.pdf") #var password = "" var doc = newDocumentFromFile("file:///tmp/hhh/lm741.pdf", nil) echo "Number of pages: ", doc.nPages() # Get the number of pages in the document var page: Page = doc.getPage(2) var imseq = getImageMapping(page) echo imseq.len var surface = getImage(page, 0) echo surface != nil let status = cairo.writeToPng(surface, "test.png") echo status #var n = 1 #for img in page.images: # echo repr img # img.toPng(fmt"page_{n:.2d}.png") # n += 1 main() Run
And indeed I get a PNG picture, the rectangular shaped, top right from page 3. But the bindings would need some manual tuning. And I think I should really not do your homework for you. And extracting images from PDF documents have always the taste of stealing for me, similar as unauthorized github forks :-)