Skip to content

Commit dbb14b1

Browse files
committed
first build of v1.17.0
1 parent 3765f17 commit dbb14b1

File tree

10 files changed

+1768
-1242
lines changed

10 files changed

+1768
-1242
lines changed

fitz/fitz.i

Lines changed: 1524 additions & 871 deletions
Large diffs are not rendered by default.

fitz/helper-annot.i

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,4 @@
11
%{
2-
//----------------------------------------------------------------------------
3-
// return code for line end style string
4-
//----------------------------------------------------------------------------
5-
int JM_le_value(fz_context *ctx, char *le)
6-
{
7-
if (!le) return PDF_ANNOT_LE_NONE;
8-
return pdf_line_ending_from_string(ctx, le);
9-
}
10-
112
//----------------------------------------------------------------------------
123
// return pdf_obj "border style" from Python str
134
//----------------------------------------------------------------------------

fitz/helper-defines.i

Lines changed: 27 additions & 101 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// general
44
//----------------------------------------------------------------------------
55
#define EPSILON 1e-5
6+
67
//----------------------------------------------------------------------------
78
// annotation types
89
//----------------------------------------------------------------------------
@@ -13,79 +14,42 @@
1314
#define PDF_ANNOT_SQUARE 4
1415
#define PDF_ANNOT_CIRCLE 5
1516
#define PDF_ANNOT_POLYGON 6
16-
#define PDF_ANNOT_POLYLINE 7
17+
#define PDF_ANNOT_POLY_LINE 7
1718
#define PDF_ANNOT_HIGHLIGHT 8
1819
#define PDF_ANNOT_UNDERLINE 9
1920
#define PDF_ANNOT_SQUIGGLY 10
20-
#define PDF_ANNOT_STRIKEOUT 11
21+
#define PDF_ANNOT_STRIKE_OUT 11
2122
#define PDF_ANNOT_REDACT 12
2223
#define PDF_ANNOT_STAMP 13
2324
#define PDF_ANNOT_CARET 14
2425
#define PDF_ANNOT_INK 15
2526
#define PDF_ANNOT_POPUP 16
26-
#define PDF_ANNOT_FILEATTACHMENT 17
27+
#define PDF_ANNOT_FILE_ATTACHMENT 17
2728
#define PDF_ANNOT_SOUND 18
2829
#define PDF_ANNOT_MOVIE 19
2930
#define PDF_ANNOT_WIDGET 20
3031
#define PDF_ANNOT_SCREEN 21
31-
#define PDF_ANNOT_PRINTERMARK 22
32-
#define PDF_ANNOT_TRAPNET 23
32+
#define PDF_ANNOT_PRINTER_MARK 22
33+
#define PDF_ANNOT_TRAP_NET 23
3334
#define PDF_ANNOT_WATERMARK 24
3435
#define PDF_ANNOT_3D 25
3536
#define PDF_ANNOT_UNKNOWN -1
3637

37-
// deprecated aliases
38-
#define ANNOT_TEXT PDF_ANNOT_TEXT
39-
#define ANNOT_LINK PDF_ANNOT_LINK
40-
#define ANNOT_FREETEXT PDF_ANNOT_FREE_TEXT
41-
#define ANNOT_LINE PDF_ANNOT_LINE
42-
#define ANNOT_SQUARE PDF_ANNOT_SQUARE
43-
#define ANNOT_CIRCLE PDF_ANNOT_CIRCLE
44-
#define ANNOT_POLYGON PDF_ANNOT_POLYGON
45-
#define ANNOT_POLYLINE PDF_ANNOT_POLYLINE
46-
#define ANNOT_HIGHLIGHT PDF_ANNOT_HIGHLIGHT
47-
#define ANNOT_UNDERLINE PDF_ANNOT_UNDERLINE
48-
#define ANNOT_SQUIGGLY PDF_ANNOT_SQUIGGLY
49-
#define ANNOT_STRIKEOUT PDF_ANNOT_STRIKEOUT
50-
#define ANNOT_STAMP PDF_ANNOT_STAMP
51-
#define ANNOT_CARET PDF_ANNOT_CARET
52-
#define ANNOT_INK PDF_ANNOT_INK
53-
#define ANNOT_POPUP PDF_ANNOT_POPUP
54-
#define ANNOT_FILEATTACHMENT PDF_ANNOT_FILEATTACHMENT
55-
#define ANNOT_SOUND PDF_ANNOT_SOUND
56-
#define ANNOT_MOVIE PDF_ANNOT_MOVIE
57-
#define ANNOT_WIDGET PDF_ANNOT_WIDGET
58-
#define ANNOT_SCREEN PDF_ANNOT_WIDGET
59-
#define ANNOT_PRINTERMARK PDF_ANNOT_PRINTERMARK
60-
#define ANNOT_TRAPNET PDF_ANNOT_TRAPNET
61-
#define ANNOT_WATERMARK PDF_ANNOT_WATERMARK
62-
#define ANNOT_3D PDF_ANNOT_3D
6338

6439
//----------------------------------------------------------------------------
6540
// annotation flag bits
6641
//----------------------------------------------------------------------------
67-
#define PDF_ANNOT_IS_Invisible 1 << (1-1)
68-
#define PDF_ANNOT_IS_Hidden 1 << (2-1)
69-
#define PDF_ANNOT_IS_Print 1 << (3-1)
70-
#define PDF_ANNOT_IS_NoZoom 1 << (4-1)
71-
#define PDF_ANNOT_IS_NoRotate 1 << (5-1)
72-
#define PDF_ANNOT_IS_NoView 1 << (6-1)
73-
#define PDF_ANNOT_IS_ReadOnly 1 << (7-1)
74-
#define PDF_ANNOT_IS_Locked 1 << (8-1)
75-
#define PDF_ANNOT_IS_ToggleNoView 1 << (9-1)
76-
#define PDF_ANNOT_IS_LockedContents 1 << (10-1)
42+
#define PDF_ANNOT_IS_INVISIBLE 1 << (1-1)
43+
#define PDF_ANNOT_IS_HIDDEN 1 << (2-1)
44+
#define PDF_ANNOT_IS_PRINT 1 << (3-1)
45+
#define PDF_ANNOT_IS_NO_ZOOM 1 << (4-1)
46+
#define PDF_ANNOT_IS_NO_ROTATE 1 << (5-1)
47+
#define PDF_ANNOT_IS_NO_VIEW 1 << (6-1)
48+
#define PDF_ANNOT_IS_READ_ONLY 1 << (7-1)
49+
#define PDF_ANNOT_IS_LOCKED 1 << (8-1)
50+
#define PDF_ANNOT_IS_TOGGLE_NO_VIEW 1 << (9-1)
51+
#define PDF_ANNOT_IS_LOCKED_CONTENTS 1 << (10-1)
7752

78-
// deprecated aliases
79-
#define ANNOT_XF_Invisible PDF_ANNOT_IS_Invisible
80-
#define ANNOT_XF_Hidden PDF_ANNOT_IS_Hidden
81-
#define ANNOT_XF_Print PDF_ANNOT_IS_Print
82-
#define ANNOT_XF_NoZoom PDF_ANNOT_IS_NoZoom
83-
#define ANNOT_XF_NoRotate PDF_ANNOT_IS_NoRotate
84-
#define ANNOT_XF_NoView PDF_ANNOT_IS_NoView
85-
#define ANNOT_XF_ReadOnly PDF_ANNOT_IS_ReadOnly
86-
#define ANNOT_XF_Locked PDF_ANNOT_IS_Locked
87-
#define ANNOT_XF_ToggleNoView PDF_ANNOT_IS_ToggleNoView
88-
#define ANNOT_XF_LockedContents PDF_ANNOT_IS_LockedContents
8953

9054
//----------------------------------------------------------------------------
9155
// annotation line ending styles
@@ -101,17 +65,6 @@
10165
#define PDF_ANNOT_LE_R_CLOSED_ARROW 8
10266
#define PDF_ANNOT_LE_SLASH 9
10367

104-
// deprecated aliases
105-
#define ANNOT_LE_None PDF_ANNOT_LE_NONE
106-
#define ANNOT_LE_Square PDF_ANNOT_LE_SQUARE
107-
#define ANNOT_LE_Circle PDF_ANNOT_LE_CIRCLE
108-
#define ANNOT_LE_Diamond PDF_ANNOT_LE_DIAMOND
109-
#define ANNOT_LE_OpenArrow PDF_ANNOT_LE_OPEN_ARROW
110-
#define ANNOT_LE_ClosedArrow PDF_ANNOT_LE_CLOSED_ARROW
111-
#define ANNOT_LE_Butt PDF_ANNOT_LE_BUTT
112-
#define ANNOT_LE_ROpenArrow PDF_ANNOT_LE_R_OPEN_ARROW
113-
#define ANNOT_LE_RClosedArrow PDF_ANNOT_LE_R_CLOSED_ARROW
114-
#define ANNOT_LE_Slash PDF_ANNOT_LE_SLASH
11568

11669
//----------------------------------------------------------------------------
11770
// annotation field (widget) types
@@ -125,15 +78,6 @@
12578
#define PDF_WIDGET_TYPE_SIGNATURE 6
12679
#define PDF_WIDGET_TYPE_TEXT 7
12780

128-
// deprecated aliases
129-
#define ANNOT_WG_NOT_WIDGET PDF_WIDGET_TYPE_UNKNOWN
130-
#define ANNOT_WG_PUSHBUTTON PDF_WIDGET_TYPE_BUTTON
131-
#define ANNOT_WG_CHECKBOX PDF_WIDGET_TYPE_CHECKBOX
132-
#define ANNOT_WG_RADIOBUTTON PDF_WIDGET_TYPE_RADIOBUTTON
133-
#define ANNOT_WG_TEXT PDF_WIDGET_TYPE_TEXT
134-
#define ANNOT_WG_LISTBOX PDF_WIDGET_TYPE_LISTBOX
135-
#define ANNOT_WG_COMBOBOX PDF_WIDGET_TYPE_COMBOBOX
136-
#define ANNOT_WG_SIGNATURE PDF_WIDGET_TYPE_SIGNATURE
13781

13882
//----------------------------------------------------------------------------
13983
// annotation text widget subtypes
@@ -144,12 +88,6 @@
14488
#define PDF_WIDGET_TX_FORMAT_DATE 3
14589
#define PDF_WIDGET_TX_FORMAT_TIME 4
14690

147-
// deprecated aliases
148-
#define ANNOT_WG_TEXT_UNRESTRAINED PDF_WIDGET_TX_FORMAT_NONE
149-
#define ANNOT_WG_TEXT_NUMBER PDF_WIDGET_TX_FORMAT_NUMBER
150-
#define ANNOT_WG_TEXT_SPECIAL PDF_WIDGET_TX_FORMAT_SPECIAL
151-
#define ANNOT_WG_TEXT_DATE PDF_WIDGET_TX_FORMAT_DATE
152-
#define ANNOT_WG_TEXT_TIME PDF_WIDGET_TX_FORMAT_TIME
15391

15492
//----------------------------------------------------------------------------
15593
// annotation widget flags
@@ -159,10 +97,6 @@
15997
#define PDF_FIELD_IS_REQUIRED 1 << 1
16098
#define PDF_FIELD_IS_NO_EXPORT 1 << 2
16199

162-
// deprecated aliases
163-
#define WIDGET_Ff_ReadOnly PDF_FIELD_IS_READ_ONLY
164-
#define WIDGET_Ff_Required PDF_FIELD_IS_REQUIRED
165-
#define WIDGET_Ff_NoExport PDF_FIELD_IS_NO_EXPORT
166100

167101
// Text fields
168102
#define PDF_TX_FIELD_IS_MULTILINE 1 << 12
@@ -173,26 +107,13 @@
173107
#define PDF_TX_FIELD_IS_COMB 1 << 24
174108
#define PDF_TX_FIELD_IS_RICH_TEXT 1 << 25
175109

176-
// deprecated aliases
177-
#define WIDGET_Ff_Multiline PDF_TX_FIELD_IS_MULTILINE
178-
#define WIDGET_Ff_Password PDF_TX_FIELD_IS_PASSWORD
179-
#define WIDGET_Ff_FileSelect PDF_TX_FIELD_IS_FILE_SELECT
180-
#define WIDGET_Ff_DoNotSpellCheck PDF_TX_FIELD_IS_DO_NOT_SPELL_CHECK
181-
#define WIDGET_Ff_DoNotScroll PDF_TX_FIELD_IS_DO_NOT_SCROLL
182-
#define WIDGET_Ff_Comb PDF_TX_FIELD_IS_COMB
183-
#define WIDGET_Ff_RichText PDF_TX_FIELD_IS_RICH_TEXT
184110

185111
// Button fields
186112
#define PDF_BTN_FIELD_IS_NO_TOGGLE_TO_OFF 1 << 14
187113
#define PDF_BTN_FIELD_IS_RADIO 1 << 15
188114
#define PDF_BTN_FIELD_IS_PUSHBUTTON 1 << 16
189115
#define PDF_BTN_FIELD_IS_RADIOS_IN_UNISON 1 << 25
190116

191-
// deprecated aliases
192-
#define WIDGET_Ff_NoToggleToOff PDF_BTN_FIELD_IS_NO_TOGGLE_TO_OFF
193-
#define WIDGET_Ff_Radio PDF_BTN_FIELD_IS_RADIO
194-
#define WIDGET_Ff_Pushbutton PDF_BTN_FIELD_IS_PUSHBUTTON
195-
#define WIDGET_Ff_RadioInUnison PDF_BTN_FIELD_IS_RADIOS_IN_UNISON
196117

197118
// Choice fields
198119
#define PDF_CH_FIELD_IS_COMBO 1 << 17
@@ -202,12 +123,17 @@
202123
#define PDF_CH_FIELD_IS_DO_NOT_SPELL_CHECK 1 << 22
203124
#define PDF_CH_FIELD_IS_COMMIT_ON_SEL_CHANGE 1 << 26
204125

205-
// deprecated aliases
206-
#define WIDGET_Ff_Combo PDF_CH_FIELD_IS_COMBO
207-
#define WIDGET_Ff_Edit PDF_CH_FIELD_IS_EDIT
208-
#define WIDGET_Ff_Sort PDF_CH_FIELD_IS_SORT
209-
#define WIDGET_Ff_MultiSelect PDF_CH_FIELD_IS_MULTI_SELECT
210-
#define WIDGET_Ff_CommitOnSelCHange PDF_CH_FIELD_IS_COMMIT_ON_SEL_CHANGE
126+
127+
// Signature fields errors
128+
#define PDF_SIGNATURE_ERROR_OKAY 0
129+
#define PDF_SIGNATURE_ERROR_NO_SIGNATURES 1
130+
#define PDF_SIGNATURE_ERROR_NO_CERTIFICATE 2
131+
#define PDF_SIGNATURE_ERROR_DIGEST_FAILURE 3
132+
#define PDF_SIGNATURE_ERROR_SELF_SIGNED 4
133+
#define PDF_SIGNATURE_ERROR_SELF_SIGNED_IN_CHAIN 5
134+
#define PDF_SIGNATURE_ERROR_NOT_TRUSTED 6
135+
#define PDF_SIGNATURE_ERROR_UNKNOWN 7
136+
211137

212138
//----------------------------------------------------------------------------
213139
// colorspace identifiers

fitz/helper-fields.i

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ PyObject *JM_choice_options(fz_context *ctx, pdf_annot *annot)
392392
{ // return list of choices for list or combo boxes
393393
pdf_document *pdf = pdf_get_bound_document(ctx, annot->obj);
394394
PyObject *val;
395-
int n = pdf_choice_widget_options(ctx, pdf, (pdf_widget *) annot, 0, NULL);
395+
int n = pdf_choice_widget_options(ctx, (pdf_widget *) annot, 0, NULL);
396396
if (n == 0) Py_RETURN_NONE; // wrong widget type
397397

398398
pdf_obj *optarr = pdf_dict_get(ctx, annot->obj, PDF_NAME(Opt));
@@ -511,10 +511,10 @@ void JM_get_widget_properties(fz_context *ctx, pdf_annot *annot, PyObject *Widge
511511
}
512512

513513
SETATTR_DROP("text_maxlen",
514-
Py_BuildValue("i", pdf_text_widget_max_len(ctx, pdf, tw)), val);
514+
Py_BuildValue("i", pdf_text_widget_max_len(ctx, tw)), val);
515515

516516
SETATTR_DROP("text_format",
517-
Py_BuildValue("i", pdf_text_widget_format(ctx, pdf, tw)), val);
517+
Py_BuildValue("i", pdf_text_widget_format(ctx, tw)), val);
518518

519519
obj = pdf_dict_getl(ctx, annot->obj, PDF_NAME(MK), PDF_NAME(BG), NULL);
520520
if (pdf_is_array(ctx, obj))
@@ -616,6 +616,8 @@ void JM_set_widget_properties(fz_context *ctx, pdf_annot *annot, PyObject *Widge
616616
value = GETATTR("rect");
617617
rect = JM_rect_from_py(value);
618618
Py_CLEAR(value);
619+
fz_matrix rot_mat = JM_rotate_page_matrix(ctx, page);
620+
rect = fz_transform_rect(rect, rot_mat);
619621
pdf_set_annot_rect(ctx, annot, rect); // set the rect
620622

621623
// fill color -------------------------------------------------------------

0 commit comments

Comments
 (0)