Fixed extract images to add page prefix

This commit is contained in:
John Whitington 2018-03-27 18:02:20 +01:00
parent 275418050d
commit 89c634ab8c
1 changed files with 6 additions and 4 deletions

View File

@ -2587,8 +2587,8 @@ let extract_images pdf range stem =
(function (i, pdf_pages) -> if mem i range then Some pdf_pages else None)
(combine (indx pdf_pages) pdf_pages)
in
iter
(function page ->
iter2
(fun page pnum ->
let xobjects =
match Pdf.lookup_direct pdf "/XObject" page.Pdfpage.resources with
| Some (Pdf.Dictionary elts) -> map snd elts
@ -2600,11 +2600,13 @@ let extract_images pdf range stem =
if images <> [] then
(let names =
map
(function n -> let r = Cpdf.name_of_spec [] (*FIXME *) pdf 0 stem n "" 0 0 in (*i flprint r; flprint "\n"; i*) r)
(ilist 1 (length images))
(function n ->
let r = Cpdf.name_of_spec [] pdf 0 ("p" ^ string_of_int pnum ^ "_" ^ stem) n "" 0 0 in r)
(indx images)
in
iter2 (write_image pdf page.Pdfpage.resources) names images))
pages
(indx pages)
let getencryption pdf =
match Pdfread.what_encryption pdf with