From 177b010e665cccf299a328b082855890dc5190b5 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Fri, 9 Nov 2018 15:13:51 +0100 Subject: Fix 695893: Match page rotation when creating FreeText annotations. This uses an undocumented Rotate property of annotations, which is also used by Adobe. --- platform/gl/gl-annotate.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'platform') diff --git a/platform/gl/gl-annotate.c b/platform/gl/gl-annotate.c index 155cac24..89ce0271 100644 --- a/platform/gl/gl-annotate.c +++ b/platform/gl/gl-annotate.c @@ -126,6 +126,11 @@ static void new_annot(int type) case PDF_ANNOT_FREE_TEXT: { fz_rect text_rect = { 12, 12, 12+200, 12+100 }; + + /* Use undocumented Adobe property to match page rotation. */ + int rot = pdf_to_int(ctx, pdf_dict_get_inheritable(ctx, page->obj, PDF_NAME(Rotate))); + pdf_dict_put_int(ctx, selected_annot->obj, PDF_NAME(Rotate), rot); + pdf_set_annot_rect(ctx, selected_annot, text_rect); pdf_set_annot_border(ctx, selected_annot, 0); pdf_set_annot_default_appearance(ctx, selected_annot, "Helv", 12, black); -- cgit v1.2.3