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
|
can follow a chain from each found dictionary entry
|
||||||
* More of the PDF/UA Matterhorn verification suite implemented
|
* More of the PDF/UA Matterhorn verification suite implemented
|
||||||
* Font lister now returns the font itself
|
* Font lister now returns the font itself
|
||||||
|
o Allow %objnum in output name for -extract-images
|
||||||
|
|
||||||
Fixes:
|
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 written = ref []
|
||||||
|
|
||||||
let extract_images_inner ~raw ?path_to_p2p ?path_to_im encoding serial pdf resources stem pnum images =
|
let extract_images_inner ~raw ?path_to_p2p ?path_to_im encoding serial pdf resources stem pnum images =
|
||||||
let names = map
|
let names =
|
||||||
(fun _ ->
|
map
|
||||||
Cpdfbookmarks.name_of_spec
|
(fun image ->
|
||||||
encoding [] pdf 0 (stem ^ "-p" ^ string_of_int pnum)
|
(* Abuse @S *)
|
||||||
(let r = !serial in serial := !serial + 1; r) "" 0 0) (indx images)
|
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
|
in
|
||||||
iter2 (write_image ~raw ?path_to_p2p ?path_to_im pdf resources) names images
|
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}}
|
%\DocumentMetadata{lang=en, pdfversion=2.0, pdfstandard=ua-2, pdfstandard=a-4f, testphase={phase-III, title, table, math, firstaid}}
|
||||||
\documentclass{book}
|
\documentclass{book}
|
||||||
% Edit here to produce cpdfmanual.pdf, cpdflibmanual.pdf, pycpdfmanual.pdf,
|
% Edit here to produce cpdfmanual.pdf, cpdflibmanual.pdf, pycpdfmanual.pdf,
|
||||||
|
Reference in New Issue
Block a user