Skip to content

Commit b63242b

Browse files
committed
Upload v1.13.12
also fixes pymupdf#180
1 parent ef5f490 commit b63242b

15 files changed

+1303
-859
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# PyMuPDF 1.13.11 [![Build Status](https://travis-ci.org/rk700/PyMuPDF.svg?branch=master)](https://travis-ci.org/rk700/PyMuPDF)
1+
# PyMuPDF 1.13.12 [![Build Status](https://travis-ci.org/rk700/PyMuPDF.svg?branch=master)](https://travis-ci.org/rk700/PyMuPDF)
22

33
![logo](https://github.com/rk700/PyMuPDF/blob/master/demo/pymupdf.jpg)
44

@@ -10,7 +10,7 @@ Release date: June 20, 2018
1010

1111
# Introduction
1212

13-
This is **version 1.13.11 of PyMuPDF (formerly python-fitz)**, a Python binding with support for [MuPDF 1.13.0](http://mupdf.com/) - "a lightweight PDF and XPS viewer".
13+
This is **version 1.13.12 of PyMuPDF (formerly python-fitz)**, a Python binding with support for [MuPDF 1.13.0](http://mupdf.com/) - "a lightweight PDF and XPS viewer".
1414

1515
MuPDF can access files in PDF, XPS, OpenXPS, CBZ, EPUB and FB2 (e-books) formats, and it is known for its top performance and high rendering quality.
1616

demo/list-fields.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,11 @@ def print_widget(w):
1414
if k.startswith("_"):
1515
continue
1616
print(k, "=", d[k])
17+
print("")
1718

1819
doc = fitz.open(sys.argv[1])
1920
if not doc.isFormPDF:
20-
raise SystemExit("PDF has no form fields.")
21+
raise SystemExit("'%s' has no form fields." % doc.name)
2122
print("".ljust(80, "-"))
2223
print("Form field synopsis of file '%s'" % sys.argv[1])
2324
print("".ljust(80, "-"))

demo/widgettest.pdf

-63.3 KB
Binary file not shown.

demo/widgettest.py

+16-7
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,14 @@
3737
# Field 1: Simple Text
3838
#------------------------------------------------------------------------------
3939
r11 = fitz.Rect(50, 100, 200, 100 + lineheight) # rect of field label
40-
r12 = r11 + (r11.width+2, 0, r11.width+2, 0) # rect of field value
40+
r12 = r11 + (r11.width+2, 0, 2 * r11.width+2, 0) # rect of field value
4141
page.insertTextbox(r11, "simple Text field:", align = fitz.TEXT_ALIGN_RIGHT)
4242

4343
widget = fitz.Widget() # create a widget object
4444
widget.border_color = blue # border color
4545
widget.border_width = 0.3 # border width
46+
widget.border_style = "d"
47+
widget.border_dashes = [2, 3]
4648
widget.field_name = "textfield-1" # field name
4749
widget.field_type = fitz.ANNOT_WG_TEXT # field type
4850
widget.fill_color = gold # field background
@@ -51,6 +53,7 @@
5153
widget.text_font = "tibo" # use font Times-Bold
5254
widget.text_fontsize = fontsize # set fontsize
5355
widget.text_maxlen = 40 # restrict to 40 characters
56+
widget.field_value = "Times-Roman-Bold, 40 char."
5457
annot = page.addWidget(widget) # create the field
5558

5659
#------------------------------------------------------------------------------
@@ -68,6 +71,7 @@
6871
widget.rect = r22
6972
widget.text_color = blue
7073
widget.text_font = "ZaDb"
74+
widget.field_value = True
7175
annot = page.addWidget(widget)
7276

7377
#------------------------------------------------------------------------------
@@ -81,11 +85,13 @@
8185
widget.field_name = "ListBox-1"
8286
widget.field_type = fitz.ANNOT_WG_LISTBOX
8387
widget.fill_color = gold
84-
widget.list_values = ["Frankfurt", "Hamburg", "Stuttgart", "Hannover", "Berlin", "München", "Köln", "Potsdam"]
85-
widget.list_values.sort() # sort the choices
88+
widget.choice_values = ["Frankfurt", "Hamburg", "Stuttgart", "Hannover", "Berlin", "München", "Köln", "Potsdam"]
89+
widget.choice_values.sort() # sort the choices
8690
widget.rect = r32
8791
widget.text_color = blue
88-
widget.field_flags = 0
92+
widget.text_fontsize = fontsize
93+
widget.field_flags = fitz.WIDGET_Ff_CommitOnSelCHange
94+
widget.field_value = widget.choice_values[-1]
8995
annot = page.addWidget(widget)
9096

9197
#------------------------------------------------------------------------------
@@ -99,11 +105,13 @@
99105
widget.field_name = "ComboBox-1"
100106
widget.field_type = fitz.ANNOT_WG_COMBOBOX
101107
widget.fill_color = gold
102-
widget.list_values = ["Spanien", "Frankreich", "Holland", "Dänemark", "Schweden", "Norwegen", "England", "Polen", "Russland", "Italien", "Portugal", "Griechenland"]
103-
widget.list_values.sort() # sort the choices
108+
widget.choice_values = ["Spanien", "Frankreich", "Holland", "Dänemark", "Schweden", "Norwegen", "England", "Polen", "Russland", "Italien", "Portugal", "Griechenland"]
109+
widget.choice_values.sort() # sort the choices
104110
widget.rect = r42
105111
widget.text_color = blue
106112
widget.text_fontsize = fontsize
113+
widget.field_flags = fitz.WIDGET_Ff_CommitOnSelCHange
114+
widget.field_value = widget.choice_values[-1]
107115
annot = page.addWidget(widget)
108116

109117
#------------------------------------------------------------------------------
@@ -121,6 +129,7 @@
121129
widget.text_color = blue
122130
widget.text_font = "TiRo"
123131
widget.text_fontsize = fontsize
132+
widget.field_value = "this\nis\na\nmulti-\nline\ntext."
124133
annot = page.addWidget(widget)
125134

126-
doc.save("widgettest.pdf", pretty = True)
135+
doc.save("widgettest.pdf", clean = True, garbage = 4)

doc/PyMuPDF.pdf

7.17 KB
Binary file not shown.

doc/html.zip

4.59 KB
Binary file not shown.

0 commit comments

Comments
 (0)