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