mirror of
https://github.com/johnwhitington/cpdf-source.git
synced 2025-06-05 22:09:39 +02:00
Add %Objnum to -extract-images to allow cross-referencing
This commit is contained in:
1
Changes
1
Changes
@ -9,6 +9,7 @@ o -obj JSON output
|
||||
can follow a chain from each found dictionary entry
|
||||
* More of the PDF/UA Matterhorn verification suite implemented
|
||||
* Font lister now returns the font itself
|
||||
o Allow %objnum in output name for -extract-images
|
||||
|
||||
Fixes:
|
||||
|
||||
|
14
cpdfimage.ml
14
cpdfimage.ml
@ -128,11 +128,15 @@ let write_image ~raw ?path_to_p2p ?path_to_im pdf resources name image =
|
||||
let written = ref []
|
||||
|
||||
let extract_images_inner ~raw ?path_to_p2p ?path_to_im encoding serial pdf resources stem pnum images =
|
||||
let names = map
|
||||
(fun _ ->
|
||||
Cpdfbookmarks.name_of_spec
|
||||
encoding [] pdf 0 (stem ^ "-p" ^ string_of_int pnum)
|
||||
(let r = !serial in serial := !serial + 1; r) "" 0 0) (indx images)
|
||||
let names =
|
||||
map
|
||||
(fun image ->
|
||||
(* Abuse @S *)
|
||||
let stem = string_replace_all "%objnum" "@S" stem in
|
||||
Cpdfbookmarks.name_of_spec
|
||||
encoding [] pdf 0 (stem ^ "-p" ^ string_of_int pnum)
|
||||
(let r = !serial in serial := !serial + 1; r) "" (match image with Pdf.Indirect i -> i | _ -> 0) 0)
|
||||
images
|
||||
in
|
||||
iter2 (write_image ~raw ?path_to_p2p ?path_to_im pdf resources) names images
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
%Document %objnum in -extract-images
|
||||
%\DocumentMetadata{lang=en, pdfversion=2.0, pdfstandard=ua-2, pdfstandard=a-4f, testphase={phase-III, title, table, math, firstaid}}
|
||||
\documentclass{book}
|
||||
% Edit here to produce cpdfmanual.pdf, cpdflibmanual.pdf, pycpdfmanual.pdf,
|
||||
|
Reference in New Issue
Block a user