Stamp now shares content with -fast
This commit is contained in:
parent
5b6cb59725
commit
114e069748
14
cpdf.ml
14
cpdf.ml
|
@ -2225,6 +2225,8 @@ let change_bookmark t m =
|
||||||
try change_destination t m.Pdfmarks.target with Not_found -> m.Pdfmarks.target}
|
try change_destination t m.Pdfmarks.target with Not_found -> m.Pdfmarks.target}
|
||||||
|
|
||||||
let stamp relative_to_cropbox position topline midline fast scale_to_fit isover range over pdf =
|
let stamp relative_to_cropbox position topline midline fast scale_to_fit isover range over pdf =
|
||||||
|
let prefix = Pdfpage.shortest_unused_prefix pdf in
|
||||||
|
Pdfpage.add_prefix over prefix;
|
||||||
let marks = Pdfmarks.read_bookmarks pdf in
|
let marks = Pdfmarks.read_bookmarks pdf in
|
||||||
let marks_refnumbers = Pdf.page_reference_numbers pdf in
|
let marks_refnumbers = Pdf.page_reference_numbers pdf in
|
||||||
let pdf = Pdfmarks.remove_bookmarks pdf in
|
let pdf = Pdfmarks.remove_bookmarks pdf in
|
||||||
|
@ -2243,25 +2245,21 @@ let stamp relative_to_cropbox position topline midline fast scale_to_fit isover
|
||||||
{merged with Pdf.saved_encryption = pdf.Pdf.saved_encryption}
|
{merged with Pdf.saved_encryption = pdf.Pdf.saved_encryption}
|
||||||
in
|
in
|
||||||
let merged = copy_id true pdf merged in
|
let merged = copy_id true pdf merged in
|
||||||
let renamed_pdf =
|
let merged_pages = Pdfpage.pages_of_pagetree merged in
|
||||||
Pdfpage.change_pages true
|
|
||||||
merged (Pdfpage.renumber_pages merged (Pdfpage.pages_of_pagetree merged))
|
|
||||||
in
|
|
||||||
let renamed_pages = Pdfpage.pages_of_pagetree renamed_pdf in
|
|
||||||
let under_pages, over_page =
|
let under_pages, over_page =
|
||||||
all_but_last renamed_pages, last renamed_pages
|
all_but_last merged_pages, last merged_pages
|
||||||
in
|
in
|
||||||
let new_pages =
|
let new_pages =
|
||||||
map2
|
map2
|
||||||
(fun pageseq under_page ->
|
(fun pageseq under_page ->
|
||||||
do_stamp relative_to_cropbox fast position topline midline scale_to_fit isover renamed_pdf
|
do_stamp relative_to_cropbox fast position topline midline scale_to_fit isover merged
|
||||||
(if mem pageseq range then over_page else
|
(if mem pageseq range then over_page else
|
||||||
Pdfpage.blankpage Pdfpaper.a4)
|
Pdfpage.blankpage Pdfpaper.a4)
|
||||||
under_page over)
|
under_page over)
|
||||||
pageseqs
|
pageseqs
|
||||||
under_pages
|
under_pages
|
||||||
in
|
in
|
||||||
let changed = Pdfpage.change_pages true renamed_pdf new_pages in
|
let changed = Pdfpage.change_pages true merged new_pages in
|
||||||
let new_refnumbers = Pdf.page_reference_numbers changed in
|
let new_refnumbers = Pdf.page_reference_numbers changed in
|
||||||
let changetable = hashtable_of_dictionary (List.combine marks_refnumbers new_refnumbers) in
|
let changetable = hashtable_of_dictionary (List.combine marks_refnumbers new_refnumbers) in
|
||||||
let new_marks = map (change_bookmark changetable) marks in
|
let new_marks = map (change_bookmark changetable) marks in
|
||||||
|
|
Loading…
Reference in New Issue