XMP date fixes
This commit is contained in:
parent
89dfe94d13
commit
ab9cb792e4
10
cpdf.ml
10
cpdf.ml
|
@ -2697,7 +2697,7 @@ let hard_box pdf range boxname mediabox_if_missing fast =
|
||||||
| _ ->
|
| _ ->
|
||||||
if mediabox_if_missing
|
if mediabox_if_missing
|
||||||
then Pdf.parse_rectangle page.Pdfpage.mediabox
|
then Pdf.parse_rectangle page.Pdfpage.mediabox
|
||||||
else error "hard_box: Box not found"
|
else error (Printf.sprintf "hard_box: box %s not found" boxname)
|
||||||
in
|
in
|
||||||
let ops = [Pdfops.Op_re (minx, miny, maxx -. minx, maxy -. miny); Pdfops.Op_W; Pdfops.Op_n] in
|
let ops = [Pdfops.Op_re (minx, miny, maxx -. minx, maxy -. miny); Pdfops.Op_W; Pdfops.Op_n] in
|
||||||
Pdfpage.prepend_operators pdf ops ~fast:fast page)
|
Pdfpage.prepend_operators pdf ops ~fast:fast page)
|
||||||
|
@ -3607,9 +3607,9 @@ let xmp_date date =
|
||||||
end
|
end
|
||||||
| _ -> raise Exit
|
| _ -> raise Exit
|
||||||
end
|
end
|
||||||
| _ -> failwith "xmp_date: Malformed date string (no year)"
|
| _ -> failwith (Printf.sprintf "xmp_date: Malformed date string (no year): %s" date)
|
||||||
end
|
end
|
||||||
| _ -> failwith "xmp_date: Malformed date string (no prefix)"
|
| _ -> failwith (Printf.sprintf "xmp_date: Malformed date string (no prefix): %s" date)
|
||||||
with
|
with
|
||||||
Exit -> make_xmp_date_from_components d
|
Exit -> make_xmp_date_from_components d
|
||||||
|
|
||||||
|
@ -3668,8 +3668,8 @@ let set_metadata_date pdf date =
|
||||||
|
|
||||||
let replacements pdf =
|
let replacements pdf =
|
||||||
let info = get_info_utf8 pdf in
|
let info = get_info_utf8 pdf in
|
||||||
[("CREATEDATE", xmp_date (info "/CreationDate"));
|
[("CREATEDATE", xmp_date (let i = info "/CreationDate" in if i = "" then expand_date "now" else i));
|
||||||
("MODDATE", xmp_date (info "/ModDate"));
|
("MODDATE", xmp_date (let i = info "/ModDate" in if i = "" then expand_date "now" else i));
|
||||||
("PRODUCER", info "/Producer");
|
("PRODUCER", info "/Producer");
|
||||||
("CREATOR", info "/Creator");
|
("CREATOR", info "/Creator");
|
||||||
("TITLE", info "/Title");
|
("TITLE", info "/Title");
|
||||||
|
|
|
@ -3721,7 +3721,7 @@ let trim_marks_page pdf n page =
|
||||||
@ [Pdfops.Op_Q]
|
@ [Pdfops.Op_Q]
|
||||||
in
|
in
|
||||||
Pdfpage.postpend_operators pdf ops ~fast:args.fast page
|
Pdfpage.postpend_operators pdf ops ~fast:args.fast page
|
||||||
| _, _ -> Printf.eprintf "-trim_marks: No /TrimBox found on page %i\n" n; page
|
| _, _ -> Printf.eprintf "warning: no /TrimBox found on page %i\n" n; page
|
||||||
|
|
||||||
let trim_marks range pdf =
|
let trim_marks range pdf =
|
||||||
Cpdf.process_pages (trim_marks_page pdf) pdf range
|
Cpdf.process_pages (trim_marks_page pdf) pdf range
|
||||||
|
|
Loading…
Reference in New Issue