On Tue, Apr 2, 2019 at 12:23 AM Reinhard Kotucha <reinhard.kotu...@web.de>
wrote:

> Hi,
> when I run the example on page 261/262 of the LuaTeX Manual and the
> input file ("foo.pdf" in the example) doesn't exist, I get
>
>   Segmentation fault (core dumped)
>
> on x86_64-linux.
>
> Regards,
>   Reinhard
>
> --
> ------------------------------------------------------------------
> Reinhard Kotucha                            Phone: +49-511-3373112
> Marschnerstr. 25
> D-30167 Hannover                    mailto:reinhard.kotu...@web.de
> ------------------------------------------------------------------
> _______________________________________________
> dev-luatex mailing list
> dev-luatex@ntg.nl
> https://mailman.ntg.nl/mailman/listinfo/dev-luatex
>



Confirmed. The test is

local operatortable = { }

operatortable.Do = function(scanner,info)
    local resources = info.resources
    if resources then
            local val     = scanner:pop()
            local name    = val[2]
            local xobject = resources.XObject
            print(info.space .. "Uses XObject " .. name)
            local resources = xobject.Resources
            if resources then
                local newinfo = {
                    space     = info.space .. " ",
                    resources = resources,
                }
                pdfscanner.scan(entry, operatortable, newinfo)
            end
      end
end

local function Analyze(filename)
    local doc = pdfe.open(filename)
    if doc then
        local pages = doc.Pages
        for i=1,#pages do
            local page = pages[i]
            local info = {
              space     = " " ,
              resources = page.Resources,
            }
            print("Page " .. i)
         -- pdfscanner.scan(page.Contents,operatortable,info)
            pdfscanner.scan(page.Contents(),operatortable,info)
        end
    end
end

Analyze("foo.pdf")

-- 
luigi
_______________________________________________
dev-luatex mailing list
dev-luatex@ntg.nl
https://mailman.ntg.nl/mailman/listinfo/dev-luatex

Reply via email to