From 9bc5f38ec6cea07658deb2d9efa92559037dab48 Mon Sep 17 00:00:00 2001 From: John Whitington Date: Thu, 26 Sep 2019 12:30:17 +0100 Subject: [PATCH] Hack to allow -shift to be used with -add-text to alter position arbitrarily --- cpdf.ml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cpdf.ml b/cpdf.ml index 2d3df0b..ad9d11c 100644 --- a/cpdf.ml +++ b/cpdf.ml @@ -1816,7 +1816,9 @@ let addtext then numstring else implode (many '0' (w - String.length numstring)) ^ numstring))] in + let shifts = Cpdfcoord.parse_coordinates pdf shift in let addtext_page num page = + let shift_x, shift_y = List.nth shifts (num - 1) in let resources', unique_extgstatename = if opacity < 1.0 then let dict = @@ -1891,10 +1893,10 @@ let addtext in match font with | Some f -> - ops longest_w metrics x y rotate (hoffset +. joffset) voffset outline linewidth + ops longest_w metrics (x +. shift_x) (y +. shift_y) rotate (hoffset +. joffset) voffset outline linewidth unique_fontname unique_extgstatename colour fontsize text | None -> - ops longest_w metrics x y rotate (hoffset +. joffset) voffset outline linewidth + ops longest_w metrics (x +. shift_x) (y +. shift_y) rotate (hoffset +. joffset) voffset outline linewidth fontname None colour fontsize text in let newresources =