Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5bc5dc93f3 | ||
|
|
c1e18bb825 | ||
|
|
58282ea0fb | ||
|
|
891da7834c | ||
|
|
5c229d48d5 | ||
|
|
53f660cf35 | ||
|
|
7b66ca68f2 | ||
|
|
ba71c3ffbd | ||
|
|
6707ad427a | ||
|
|
5b84549716 | ||
|
|
c74f2ee6e8 | ||
|
|
b32dd9f9d3 | ||
|
|
fb8b161f6c | ||
|
|
baddd6d233 | ||
|
|
6f554c6ae8 | ||
|
|
a71e4488b3 | ||
|
|
72156b5653 | ||
|
|
9fa471e053 | ||
|
|
31ef2fe907 | ||
|
|
9a8ec4b210 | ||
|
|
75aad4cc79 | ||
|
|
4b27feca98 | ||
|
|
45522cd15f | ||
|
|
677d9a4e76 | ||
|
|
efa7ea4fde | ||
|
|
137a6e45f5 | ||
|
|
29116e1dec | ||
|
|
87193335b9 | ||
|
|
cfd4f8a850 | ||
|
|
eaa324939f | ||
|
|
ef70e538f7 | ||
|
|
b7b912e56a | ||
|
|
4615cf2f1e | ||
|
|
eaf772f80a | ||
|
|
96ba75eabd | ||
|
|
fdfe52c1ad | ||
|
|
932b2e2a29 | ||
|
|
57e489c957 | ||
|
|
17a3fa671c | ||
|
|
2659afb4f6 | ||
|
|
7392115507 | ||
|
|
c54d0c7eaa | ||
|
|
b95eefc65f | ||
|
|
686207ab7f | ||
|
|
517b385fe5 | ||
|
|
795019b0c1 | ||
|
|
3127a73822 | ||
|
|
069ee6c91f | ||
|
|
3aac3a98ca | ||
|
|
268859a304 | ||
|
|
a96710aa7b | ||
|
|
edcc58826a | ||
|
|
7077c8220a | ||
|
|
f7cbf68edd | ||
|
|
68a58ee8a5 | ||
|
|
3109ec5091 | ||
|
|
e0599fe8d7 | ||
|
|
a749240589 | ||
|
|
6decdaa062 | ||
|
|
4d5c9b8cdf | ||
|
|
1e23ea5364 | ||
|
|
cf9a8a91b5 | ||
|
|
05d3a65e94 | ||
|
|
c043552f8b | ||
|
|
487ee2b6c9 | ||
|
|
8013fd50da | ||
|
|
4ec9ec12e3 | ||
|
|
ed96594727 | ||
|
|
91b7193249 | ||
|
|
008f65c6a9 | ||
|
|
7aa4e60af2 | ||
|
|
6ef26516d1 | ||
|
|
bb50501369 | ||
|
|
55eb481f30 | ||
|
|
4509ca6e75 | ||
|
|
c61fe9af61 | ||
|
|
4181a712d1 | ||
|
|
c171cb7286 | ||
|
|
1d09061130 | ||
|
|
a2203b2447 | ||
|
|
755f6e0979 | ||
|
|
95b2830d17 | ||
|
|
2669d8332e | ||
|
|
11fbd32e6e | ||
|
|
6a302fdb88 | ||
|
|
1d9cc239ee | ||
|
|
d240fc1ea6 | ||
|
|
e7d21dd826 | ||
|
|
e774b4650b | ||
|
|
8f8e6dcdd4 | ||
|
|
5252b88f0f | ||
|
|
ea69883386 | ||
|
|
eb343b1e37 | ||
|
|
9f02de55be | ||
|
|
7394a4cf49 | ||
|
|
ed9fb110b1 | ||
|
|
4650074428 | ||
|
|
70aa644c10 | ||
|
|
2ccb3edc58 | ||
|
|
a12a5f11ff | ||
|
|
f46e4067f4 | ||
|
|
47bf5585e8 | ||
|
|
72fb4d39be | ||
|
|
9681c0e05a | ||
|
|
2628575dab | ||
|
|
f7d59068e5 | ||
|
|
4cf10d62ca | ||
|
|
2f65e3aac8 | ||
|
|
e494cd7aa6 | ||
|
|
809880f46d | ||
|
|
5925ebe31c | ||
|
|
316709c291 | ||
|
|
0d6a2ba554 | ||
|
|
1fcb06b1aa | ||
|
|
36138c7c06 | ||
|
|
338593d9e7 | ||
|
|
d6eb1f9578 | ||
|
|
1cc9d2d3d1 | ||
|
|
58642aa98b | ||
|
|
7baaf00a38 | ||
|
|
5cc23dbf24 | ||
|
|
216d60ea2c | ||
|
|
8b0496d35e | ||
|
|
e44001641c | ||
|
|
47885f4230 | ||
|
|
921767e82e | ||
|
|
85f96b7fb0 | ||
|
|
890c7fd0f6 | ||
|
|
39c44bdd2f | ||
|
|
5f99f7f6ca | ||
|
|
4f864bce98 | ||
|
|
2974929b26 | ||
|
|
db837aa55c | ||
|
|
7200623007 | ||
|
|
73e02ae4ea | ||
|
|
d4cbef9457 | ||
|
|
ed8ff79e10 | ||
|
|
e725f64b6a | ||
|
|
0029cc4fe7 | ||
|
|
9637696a54 | ||
|
|
02b3ca6862 | ||
|
|
bc90f40a8f | ||
|
|
3d727ff4c0 | ||
|
|
b0eacd6586 | ||
|
|
7795701595 | ||
|
|
bf214eecb3 | ||
|
|
434b96d734 | ||
|
|
b9dc109892 | ||
|
|
1f40a70554 | ||
|
|
e14ffbf03f | ||
|
|
25a1dde57c | ||
|
|
bf96171b65 | ||
|
|
b7ff821fa3 | ||
|
|
b81daf71d1 | ||
|
|
faad1fc58a | ||
|
|
6f48181a56 | ||
|
|
f1305e5a37 | ||
|
|
f0e0f92776 | ||
|
|
807c8b0726 | ||
|
|
6333ec928c | ||
|
|
cd220d9ed9 | ||
|
|
76532649b8 | ||
|
|
b0dbaeafc5 | ||
|
|
2530d1791b | ||
|
|
94150f414a | ||
|
|
54e74f84cc | ||
|
|
76e7e8dbbb | ||
|
|
324598e992 | ||
|
|
9e765ddf46 | ||
|
|
6ac9e92f17 | ||
|
|
faaa4a1def | ||
|
|
0aa51f0f3a | ||
|
|
73431d9761 | ||
|
|
45cb4525cf | ||
|
|
8c84c515b6 | ||
|
|
1dfbbdebf4 | ||
|
|
740918daee | ||
|
|
1d10eac764 | ||
|
|
3f868118cd | ||
|
|
04d79b15b4 | ||
|
|
a13c398c06 | ||
|
|
e3b3f716ee | ||
|
|
cf43c06f46 | ||
|
|
74a5a18607 | ||
|
|
44241c6dd5 | ||
|
|
8fff496ffd | ||
|
|
edf75c519c | ||
|
|
9608b22d34 | ||
|
|
8ba4968c48 | ||
|
|
ffdd78f1a5 | ||
|
|
ad9f8ca78e | ||
|
|
78a686ecb4 | ||
|
|
59e786eb3c | ||
|
|
6d0461435f | ||
|
|
0a04a60f69 | ||
|
|
68d8642988 | ||
|
|
16f70ff054 | ||
|
|
c00aeafff0 | ||
|
|
83f35e00f3 | ||
|
|
786a2ad65a | ||
|
|
9425506c2a | ||
|
|
93b858afd1 | ||
|
|
7b0a3ec365 | ||
|
|
083d442529 | ||
|
|
b52eb95cf8 | ||
|
|
f4571e2508 | ||
|
|
b06ef03aac | ||
|
|
1d1962a106 | ||
|
|
4b98e9ff08 | ||
|
|
f83ca5d8ac | ||
|
|
95cb4d22d7 | ||
|
|
0c279b01a4 | ||
|
|
3b820ffa7b | ||
|
|
35cb416563 | ||
|
|
cdb737259c | ||
|
|
0843b5939c | ||
|
|
2b5f23a2d1 | ||
|
|
5e20d1d554 | ||
|
|
18595ca86a | ||
|
|
3e269fa188 | ||
|
|
65405c2cb9 | ||
|
|
442cf8897a | ||
|
|
d5fb275e9e | ||
|
|
e60aec81ca | ||
|
|
398e9e535e | ||
|
|
08bf651ef2 | ||
|
|
6171de41bf | ||
|
|
f0a56592e2 | ||
|
|
87a7d4d1a8 | ||
|
|
05287902a2 | ||
|
|
96e453feb6 | ||
|
|
9c0fa9fc04 | ||
|
|
3bde0715b0 | ||
|
|
e2ec3d8b9b | ||
|
|
ad91eaf8a7 | ||
|
|
b6d30214fd | ||
|
|
c4ab01d63d | ||
|
|
4ba3b3f55a | ||
|
|
52d2706a9e | ||
|
|
964afc69f6 | ||
|
|
3ddf545ccd | ||
|
|
f9374733bb | ||
|
|
5930135f45 | ||
|
|
f03f6bc128 | ||
|
|
6c50c70235 | ||
|
|
8790fc2c1b | ||
|
|
f86c4fccf4 | ||
|
|
7d0785e9ed | ||
|
|
2cac88162c | ||
|
|
4809627d8a | ||
|
|
871979abd6 | ||
|
|
efb95722ca | ||
|
|
d9bbb80a6b | ||
|
|
3254315127 | ||
|
|
ca297fd26b | ||
|
|
ac36a43cef | ||
|
|
f00183115d | ||
|
|
161b29a899 | ||
|
|
72253d09fa | ||
|
|
40d09ddb23 | ||
|
|
3026d86a9e | ||
|
|
0661a7edc3 | ||
|
|
24b0adfacc | ||
|
|
acc6698ab3 | ||
|
|
606d3e6aa1 | ||
|
|
687a7954d6 | ||
|
|
36a53a7b37 | ||
|
|
0a5982a902 | ||
|
|
601863f9e9 | ||
|
|
c9ce731119 | ||
|
|
abed8e034e | ||
|
|
63032d304d | ||
|
|
a57ecede78 | ||
|
|
b0ce7c63dd | ||
|
|
d139a11c16 | ||
|
|
aef043db0b | ||
|
|
b8f3ead541 | ||
|
|
e0bb898f29 | ||
|
|
45336c7c28 | ||
|
|
20aabb2e83 | ||
|
|
1539e24d61 | ||
|
|
c7cf041e4a | ||
|
|
da80d3f354 | ||
|
|
001c8d7678 | ||
|
|
38ab03655b | ||
|
|
9226f8a5d1 | ||
|
|
5c8a007f3e | ||
|
|
b3ad3e297d | ||
|
|
d607553e48 | ||
|
|
7cf83c77ca | ||
|
|
8a9f174f63 | ||
|
|
98a0786c32 | ||
|
|
df1129724c | ||
|
|
423cef08bf | ||
|
|
04580accb4 | ||
|
|
6376f77b8c | ||
|
|
e27e614ed9 | ||
|
|
b0c04704a1 | ||
|
|
6bb6bf8323 | ||
|
|
e22fe8aefc | ||
|
|
76276f61e5 | ||
|
|
bfd26e6ec6 | ||
|
|
d787e1ea0f | ||
|
|
b5d7e9cbb0 | ||
|
|
f3b6d9dcdf | ||
|
|
a9abe13185 | ||
|
|
6b315e8315 | ||
|
|
37677de884 | ||
|
|
c7387de325 | ||
|
|
2495b1e038 | ||
|
|
073ee52ce7 | ||
|
|
54150a14e9 | ||
|
|
88ff091cce | ||
|
|
e87a5776f1 | ||
|
|
0806ce6406 | ||
|
|
6409894a71 | ||
|
|
e7286f6129 | ||
|
|
2ab94b3151 | ||
|
|
7ee90890ec | ||
|
|
383e726d65 | ||
|
|
e046f70642 | ||
|
|
2131ad4670 | ||
|
|
219fe2155b | ||
|
|
4209034d20 | ||
|
|
abcae0c2a4 | ||
|
|
0934905493 | ||
|
|
11cd6201d9 | ||
|
|
8d2a917676 | ||
|
|
44b4afa534 | ||
|
|
775be3933c | ||
|
|
df87e21c85 | ||
|
|
d761d80750 | ||
|
|
8052019dde | ||
|
|
a3d8950088 | ||
|
|
004f5d3bf1 | ||
|
|
f5d308a156 | ||
|
|
3869996758 | ||
|
|
cdb2107c4e | ||
|
|
4db2b3413b | ||
|
|
b2f31bec79 | ||
|
|
78f9f4a266 | ||
|
|
ad6087c342 | ||
|
|
0d6ef430de | ||
|
|
a5942209e8 | ||
|
|
9a60694cfc | ||
|
|
4bf13f4737 | ||
|
|
9e89b75186 | ||
|
|
0b10db91be | ||
|
|
1a516b2af9 | ||
|
|
076363d78e | ||
|
|
5fde214290 | ||
|
|
a620724d6a | ||
|
|
640b953ec7 | ||
|
|
a009ca7597 | ||
|
|
7368399f8b | ||
|
|
c974aec934 | ||
|
|
3033f03f64 | ||
|
|
72723e0bb5 | ||
|
|
2fb6ab3939 | ||
|
|
25c1c160b8 | ||
|
|
7e92895471 | ||
|
|
d291d48991 | ||
|
|
0e6b8042b0 | ||
|
|
34c78a892a | ||
|
|
9d28879505 | ||
|
|
2482296e2b | ||
|
|
f755fb76ee | ||
|
|
c61b5dcb62 | ||
|
|
fae893b9d9 | ||
|
|
10aadefd6a | ||
|
|
e75b6280fd | ||
|
|
8c4023165a | ||
|
|
b7d403f106 | ||
|
|
b069de0caa | ||
|
|
136da74bfa | ||
|
|
7fc897e6dc | ||
|
|
9b731d63b8 | ||
|
|
10aa59f674 | ||
|
|
1f7837e7b1 | ||
|
|
ba0535e3fb | ||
|
|
49fa7f6b5c | ||
|
|
c95db246d4 | ||
|
|
1ba93371ce | ||
|
|
fedbbdb575 | ||
|
|
85ebba72bc | ||
|
|
b6cd436d5d | ||
|
|
ec170c7e1e | ||
|
|
f6399eb90f | ||
|
|
77f2448e59 | ||
|
|
3d69b46fca | ||
|
|
4b6153ad18 | ||
|
|
75d37eb103 | ||
|
|
11b6f77df0 | ||
|
|
db8b0319dd | ||
|
|
c9dd330766 | ||
|
|
e40228102c | ||
|
|
7889c6fb4c | ||
|
|
6eb1773110 | ||
|
|
1d25823746 | ||
|
|
d1d4f1e198 | ||
|
|
709c01c7a1 | ||
|
|
4a341c9034 | ||
|
|
be41ff6d54 | ||
|
|
1dbb6f1746 | ||
|
|
753e6274ab | ||
|
|
7f462c618b | ||
|
|
d8ac6e28ab | ||
|
|
a95ffcdc46 | ||
|
|
1b01d45dd2 | ||
|
|
7a1cd39b21 | ||
|
|
1c1fd9616a | ||
|
|
11e19e4085 | ||
|
|
2a43f73228 | ||
|
|
b1d1310a75 | ||
|
|
0e7fa78e65 | ||
|
|
4032570d97 | ||
|
|
90644a3017 | ||
|
|
4f6bffb477 | ||
|
|
158f902c3b | ||
|
|
6dc25ddc6e | ||
|
|
7f6aaeaecf | ||
|
|
ace439910e | ||
|
|
7f038568de | ||
|
|
af777c0b6a | ||
|
|
fc299032a4 | ||
|
|
e0f3f07907 | ||
|
|
b36df9cf9e | ||
|
|
81c3f780d4 | ||
|
|
b51efdd3e3 | ||
|
|
610b769df9 | ||
|
|
527f4d0101 | ||
|
|
8d9be43c60 | ||
|
|
40ef4f0bbe | ||
|
|
d0271d5049 | ||
|
|
5becfcf8ea | ||
|
|
112e8d6c18 | ||
|
|
1d8d49a01d | ||
|
|
5050155685 | ||
|
|
a9bd494cc0 | ||
|
|
6a4df78bc0 | ||
|
|
530eae3898 | ||
|
|
3e444f6a90 | ||
|
|
45dbff6401 | ||
|
|
bc56b8e058 | ||
|
|
d86e315c48 | ||
|
|
746969207a | ||
|
|
1caebaefb5 | ||
|
|
2d10fdcf0f | ||
|
|
355ec70a80 | ||
|
|
a2f499de01 | ||
|
|
f4bca89722 | ||
|
|
9fbc69df3f | ||
|
|
230d301268 | ||
|
|
1ce7b02d94 | ||
|
|
a2d00f5f1d | ||
|
|
f68eaa3b46 | ||
|
|
0199ab220e | ||
|
|
656045610a | ||
|
|
8c1c61f207 | ||
|
|
af085b79dd | ||
|
|
77476965ae | ||
|
|
961c1365f9 | ||
|
|
ca51514046 | ||
|
|
8975b72a01 | ||
|
|
874ec6a87f | ||
|
|
909eaeeead | ||
|
|
c138161fae | ||
|
|
e48590d66c | ||
|
|
5b1c8541fc | ||
|
|
e5e011021b | ||
|
|
11d74dea09 | ||
|
|
cbdf9c88c5 | ||
|
|
46601b1350 | ||
|
|
6f1a40b2ca | ||
|
|
a2b1f54eb2 | ||
|
|
6756016572 | ||
|
|
f42123afc3 | ||
|
|
1425ffd274 | ||
|
|
d700154e0e | ||
|
|
efecf42566 | ||
|
|
74bdfc07fb | ||
|
|
376dfdba1c | ||
|
|
3795d6720f | ||
|
|
537aaf56d7 | ||
|
|
34d51b5d3d | ||
|
|
dea8fcfb5b | ||
|
|
4f1f3b9b51 | ||
|
|
dfeb8812ad | ||
|
|
63e2b4273a | ||
|
|
5790dbc085 | ||
|
|
9e2105e08d | ||
|
|
22582bbd1c | ||
|
|
e5f27b7a12 | ||
|
|
e88ec9822b | ||
|
|
5ffd2f5c96 | ||
|
|
11fdb4c5d8 | ||
|
|
319aff6d09 | ||
|
|
a614fa3400 | ||
|
|
8d691391ac | ||
|
|
0089a84c94 | ||
|
|
90676e1c6a | ||
|
|
062901be43 | ||
|
|
b195d79b50 | ||
|
|
6d7ee98721 | ||
|
|
fc0800ed5d | ||
|
|
f4e3a0e5b2 | ||
|
|
d631c80024 | ||
|
|
f1f0033875 | ||
|
|
84d120e850 | ||
|
|
8159cc6b88 | ||
|
|
995f8c106b | ||
|
|
7cc104b138 | ||
|
|
b3a7299a62 | ||
|
|
0e7a4deaec | ||
|
|
b4d66650bd | ||
|
|
4986afca28 | ||
|
|
2b6004a82b | ||
|
|
04c54a7c31 | ||
|
|
7ae6c5ae87 | ||
|
|
4046766ca5 | ||
|
|
810390df0b | ||
|
|
de749bc7ae | ||
|
|
9965b8800c | ||
|
|
ab870fddd6 | ||
|
|
a79d6807cf | ||
|
|
8185fb7e43 | ||
|
|
4b10929b25 | ||
|
|
f6c70312c9 | ||
|
|
9fd9c7a51f | ||
|
|
422e619978 | ||
|
|
e6e34251c6 | ||
|
|
2d8aad1086 | ||
|
|
74ca736333 | ||
|
|
5e4fd8b0b9 | ||
|
|
8ab8132411 | ||
|
|
6899dd46e4 | ||
|
|
8ad0697a20 | ||
|
|
b47e5672e6 | ||
|
|
45c7bd9a60 | ||
|
|
e7bcb95635 | ||
|
|
3de83627a9 | ||
|
|
f248576994 | ||
|
|
aac5b6de3b | ||
|
|
24435f11e0 | ||
|
|
a9da839c39 | ||
|
|
fa2c0296d6 | ||
|
|
1dfc32d7e6 | ||
|
|
4a61beae41 | ||
|
|
bd30587bf1 | ||
|
|
e0070e3e18 | ||
|
|
019513696b | ||
|
|
ad7a4476db | ||
|
|
4812b20fb2 | ||
|
|
f5e07c9427 | ||
|
|
75dcb90621 | ||
|
|
dfc0434cc2 | ||
|
|
882fc2257c | ||
|
|
41e83b52fc | ||
|
|
47758b4d8f | ||
|
|
6bf1f970a0 | ||
|
|
7d451f101f | ||
|
|
7edbfe0e40 | ||
|
|
91b42cbfa8 | ||
|
|
6907df41b4 | ||
|
|
2cebd90cbd | ||
|
|
376a121aaa | ||
|
|
da11fd17ee | ||
|
|
a40689a0ff | ||
|
|
44a45fc3fb | ||
|
|
ec4bb5359a | ||
|
|
d2217632df | ||
|
|
2cc044feed | ||
|
|
64fd0cb54f | ||
|
|
c5a1d22e81 | ||
|
|
a7b307af04 | ||
|
|
3269eba16c | ||
|
|
d472860e3b | ||
|
|
731c9ea55e | ||
|
|
0b6af8d965 | ||
|
|
92ca9e954c | ||
|
|
67aa00e2c5 | ||
|
|
a1bf161eb7 | ||
|
|
56614fcaa4 | ||
|
|
4d9169e15f | ||
|
|
3a167af2c4 | ||
|
|
64b9005030 | ||
|
|
965de3a235 | ||
|
|
2040ae4856 | ||
|
|
31a1f9f5ea | ||
|
|
7eadd82048 | ||
|
|
31d0eaac8e | ||
|
|
f45d012635 | ||
|
|
5a777ee9bc | ||
|
|
7bbf6bc7f4 | ||
|
|
9bfc45702d | ||
|
|
40aa82ab41 | ||
|
|
5d2c67c62b | ||
|
|
a00ef4836d | ||
|
|
3ef766bb93 | ||
|
|
44b5a18462 | ||
|
|
4df716f0e8 | ||
|
|
fcbf34a4d3 | ||
|
|
c7b8b6e18b | ||
|
|
9fd165bf4b | ||
|
|
2061092ec5 | ||
|
|
57466a31ba | ||
|
|
4213c69bef | ||
|
|
cc5578488a | ||
|
|
4b7135f0e5 | ||
|
|
984df023b1 | ||
|
|
6f8682f558 | ||
|
|
51defa6d66 | ||
|
|
7d73098d6e | ||
|
|
c580aa4683 | ||
|
|
47d1199360 | ||
|
|
61ab435b31 | ||
|
|
aa8f534b45 | ||
|
|
dc9589aca8 | ||
|
|
dd6eaacc6b | ||
|
|
37dc03eec6 | ||
|
|
6b478172f6 | ||
|
|
c6e73bcfd6 | ||
|
|
a2d62938ce | ||
|
|
d7ae1f3cca | ||
|
|
70219581c4 | ||
|
|
f70ac9fb89 | ||
|
|
235b9fbaf0 | ||
|
|
ebda7f42db | ||
|
|
0b04e4b977 | ||
|
|
9498601a37 | ||
|
|
ef5d320e06 | ||
|
|
b00c9a562d | ||
|
|
5372656893 | ||
|
|
571de0e368 | ||
|
|
82cea2fd85 | ||
|
|
aed9814345 | ||
|
|
34fc1f5fd7 | ||
|
|
87c2ed8b27 | ||
|
|
1467d118ab | ||
|
|
922dbe83c3 | ||
|
|
6af7d61ee5 | ||
|
|
bafd08391d | ||
|
|
82ebd8ef1a | ||
|
|
4ed1aa4d23 | ||
|
|
d04e43d46d | ||
|
|
952f0cca15 | ||
|
|
f6a4d8f1f8 | ||
|
|
b3097a2384 | ||
|
|
6d9ddbe98b | ||
|
|
9bb42c0229 | ||
|
|
bd7226b27a | ||
|
|
5b413e3873 | ||
|
|
be5831a629 | ||
|
|
084d2bf8e2 | ||
|
|
da79e6bac7 | ||
|
|
c4831ac00c | ||
|
|
93a954ef9f | ||
|
|
f7ce8f44e9 | ||
|
|
0b012697e5 | ||
|
|
58e357c992 | ||
|
|
71fbad83ad | ||
|
|
52483072dc | ||
|
|
7f0b8621f3 | ||
|
|
cd8db60b06 | ||
|
|
1aa34f5d2e | ||
|
|
dfa1d88ce9 | ||
|
|
dd38519f07 | ||
|
|
098f5d4f0b | ||
|
|
ffc685d536 | ||
|
|
cd1a99a0de | ||
|
|
48e3b267fc | ||
|
|
37ebcadfa1 |
+16
@@ -0,0 +1,16 @@
|
||||
# Coverage isn't really compatible with subprocesses so results are unreliable
|
||||
|
||||
[run]
|
||||
branch = True
|
||||
#concurrency = multiprocessing
|
||||
source = ocrmypdf/
|
||||
|
||||
[report]
|
||||
exclude_lines =
|
||||
pragma: no cover
|
||||
def __repr__
|
||||
raise AssertionError
|
||||
raise NotImplementedError
|
||||
if 0:
|
||||
if False:
|
||||
if __name__ == .__main__.:
|
||||
@@ -1,34 +1,51 @@
|
||||
# OCRmyPDF
|
||||
#
|
||||
# VERSION 4.4.2
|
||||
FROM ubuntu:16.10
|
||||
MAINTAINER James R. Barlow <jim@purplerock.ca>
|
||||
FROM ubuntu:18.04
|
||||
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
software-properties-common python-software-properties \
|
||||
python3-wheel \
|
||||
python3-reportlab \
|
||||
build-essential autoconf automake libtool \
|
||||
libleptonica-dev \
|
||||
zlib1g-dev \
|
||||
libexempi3 \
|
||||
ocrmypdf \
|
||||
pngquant \
|
||||
python3-pip \
|
||||
python3-venv \
|
||||
ghostscript \
|
||||
qpdf \
|
||||
poppler-utils \
|
||||
unpaper \
|
||||
libffi-dev \
|
||||
tesseract-ocr \
|
||||
tesseract-ocr-chi-sim \
|
||||
tesseract-ocr-deu \
|
||||
tesseract-ocr-eng \
|
||||
tesseract-ocr-fra \
|
||||
tesseract-ocr-por \
|
||||
tesseract-ocr-spa \
|
||||
tesseract-ocr-deu
|
||||
unpaper \
|
||||
wget
|
||||
|
||||
|
||||
ENV LANG=C.UTF-8
|
||||
|
||||
# Compile and install jbig2
|
||||
# Needs libleptonica-dev, zlib1g-dev
|
||||
RUN \
|
||||
mkdir jbig2 \
|
||||
&& wget -q https://github.com/agl/jbig2enc/archive/0.29.tar.gz -O - | \
|
||||
tar xz -C jbig2 --strip-components=1 \
|
||||
&& cd jbig2 \
|
||||
&& ./autogen.sh && ./configure && make && make install \
|
||||
&& cd .. \
|
||||
&& rm -rf jbig2
|
||||
|
||||
RUN apt-get remove -y autoconf automake libtool
|
||||
|
||||
RUN python3 -m venv --system-site-packages /appenv
|
||||
|
||||
# This installs the latest binary wheel instead of the code in the current
|
||||
# folder. Installing from source will fail, apparently because cffi needs
|
||||
# build-essentials (gcc) to do a source installation
|
||||
# build-essentials (gcc) to do a source installation
|
||||
# (i.e. "pip install ."). It's unclear to me why this is the case.
|
||||
RUN . /appenv/bin/activate; \
|
||||
pip install --upgrade pip \
|
||||
&& pip install ocrmypdf
|
||||
&& pip install --upgrade ocrmypdf
|
||||
|
||||
# Now copy the application in, mainly to get the test suite.
|
||||
# Do this now to make the best use of Docker cache.
|
||||
@@ -39,6 +56,7 @@ RUN . /appenv/bin/activate; \
|
||||
# Remove the junk, including the source version of application since it was
|
||||
# already installed
|
||||
RUN rm -rf /tmp/* /var/tmp/* /root/* /application/ocrmypdf \
|
||||
&& apt-get remove -y build-essential \
|
||||
&& apt-get autoremove -y \
|
||||
&& apt-get autoclean -y
|
||||
|
||||
@@ -51,4 +69,4 @@ WORKDIR /home/docker
|
||||
|
||||
# Must use array form of ENTRYPOINT
|
||||
# Non-array form does not append other arguments, because that is "intuitive"
|
||||
ENTRYPOINT ["/application/docker-wrapper.sh"]
|
||||
ENTRYPOINT ["/application/.docker/docker-wrapper.sh"]
|
||||
@@ -1,8 +1,6 @@
|
||||
# OCRmyPDF polyglot
|
||||
#
|
||||
# VERSION 4.4.2
|
||||
FROM jbarlow83/ocrmypdf:latest
|
||||
MAINTAINER James R. Barlow <jim@purplerock.ca>
|
||||
|
||||
USER root
|
||||
|
||||
@@ -16,4 +14,4 @@ USER docker
|
||||
|
||||
# Must use array form of ENTRYPOINT
|
||||
# Non-array form does not append other arguments, because that is "intuitive"
|
||||
ENTRYPOINT ["/application/docker-wrapper.sh"]
|
||||
ENTRYPOINT ["/application/.docker/docker-wrapper.sh"]
|
||||
+3
-12
@@ -3,18 +3,9 @@
|
||||
*.pyc
|
||||
*.rst
|
||||
*.sublime*
|
||||
*/*.pyc
|
||||
*/*/*.pyc
|
||||
*/*/*/*.pyc
|
||||
*/*/*/*/*.pyc
|
||||
*/*/*/*/*/*.pyc
|
||||
*/*/*/*/*/*/*.pyc
|
||||
*/*/*/*/*/*/*/*.pyc
|
||||
.cache/
|
||||
.eggs/
|
||||
.github/
|
||||
.git/
|
||||
.ipynb_checkpoints/
|
||||
**/*.pyc
|
||||
.*/
|
||||
!.docker/
|
||||
.ruffus_history.sqlite
|
||||
bin/
|
||||
build/
|
||||
|
||||
+1
-1
@@ -8,6 +8,6 @@
|
||||
*.PDF binary
|
||||
*.png binary
|
||||
*.jpg binary
|
||||
|
||||
*.bin binary
|
||||
|
||||
.git_archival.txt export-subst
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
Please include the command line and (if needed) a test file with your issue report.
|
||||
Please include the command line and a test file with your issue report.
|
||||
|
||||
If possible, please use a test file that we can include in future test cases (no personal information, no copyrighted material).
|
||||
|
||||
If you wish to encrypt a test file for the OCRmyPDF maintainer only, see the [Wiki](https://github.com/jbarlow83/OCRmyPDF/wiki).
|
||||
|
||||
+14
-15
@@ -1,41 +1,40 @@
|
||||
# Development environment
|
||||
.bash_history
|
||||
.pylintrc
|
||||
.pytest_cache/
|
||||
.ruffus_history.sqlite
|
||||
.venv/
|
||||
*.pyc
|
||||
*.sublime-*
|
||||
venv*/
|
||||
pyvenv.cfg
|
||||
tasks.py
|
||||
.bash_history
|
||||
.ruffus_history.sqlite
|
||||
.idea/
|
||||
|
||||
# Package building
|
||||
*.egg-info/
|
||||
.cache/
|
||||
.eggs/
|
||||
*.egg-info/
|
||||
build/
|
||||
dist/
|
||||
wheelhouse/
|
||||
|
||||
# Automatically generated files
|
||||
ocrmypdf/lib/_*.py
|
||||
ocrmypdf/version.py
|
||||
docs/_build/
|
||||
docs/_static/
|
||||
docs/_templates/
|
||||
docs/Makefile
|
||||
ocrmypdf/lib/_*.py
|
||||
|
||||
# Code coverage
|
||||
.coverage
|
||||
htmlcov/
|
||||
|
||||
# Testing
|
||||
log/
|
||||
.ipynb_checkpoints/
|
||||
.vscode/
|
||||
*.ipynb
|
||||
*.profile
|
||||
/*.pdf
|
||||
/*.qdf
|
||||
*.ipynb
|
||||
.ipynb_checkpoints/
|
||||
tests/cache/
|
||||
/scratch.py
|
||||
IDEAS
|
||||
log/
|
||||
tests/output/
|
||||
tests/resources/private/
|
||||
tmp/
|
||||
pdfbox-app*.jar
|
||||
+73
-50
@@ -1,50 +1,104 @@
|
||||
dist: trusty
|
||||
language: python
|
||||
cache:
|
||||
pip: true
|
||||
directories:
|
||||
- packages
|
||||
- tests/cache
|
||||
- $HOME/Library/Caches/Homebrew
|
||||
|
||||
env:
|
||||
global:
|
||||
- secure: "oyX5xesoHD7qcDXKIxMyGZPi+H/WxcvfFkaviEmq84K1DDyHk48+9e92IKgrw8/lcTADnEo/AgVKfnhCPflFimk1xTkgaK4sUg1WLI2YjmaHcwl5SlBHa2rN3uGBwy1hyP92qyv/mMc9R59NtRJ8u76lbn6eN9wi7lkFWdE6BTw=" # DOCKERHUB_OCRMYPDF_TOKEN
|
||||
- secure: "WlyII8YLsiUUyLtEA563GvEZmbneDb/T8q/P1uNbyQ2ps1U82tH0nSUV2CspSMxOFtZzPHCrRvnAmuTYKshBj+GNnBb1J9FKQmFwF+4NPeqsFdUkQ1NeeCmfIRShuNC3Otg2GGwj4Zssdg+QnVy43t2L11qizzfY+lY+MVzAYcM=" # DOCKERHUB_OCRMYPDF_TESS4_TOKEN
|
||||
- secure: "hsf6MT+n2x3OiDM2fQyJZdV0/PWYmv81LdVqC6cfnHBE/8N3DloJRqQ7WfO14TxhiK9PEC7MpyCj0lSabUHEO7gSH6Vks6I1asoSkt8S9/bSMlhT4hei+pwVpeGEiU5xHVATNjY+D919VC3IFvc3XmjT74h/2SLhaZ+jhEmDggM=" # HOMEBREW_OCRMYPDF_TOKEN
|
||||
|
||||
matrix:
|
||||
include:
|
||||
- os: linux
|
||||
dist: trusty
|
||||
sudo: required
|
||||
language: python
|
||||
python: 3.5
|
||||
python: "3.5"
|
||||
env:
|
||||
- DIST=trusty
|
||||
addons: &trusty_apt
|
||||
apt:
|
||||
update: true
|
||||
sources:
|
||||
- sourceline: 'ppa:alex-p/tesseract-ocr'
|
||||
- sourceline: 'ppa:heyarje/libav-11'
|
||||
- sourceline: 'ppa:vshn/ghostscript'
|
||||
packages:
|
||||
- ghostscript
|
||||
- libavcodec56
|
||||
- libavformat56
|
||||
- libavutil54
|
||||
- libexempi3
|
||||
- libffi-dev
|
||||
- pngquant
|
||||
- poppler-utils
|
||||
- qpdf
|
||||
- tesseract-ocr
|
||||
- tesseract-ocr-deu
|
||||
- tesseract-ocr-eng
|
||||
- tesseract-ocr-fra
|
||||
- os: linux
|
||||
dist: trusty
|
||||
sudo: required
|
||||
language: python
|
||||
python: 3.6
|
||||
python: "3.6"
|
||||
env:
|
||||
- DIST=trusty
|
||||
addons: *trusty_apt
|
||||
- os: linux
|
||||
dist: xenial
|
||||
sudo: required
|
||||
language: python
|
||||
python: "3.7"
|
||||
env:
|
||||
- DIST=xenial
|
||||
addons:
|
||||
apt:
|
||||
update: true
|
||||
sources:
|
||||
- sourceline: 'ppa:alex-p/tesseract-ocr'
|
||||
packages:
|
||||
- ghostscript
|
||||
- libexempi3
|
||||
- libffi-dev
|
||||
- pngquant
|
||||
- poppler-utils
|
||||
- qpdf
|
||||
- tesseract-ocr
|
||||
- tesseract-ocr-deu
|
||||
- tesseract-ocr-eng
|
||||
- tesseract-ocr-fra
|
||||
- unpaper
|
||||
- os: osx
|
||||
osx_image: xcode8
|
||||
osx_image: xcode9.2
|
||||
language: generic
|
||||
|
||||
before_cache:
|
||||
- rm -f $HOME/.cache/pip/log/debug.log
|
||||
|
||||
before_install: |
|
||||
mkdir -p bin
|
||||
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
|
||||
bash .travis/linux_before_install.sh
|
||||
pip3 install --upgrade pip
|
||||
pip3 install --upgrade wheel
|
||||
if [[ "$DIST" == "trusty" ]]; then
|
||||
mkdir -p packages
|
||||
wget -q 'https://www.dropbox.com/s/vaq0kbwi6e6au80/unpaper_6.1-1.deb?raw=1' -O packages/unpaper_6.1-1.deb
|
||||
sudo dpkg -i packages/unpaper_6.1-1.deb
|
||||
fi
|
||||
elif [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
|
||||
bash .travis/osx_before_install.sh
|
||||
brew update --quiet && brew bundle --file=.travis/Brewfile --quiet
|
||||
pip3 install --upgrade pip
|
||||
pip3 install wheel
|
||||
fi
|
||||
|
||||
install:
|
||||
- pip3 install .
|
||||
- pip3 install -r requirements.txt -r test_requirements.txt
|
||||
- export PATH=$PWD/bin:$PATH
|
||||
- pip3 install pycparser # py3.7 workaround for https://github.com/eliben/pycparser/issues/251
|
||||
- pip3 install -r requirements.txt
|
||||
- pip3 install --no-deps .
|
||||
- pip3 install -r test_requirements.txt
|
||||
|
||||
script:
|
||||
- mv ocrmypdf dont_import_this_ocrmypdf
|
||||
- tesseract --version
|
||||
- qpdf --version
|
||||
- pytest -n auto
|
||||
- mv dont_import_this_ocrmypdf ocrmypdf
|
||||
|
||||
deploy:
|
||||
# release for main pypi
|
||||
@@ -53,7 +107,6 @@ deploy:
|
||||
# OTOH if we ever need separate binary wheels then each version needs its
|
||||
# own deploy
|
||||
- provider: pypi
|
||||
server: https://upload.pypi.org/legacy/
|
||||
user: ocrmypdf-travis
|
||||
password:
|
||||
secure: "DTFOmmNL6olA0+yXvp4u9jXZlZeqrJsJ0526jzqf4a3gZ6jnGTq5UI6WzRsslSyoMMfXKtHQebqHM6ogSgCZinyZ3ufHJo8fn9brxbEc2gsiWkbj5o3bGwdWMT1vNNE7XW0VCpw87rZ1EEwjl4FJHFudMlPR1yfU5+uq0k0PACo="
|
||||
@@ -63,33 +116,3 @@ deploy:
|
||||
tags: true
|
||||
condition: $TRAVIS_PYTHON_VERSION == "3.6" && $TRAVIS_OS_NAME == "linux"
|
||||
skip_upload_docs: true
|
||||
|
||||
# test pypi
|
||||
- provider: pypi
|
||||
server: https://testpypi.pypi.org/legacy/
|
||||
user: ocrmypdf-travis
|
||||
password:
|
||||
secure: "DTFOmmNL6olA0+yXvp4u9jXZlZeqrJsJ0526jzqf4a3gZ6jnGTq5UI6WzRsslSyoMMfXKtHQebqHM6ogSgCZinyZ3ufHJo8fn9brxbEc2gsiWkbj5o3bGwdWMT1vNNE7XW0VCpw87rZ1EEwjl4FJHFudMlPR1yfU5+uq0k0PACo="
|
||||
distributions: "sdist"
|
||||
on:
|
||||
branch: develop
|
||||
tags: false
|
||||
condition: $TRAVIS_OS_NAME == "osx"
|
||||
skip_upload_docs: true
|
||||
|
||||
# null deploy for osx
|
||||
# we really just want to run after_deploy *after* pypi upload is done, but
|
||||
# after_deploy on runs if a given box deployed
|
||||
- provider: script
|
||||
script: /usr/bin/true
|
||||
on:
|
||||
branch: master
|
||||
condition: $TRAVIS_OS_NAME == "osx"
|
||||
|
||||
after_deploy: |
|
||||
if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
|
||||
bash .travis/osx_brew.sh
|
||||
elif [[ "$TRAVIS_PYTHON_VERSION" == "3.6" && "$TRAVIS_OS_NAME" == "linux" ]]; then
|
||||
curl -H "Content-Type: application/json" --data '{"build": true}' -X POST https://registry.hub.docker.com/u/jbarlow83/ocrmypdf/trigger/$DOCKERHUB_OCRMYPDF_TOKEN/
|
||||
curl -H "Content-Type: application/json" --data '{"build": true}' -X POST https://registry.hub.docker.com/u/jbarlow83/ocrmypdf-tess4/trigger/$DOCKERHUB_OCRMYPDF_TESS4_TOKEN/
|
||||
fi
|
||||
@@ -0,0 +1,11 @@
|
||||
brew 'python'
|
||||
|
||||
brew 'exempi'
|
||||
brew 'ghostscript'
|
||||
brew 'jbig2enc'
|
||||
brew 'leptonica'
|
||||
brew 'openjpeg'
|
||||
brew 'pngquant'
|
||||
brew 'qpdf'
|
||||
brew 'tesseract'
|
||||
brew 'unpaper'
|
||||
@@ -1,80 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
# © 2016 James R. Barlow: github.com/jbarlow83
|
||||
|
||||
from string import Template
|
||||
from subprocess import run, PIPE
|
||||
import re
|
||||
|
||||
recipe_template = Template("""
|
||||
class Ocrmypdf < Formula
|
||||
include Language::Python::Virtualenv
|
||||
|
||||
desc "Adds an OCR text layer to scanned PDF files"
|
||||
homepage "https://github.com/jbarlow83/OCRmyPDF"
|
||||
${ocrmypdf_url}
|
||||
${ocrmypdf_sha256}
|
||||
|
||||
depends_on :python3
|
||||
depends_on :x11 # Pillow needs XQuartz
|
||||
depends_on "pkg-config" => :build
|
||||
depends_on "libffi"
|
||||
depends_on "tesseract"
|
||||
depends_on "ghostscript"
|
||||
depends_on "unpaper"
|
||||
depends_on "qpdf"
|
||||
|
||||
# For Pillow source install
|
||||
depends_on "openjpeg"
|
||||
depends_on "freetype"
|
||||
depends_on "libpng"
|
||||
depends_on "libjpeg"
|
||||
depends_on "webp"
|
||||
depends_on "little-cms2"
|
||||
|
||||
${resources}
|
||||
def install
|
||||
ENV.append ["SETUPTOOLS_SCM_PRETEND_VERSION"], "v${ocrmypdf_version}"
|
||||
ENV.each do |key, value|
|
||||
puts "#{key}:#{value}"
|
||||
end
|
||||
virtualenv_install_with_resources
|
||||
end
|
||||
|
||||
test do
|
||||
# `test do` will create, run in and delete a temporary directory.
|
||||
#
|
||||
# The installed folder is not in the path, so use the entire path to any
|
||||
# executables being tested: `system "#{bin}/program", "do", "something"`.
|
||||
system "#{bin}/ocrmypdf", "--version"
|
||||
end
|
||||
end
|
||||
""")
|
||||
|
||||
def main():
|
||||
p = run(['poet', '--single', 'ocrmypdf'],
|
||||
encoding='utf-8', stdout=PIPE, check=True)
|
||||
|
||||
ocrmypdf_lines = p.stdout.splitlines()
|
||||
ocrmypdf_url = ocrmypdf_lines[1].strip()
|
||||
ocrmypdf_sha256 = ocrmypdf_lines[2].strip()
|
||||
|
||||
ocrmypdf_version = re.search(
|
||||
r'ocrmypdf-(.+)\.tar.*', ocrmypdf_url).group(1)
|
||||
print(f"Autobrewing {ocrmypdf_version}")
|
||||
|
||||
p = run(['poet', '--resources', 'ocrmypdf'],
|
||||
encoding='utf-8', stdout=PIPE, check=True)
|
||||
|
||||
poet_resources = p.stdout
|
||||
|
||||
# Remove the duplicate "ocrmypdf" resource block
|
||||
all_resources = poet_resources.split('resource')
|
||||
kept_resources = [block for block in all_resources if 'ocrmypdf' not in block]
|
||||
resources = 'resource'.join(kept_resources)
|
||||
|
||||
with open('ocrmypdf.rb', 'w') as out:
|
||||
out.write(recipe_template.substitute(**locals()))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
@@ -1,31 +0,0 @@
|
||||
#!/bin/bash
|
||||
# © 2017 James R. Barlow: github.com/jbarlow83
|
||||
set -euo pipefail
|
||||
set -x
|
||||
|
||||
sudo add-apt-repository ppa:vshn/ghostscript -y
|
||||
sudo add-apt-repository ppa:heyarje/libav-11 -y
|
||||
sudo apt-get update -qq
|
||||
sudo apt-get install -y \
|
||||
ghostscript \
|
||||
qpdf \
|
||||
poppler-utils \
|
||||
libavformat56 \
|
||||
libavcodec56 \
|
||||
libavutil54 \
|
||||
libffi-dev
|
||||
|
||||
sudo add-apt-repository ppa:alex-p/tesseract-ocr -y
|
||||
|
||||
sudo apt-get update
|
||||
sudo apt-get autoremove -y
|
||||
sudo apt-get install -y --no-install-recommends \
|
||||
tesseract-ocr \
|
||||
tesseract-ocr-eng \
|
||||
tesseract-ocr-fra \
|
||||
tesseract-ocr-deu
|
||||
|
||||
pip install --upgrade pip
|
||||
mkdir -p packages
|
||||
[ -f packages/unpaper_6.1-1.deb ] || wget -q 'https://www.dropbox.com/s/vaq0kbwi6e6au80/unpaper_6.1-1.deb?raw=1' -O packages/unpaper_6.1-1.deb
|
||||
sudo dpkg -i packages/unpaper_6.1-1.deb
|
||||
@@ -1,17 +0,0 @@
|
||||
#!/bin/bash
|
||||
# © 2017 James R. Barlow: github.com/jbarlow83
|
||||
set -euo pipefail
|
||||
set -x
|
||||
|
||||
brew update
|
||||
|
||||
brew install openjpeg jbig2dec libtiff # image libraries
|
||||
brew install qpdf
|
||||
brew install ghostscript
|
||||
brew install python3
|
||||
brew install libxml2 libffi leptonica
|
||||
brew install unpaper # optional
|
||||
brew install tesseract
|
||||
|
||||
pip3 install --upgrade pip
|
||||
pip3 install wheel
|
||||
@@ -1,21 +0,0 @@
|
||||
#!/bin/bash
|
||||
# © 2017 James R. Barlow: github.com/jbarlow83
|
||||
set -euo pipefail
|
||||
set -x
|
||||
|
||||
pip3 install homebrew-pypi-poet
|
||||
python3 .travis/autobrew.py
|
||||
cat ocrmypdf.rb
|
||||
brew audit ocrmypdf.rb
|
||||
|
||||
# Important: disable debug output so token is hidden
|
||||
set +x
|
||||
git clone https://$HOMEBREW_OCRMYPDF_TOKEN@github.com/jbarlow83/homebrew-ocrmypdf.git
|
||||
set -x
|
||||
|
||||
pushd homebrew-ocrmypdf
|
||||
cp ../ocrmypdf.rb Formula/ocrmypdf.rb
|
||||
git add Formula/ocrmypdf.rb
|
||||
git commit -m "homebrew-ocrmypdf: automatic release $TRAVIS_BUILD_NUMBER $TRAVIS_TAG"
|
||||
git push origin master
|
||||
popd
|
||||
@@ -1,64 +0,0 @@
|
||||
# OCRmyPDF
|
||||
#
|
||||
# VERSION 4.4.2
|
||||
FROM ubuntu:16.10
|
||||
MAINTAINER James R. Barlow <jim@purplerock.ca>
|
||||
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
software-properties-common python-software-properties \
|
||||
python3-wheel \
|
||||
python3-reportlab \
|
||||
python3-venv \
|
||||
ghostscript \
|
||||
qpdf \
|
||||
poppler-utils \
|
||||
unpaper \
|
||||
libffi-dev
|
||||
|
||||
RUN add-apt-repository ppa:alex-p/tesseract-ocr
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get autoremove -y \
|
||||
&& apt-get install -y --no-install-recommends \
|
||||
tesseract-ocr \
|
||||
tesseract-ocr-eng \
|
||||
tesseract-ocr-fra \
|
||||
tesseract-ocr-deu \
|
||||
tesseract-ocr-spa \
|
||||
tesseract-ocr-por \
|
||||
tesseract-ocr-ara \
|
||||
tesseract-ocr-rus \
|
||||
tesseract-ocr-chi-sim
|
||||
|
||||
RUN python3 -m venv --system-site-packages /appenv
|
||||
|
||||
# This installs the latest binary wheel instead of the code in the current
|
||||
# folder. Installing from source will fail, apparently because cffi needs
|
||||
# build-essentials (gcc) to do a source installation
|
||||
# (i.e. "pip install ."). It's unclear to me why this is the case.
|
||||
RUN . /appenv/bin/activate; \
|
||||
pip install --upgrade pip \
|
||||
&& pip install ocrmypdf
|
||||
|
||||
# Now copy the application in, mainly to get the test suite.
|
||||
# Do this now to make the best use of Docker cache.
|
||||
COPY . /application
|
||||
RUN . /appenv/bin/activate; \
|
||||
pip install -r /application/test_requirements.txt
|
||||
|
||||
# Remove the junk, including the source version of application since it was
|
||||
# already installed
|
||||
RUN rm -rf /tmp/* /var/tmp/* /root/* /application/ocrmypdf \
|
||||
&& apt-get autoremove -y \
|
||||
&& apt-get autoclean -y
|
||||
|
||||
RUN useradd docker \
|
||||
&& mkdir /home/docker \
|
||||
&& chown docker:docker /home/docker
|
||||
|
||||
USER docker
|
||||
WORKDIR /home/docker
|
||||
|
||||
# Must use array form of ENTRYPOINT
|
||||
# Non-array form does not append other arguments, because that is "intuitive"
|
||||
ENTRYPOINT ["/application/docker-wrapper.sh"]
|
||||
@@ -0,0 +1,674 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<https://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
||||
-20
@@ -1,20 +0,0 @@
|
||||
Copyright (c) 2013-2016, The OCRmyPDF Authors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included
|
||||
in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
+10
-9
@@ -7,26 +7,25 @@ include dev_requirements.txt
|
||||
include .git_archival.txt
|
||||
|
||||
# docker
|
||||
include Dockerfile
|
||||
include Dockerfile.polyglot
|
||||
include .dockerignore
|
||||
recursive-include .docker *
|
||||
|
||||
# tests
|
||||
include pytest.ini
|
||||
include .coveragerc
|
||||
recursive-include tests *.jpg
|
||||
recursive-include tests *.png
|
||||
recursive-include tests *.pdf
|
||||
recursive-include tests *.py
|
||||
recursive-include tests *.rst
|
||||
recursive-include tests *.txt
|
||||
recursive-include tests/cache *
|
||||
recursive-exclude tests/output *
|
||||
recursive-exclude tests/output_pageinfo *
|
||||
recursive-exclude tests/resources/private *
|
||||
recursive-exclude tests/cache *
|
||||
|
||||
# documentation
|
||||
include LICENSE
|
||||
include *.rst
|
||||
include pipeline.svg
|
||||
recursive-exclude .github *
|
||||
recursive-include docs *.py
|
||||
recursive-include docs *.rst
|
||||
@@ -35,14 +34,16 @@ recursive-exclude docs/_build *
|
||||
|
||||
|
||||
# support files
|
||||
recursive-include ocrmypdf/data *
|
||||
recursive-include src/ocrmypdf/data *
|
||||
include *.py
|
||||
exclude tasks.py
|
||||
recursive-exclude .travis *
|
||||
exclude .travis*
|
||||
|
||||
|
||||
# code
|
||||
recursive-include ocrmypdf *.py
|
||||
recursive-include src/ocrmypdf *.py
|
||||
exclude ocrmypdf/lib/_leptonica.py
|
||||
include OCRmyPDF.sh
|
||||
include docker-wrapper.sh
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,132 @@
|
||||
OCRmyPDF
|
||||
========
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
OCRmyPDF adds an OCR text layer to scanned PDF files, allowing them to be searched or copy-pasted.
|
||||
|
||||
```bash
|
||||
ocrmypdf # it's a scriptable command line program
|
||||
-l eng+fra # it supports multiple languages
|
||||
--rotate-pages # it can fix pages that are misrotated
|
||||
--deskew # it can deskew crooked PDFs!
|
||||
--title "My PDF" # it can change output metadata
|
||||
--jobs 4 # it uses multiple cores by default
|
||||
--output-type pdfa # it produces PDF/A by default
|
||||
input_scanned.pdf # takes PDF input (or images)
|
||||
output_searchable.pdf # produces validated PDF output
|
||||
```
|
||||
|
||||
Main features
|
||||
-------------
|
||||
|
||||
- Generates a searchable [PDF/A](https://en.wikipedia.org/?title=PDF/A) file from a regular PDF
|
||||
- Places OCR text accurately below the image to ease copy / paste
|
||||
- Keeps the exact resolution of the original embedded images
|
||||
- When possible, inserts OCR information as a "lossless" operation without disrupting any other content
|
||||
- Optimizes PDF images, often producing files smaller than the input file
|
||||
- If requested deskews and/or cleans the image before performing OCR
|
||||
- Validates input and output files
|
||||
- Distributes work across all available CPU cores
|
||||
- Uses [Tesseract OCR](https://github.com/tesseract-ocr/tesseract) engine
|
||||
- Supports more than [100 languages](https://github.com/tesseract-ocr/tessdata) recognized by Tesseract
|
||||
- Battle-tested on thousands of PDFs, a test suite and continuous integration
|
||||
|
||||
For details: please consult the [documentation](https://ocrmypdf.readthedocs.io/en/latest/).
|
||||
|
||||
Motivation
|
||||
----------
|
||||
|
||||
I searched the web for a free command line tool to OCR PDF files on Linux/UNIX: I found many, but none of them were really satisfying.
|
||||
|
||||
- Either they produced PDF files with misplaced text under the image (making copy/paste impossible)
|
||||
- Or they did not handle accents and multilingual characters
|
||||
- Or they changed the resolution of the embedded images
|
||||
- Or they generated ridiculously large PDF files
|
||||
- Or they crashed when trying to OCR
|
||||
- Or they did not produce valid PDF files
|
||||
- On top of that none of them produced PDF/A files (format dedicated for long time storage)
|
||||
|
||||
...so I decided to develop my own tool.
|
||||
|
||||
Installation
|
||||
------------
|
||||
|
||||
Linux, UNIX, and macOS are supported. Windows is not directly supported but there is a Docker image available that runs on Windows.
|
||||
|
||||
Users of Debian 9 or later or Ubuntu 16.10 or later may simply
|
||||
|
||||
```bash
|
||||
apt-get install ocrmypdf
|
||||
```
|
||||
|
||||
and macOS users with Homebrew may simply
|
||||
|
||||
```bash
|
||||
brew install ocrmypdf
|
||||
```
|
||||
|
||||
For everyone else, [see our documentation](https://ocrmypdf.readthedocs.io/en/latest/installation.html) for installation steps.
|
||||
|
||||
Languages
|
||||
---------
|
||||
|
||||
OCRmyPDF uses Tesseract for OCR, and relies on its language packs. For Linux users, you can often find packages that provide language packs:
|
||||
|
||||
```bash
|
||||
# Display a list of all Tesseract language packs
|
||||
apt-cache search tesseract-ocr
|
||||
|
||||
# Debian/Ubuntu users
|
||||
apt-get install tesseract-ocr-chi-sim # Example: Install Chinese Simplified language back
|
||||
```
|
||||
|
||||
You can then pass the `-l LANG` argument to OCRmyPDF to give a hint as to what languages it should search for. Multiple languages can be requested.
|
||||
|
||||
Documentation and support
|
||||
-------------------------
|
||||
|
||||
Once ocrmypdf is installed, the built-in help which explains the command syntax and options can be accessed via:
|
||||
|
||||
```bash
|
||||
ocrmypdf --help
|
||||
```
|
||||
|
||||
Our [documentation is served on Read the Docs](https://ocrmypdf.readthedocs.io/en/latest/index.html).
|
||||
|
||||
If you detect an issue, please:
|
||||
|
||||
- Check whether your issue is already known
|
||||
- If no problem report exists on github, please create one here: <https://github.com/jbarlow83/OCRmyPDF/issues>
|
||||
- Describe your problem thoroughly
|
||||
- Append the console output of the script when running the debug mode (`-v 1` option)
|
||||
- If possible provide your input PDF file as well as the content of the temporary folder (using a file sharing service like Dropbox)
|
||||
|
||||
Requirements
|
||||
------------
|
||||
|
||||
Runs on CPython 3.5, 3.6 and 3.7. Requires external program installations of Ghostscript, Tesseract OCR, QPDF, and Leptonica. ocrmypdf is pure Python, but uses CFFI to portably generate library bindings.
|
||||
|
||||
Press & Media
|
||||
-------------
|
||||
|
||||
- [c't 1-2014, page 59](http://heise.de/-2279695): Detailed presentation of OCRmyPDF v1.0 in the leading German IT magazine c't
|
||||
- [heise Open Source, 09/2014: Texterkennung mit OCRmyPDF](http://heise.de/-2356670)
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
The OCRmyPDF software is licensed under the GNU GPLv3. Certain files are covered by other licenses, as noted in their source files.
|
||||
|
||||
The license for each test file varies, and is noted in tests/resources/README.rst. The documentation is licensed under Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA 4.0).
|
||||
|
||||
OCRmyPDF versions prior to 6.0 were licensed under the MIT License.
|
||||
|
||||
Disclaimer
|
||||
----------
|
||||
|
||||
The software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
-132
@@ -1,132 +0,0 @@
|
||||
OCRmyPDF
|
||||
========
|
||||
|
||||
.. image:: https://travis-ci.org/jbarlow83/OCRmyPDF.svg?branch=master
|
||||
:target: https://travis-ci.org/jbarlow83/OCRmyPDF
|
||||
|
||||
OCRmyPDF adds an OCR text layer to scanned PDF files, allowing them to
|
||||
be searched or copy-pasted.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
ocrmypdf # it's a scriptable command line program
|
||||
-l eng+fra # it supports multiple languages
|
||||
--rotate-pages # it can fix pages that are misrotated
|
||||
--deskew # it can deskew crooked PDFs!
|
||||
--title "My PDF" # it can change output metadata
|
||||
--jobs 4 # it uses multiple cores by default
|
||||
--output-type pdfa # it produces PDF/A by default
|
||||
input_scanned.pdf # takes PDF input (or images)
|
||||
output_searchable.pdf # produces validated PDF output
|
||||
|
||||
|
||||
Main features
|
||||
-------------
|
||||
|
||||
- Generates a searchable
|
||||
`PDF/A <https://en.wikipedia.org/?title=PDF/A>`_ file from a regular PDF
|
||||
- Places OCR text accurately below the image to ease copy / paste
|
||||
- Keeps the exact resolution of the original embedded images
|
||||
- When possible, inserts OCR information as a "lossless" operation without rendering vector information
|
||||
- Keeps file size about the same
|
||||
- If requested deskews and/or cleans the image before performing OCR
|
||||
- Validates input and output files
|
||||
- Provides debug mode to enable easy verification of the OCR results
|
||||
- Processes pages in parallel when more than one CPU core is
|
||||
available
|
||||
- Uses `Tesseract OCR <https://github.com/tesseract-ocr/tesseract>`_ engine
|
||||
- Supports more than `100 languages <https://github.com/tesseract-ocr/tessdata>`_ recognized by Tesseract
|
||||
- Battle-tested on thousands of PDFs, a test suite and continuous integration
|
||||
|
||||
For details: please consult the `documentation <https://ocrmypdf.readthedocs.io/en/latest/>`_.
|
||||
|
||||
Motivation
|
||||
----------
|
||||
|
||||
I searched the web for a free command line tool to OCR PDF files on
|
||||
Linux/UNIX: I found many, but none of them were really satisfying.
|
||||
|
||||
- Either they produced PDF files with misplaced text under the image (making copy/paste impossible)
|
||||
- Or they did not handle accents and multilingual characters
|
||||
- Or they changed the resolution of the embedded images
|
||||
- Or they generated ridiculously large PDF files
|
||||
- Or they crashed when trying to OCR some of my PDF files
|
||||
- Or they did not produce valid PDF files (even though they were readable with my current PDF reader)
|
||||
- On top of that none of them produced PDF/A files (format dedicated for long time storage)
|
||||
|
||||
...so I decided to develop my own tool (using various existing scripts
|
||||
as an inspiration).
|
||||
|
||||
Installation
|
||||
------------
|
||||
|
||||
Linux, UNIX, and macOS are supported. Windows is not directly supported but there is a Docker image available that runs on Windows.
|
||||
|
||||
Users of Debian 9 or later or Ubuntu 16.10 or later may simply
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
apt-get install ocrmypdf
|
||||
|
||||
and macOS users may simply
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
brew tap jbarlow83/ocrmypdf
|
||||
brew install ocrmypdf
|
||||
|
||||
For everyone else, `see our documentation <https://ocrmypdf.readthedocs.io/en/latest/installation.html>`_ for installation steps.
|
||||
|
||||
Languages
|
||||
---------
|
||||
|
||||
OCRmyPDF uses Tesseract for OCR, and relies on its language packs. For Linux users,
|
||||
you can often find packages that provide language packs:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
# Display a list of all Tesseract language packs
|
||||
apt-cache search tesseract-ocr
|
||||
|
||||
# Debian/Ubuntu users
|
||||
apt-get install tesseract-ocr-chi-sim # Example: Install Chinese Simplified language back
|
||||
|
||||
You can then pass the ``-l LANG`` argument to OCRmyPDF to give a hint as to what languages it should search for. Multiple
|
||||
languages can be requested.
|
||||
|
||||
Documentation and support
|
||||
-------------------------
|
||||
|
||||
Once ocrmypdf is installed, the built-in help which explains the command syntax and options can be accessed via:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
ocrmypdf --help
|
||||
|
||||
Our `documentation is served on Read the Docs <https://ocrmypdf.readthedocs.io/en/latest/index.html>`_.
|
||||
|
||||
If you detect an issue, please:
|
||||
|
||||
- Check whether your issue is already known
|
||||
- If no problem report exists on github, please create one here:
|
||||
https://github.com/jbarlow83/OCRmyPDF/issues
|
||||
- Describe your problem thoroughly
|
||||
- Append the console output of the script when running the debug mode
|
||||
(``-v 1`` option)
|
||||
- If possible provide your input PDF file as well as the content of the
|
||||
temporary folder (using a file sharing service like Dropbox)
|
||||
|
||||
Press & Media
|
||||
-------------
|
||||
|
||||
- `c't 1-2014, page 59 <http://heise.de/-2279695>`_:
|
||||
Detailed presentation of OCRmyPDF v1.0 in the leading German IT
|
||||
magazine c't
|
||||
- `heise Open Source, 09/2014: Texterkennung mit
|
||||
OCRmyPDF <http://heise.de/-2356670>`_
|
||||
|
||||
Disclaimer
|
||||
----------
|
||||
|
||||
The software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
||||
CONDITIONS OF ANY KIND, either express or implied.
|
||||
@@ -1,10 +1,4 @@
|
||||
check-manifest >= 0.35
|
||||
twine >= 1.8.1
|
||||
coverage >= 4.4
|
||||
pytest-xdist >= 1.16.0
|
||||
GitPython == 2.1.3
|
||||
|
||||
# Known good versions: 1.11.1
|
||||
# Known broken versions: 1.15.0
|
||||
setuptools-scm == 1.11.1
|
||||
setuptools-scm-git-archive == 1.0
|
||||
|
||||
+92
-23
@@ -9,7 +9,7 @@ OCRmyPDF provides many features to control the behavior of the OCR engine, Tesse
|
||||
When OCR is skipped
|
||||
"""""""""""""""""""
|
||||
|
||||
If a page in a PDF seems to have text, by default OCRmyPDF will exit without modifying the PDF. This is to ensure that PDFs that were previously OCRed or were "born digital" rather than scanned are not processed.
|
||||
If a page in a PDF seems to have text, by default OCRmyPDF will exit without modifying the PDF. This is to ensure that PDFs that were previously OCRed or were "born digital" rather than scanned are not processed.
|
||||
|
||||
If ``--skip-text`` is issued, then no OCR will be performed on pages that already have text. The page will be copied to the output. This may be useful for documents that contain both "born digital" and scanned content, or to use OCRmyPDF to normalize and convert to PDF/A regardless of their contents.
|
||||
|
||||
@@ -19,7 +19,7 @@ If ``--force-ocr`` is issued, then all pages will be rasterized to images, disca
|
||||
Time and image size limits
|
||||
""""""""""""""""""""""""""
|
||||
|
||||
By default, OCRmyPDF permits tesseract to run for only three minutes (180 seconds) per page. This is usually more than enough time to find all text on a reasonably sized page with modern hardware.
|
||||
By default, OCRmyPDF permits tesseract to run for three minutes (180 seconds) per page. This is usually more than enough time to find all text on a reasonably sized page with modern hardware.
|
||||
|
||||
If a page is skipped, it will be inserted without OCR. If preprocessing was requested, the preprocessed image layer will be inserted.
|
||||
|
||||
@@ -27,25 +27,35 @@ If you want to adjust the amount of time spent on OCR, change ``--tesseract-time
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
# Allow 300 seconds for OCR; skip any page larger than 50 megapixels
|
||||
ocrmypdf --tesseract-timeout 300 --skip-big 50 bigfile.pdf output.pdf
|
||||
# Allow 300 seconds for OCR; skip any page larger than 50 megapixels
|
||||
ocrmypdf --tesseract-timeout 300 --skip-big 50 bigfile.pdf output.pdf
|
||||
|
||||
Overriding default tesseract
|
||||
""""""""""""""""""""""""""""
|
||||
|
||||
OCRmyPDF checks the environment variable ``OCRMYPDF_TESSERACT`` for the full path *to the tesseract executable* first.
|
||||
OCRmyPDF checks the system ``PATH`` for the ``tesseract`` binary.
|
||||
|
||||
For example, if you are testing tesseract 4.00 and don't wish to disturb your tesseract 3.04 installation, you can launch OCRmyPDF as follows:
|
||||
Some relevant environment variables that influence Tesseract's behavior include:
|
||||
|
||||
.. envvar:: TESSDATA_PREFIX
|
||||
|
||||
Overrides the path to Tesseract's data files. This can allow simultaneous installation of the "best" and "fast" training data sets. OCRmyPDF does not manage this environment variable.
|
||||
|
||||
.. envvar:: OMP_THREAD_LIMIT
|
||||
|
||||
Controls the number of threads Tesseract will use. OCRmyPDF will manage this environment if it is not already set. (Currently, it will set it to 1 because this gives the best results in testing.)
|
||||
|
||||
For example, if you are testing tesseract 4.00 and don't wish to use an existing tesseract 3.04 installation, you can launch OCRmyPDF as follows:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
env \
|
||||
OCRMYPDF_TESSERACT=/home/user/src/tesseract4/api/tesseract \
|
||||
TESSDATA_PREFIX=/home/user/src/tesseract4 \
|
||||
ocrmypdf --tesseract-oem 2 input.pdf output.pdf
|
||||
env \
|
||||
PATH=/home/user/src/tesseract4/api:$PATH \
|
||||
TESSDATA_PREFIX=/home/user/src/tesseract4 \
|
||||
ocrmypdf --tesseract-oem 2 input.pdf output.pdf
|
||||
|
||||
In this example ``TESSDATA_PREFIX`` directs Tesseract 4.0 to use LSTM training data. ``--tesseract-oem 1`` requests tesseract 4.0's new LSTM engine. (Tesseract 4.0 only.)
|
||||
|
||||
* ``TESSDATA_PREFIX`` directs tesseract 4.0 to use LSTM training data. This is a tesseract environment variable.
|
||||
* ``--tesseract-oem 1`` requests tesseract 4.0's new LSTM engine. (Tesseract 4.0 only.)
|
||||
|
||||
Overriding other support programs
|
||||
"""""""""""""""""""""""""""""""""
|
||||
@@ -56,7 +66,8 @@ In addition to tesseract, OCRmyPDF uses the following external binaries:
|
||||
* ``unpaper``
|
||||
* ``qpdf``
|
||||
|
||||
In each case OCRmyPDF will check the environment variable ``OCRMYPDF_{program}`` before asking the system to find ``{program}`` on the PATH. For example, you could redirect OCRmyPDF to ``OCRMYPDF_GS`` to override Ghostscript.
|
||||
In each case OCRmyPDF will search the ``PATH`` environment variable to locate the binaries.
|
||||
|
||||
|
||||
Changing tesseract configuration variables
|
||||
""""""""""""""""""""""""""""""""""""""""""
|
||||
@@ -69,19 +80,19 @@ Create a file named "no-dict.cfg" with these contents:
|
||||
|
||||
::
|
||||
|
||||
load_system_dawg 0
|
||||
language_model_penalty_non_dict_word 0
|
||||
language_model_penalty_non_freq_dict_word 0
|
||||
load_system_dawg 0
|
||||
language_model_penalty_non_dict_word 0
|
||||
language_model_penalty_non_freq_dict_word 0
|
||||
|
||||
then run ocrmypdf as follows (along with any other desired arguments):
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
ocrmypdf --tesseract-config no-dict.cfg input.pdf output.pdf
|
||||
ocrmypdf --tesseract-config no-dict.cfg input.pdf output.pdf
|
||||
|
||||
.. warning::
|
||||
|
||||
Some combinations of control parameters will break Tesseract or break assumptions that OCRmyPDF makes about Tesseract's output.
|
||||
Some combinations of control parameters will break Tesseract or break assumptions that OCRmyPDF makes about Tesseract's output.
|
||||
|
||||
|
||||
Changing the PDF renderer
|
||||
@@ -94,29 +105,87 @@ rendering
|
||||
Creating a new PDF from other data (such as an existing PDF).
|
||||
|
||||
|
||||
OCRmyPDF has three PDF renderers: ``sandwich``, ``hocr``, ``tesseract``. The renderer may be selected using ``--pdf-renderer``. The default is ``auto`` which lets OCRmyPDF select the renderer to use. Currently, ``auto`` selects ``sandwich`` for Tesseract 3.05.01, and newer, ``hocr`` for older versions of Tesseract.
|
||||
OCRmyPDF has these PDF renderers: ``sandwich`` and ``hocr``. The renderer may be selected using ``--pdf-renderer``. The default is ``auto`` which lets OCRmyPDF select the renderer to use. Currently, ``auto`` selects ``sandwich`` for Tesseract 3.05.01 or newer, or ``hocr`` for older versions of Tesseract.
|
||||
|
||||
The ``sandwich`` renderer
|
||||
"""""""""""""""""""""""""
|
||||
|
||||
The ``sandwich`` renderer uses Tesseract's new text-only PDF feature, which produces a PDF page that lays out the OCR in invisible text. This page is then "sandwiched" onto the original PDF page, allowing lossless application of OCR even to PDF pages that contain other vector objects.
|
||||
|
||||
Currently this is the best renderer for most uses, however it is implemented in Tesseract so OCRmyPDF cannot influence it. Currently some problematic PDF viewers like Mozilla PDF.js and macOS Preview have problems with segmenting its text output, and mightrunseveralwordstogether.
|
||||
|
||||
When image preprocessing features like ``--deskew`` are used, the original PDF will be rendered as a full page and the OCR layer will be placed on top.
|
||||
|
||||
This renderer requires Tesseract 3.05.01 or newer.
|
||||
If a PDF created with this renderer using Tesseract versions older than 3.05.00 is then passed through Ghostscript's pdfwrite feature, the OCR text *may* be corrupted. The ``--output-type=pdfa`` argument will produce a warning in this situation. For this reason, OCRmyPDF automatically selects the ``hocr`` for older Tesseract versions.
|
||||
|
||||
The ``hocr`` renderer
|
||||
"""""""""""""""""""""
|
||||
|
||||
The ``hocr`` renderer works with older versions of Tesseract. The image layer is copied from the original PDF page if possible, avoiding potentially lossy transcoding or loss of other PDF information. If preprocessing is specified, then the image layer is a new PDF.
|
||||
|
||||
Unlike ``sandwich`` this renderer is implemented within OCRmyPDF; anyone looking to customize how OCR is presented should look here. A major disadvantage of this renderer is it not capable of correctly handling text outside the Latin alphabet. Pull requests to improve the situation are welcome.
|
||||
|
||||
Currently, this renderer has the best compatibility with Mozilla's PDF.js viewer.
|
||||
|
||||
This works in all versions of Tesseract.
|
||||
|
||||
The ``tesseract`` renderer
|
||||
""""""""""""""""""""""""""
|
||||
|
||||
The ``tesseract`` renderer creates a PDF with the image and text layers precomposed, meaning that it always transcodes, loses image quality and rasterizes and vector objects. It does a better job on non-Latin text and document structure than ``hocr``.
|
||||
The ``tesseract`` renderer was removed. OCRmyPDF's new approach to text layer grafting makes it functionally equivalent to ``sandwich``.
|
||||
|
||||
If a PDF created with this renderer using Tesseract versions older than 3.05.00 is then passed through Ghostscript's pdfwrite feature, the OCR text *may* be corrupted. The ``--output-type=pdfa`` argument will produce a warning in this situation.
|
||||
Return code policy
|
||||
------------------
|
||||
|
||||
*This renderer is deprecated and will be removed whenever support for older versions of Tesseract is dropped.*
|
||||
OCRmyPDF writes all messages to ``stderr``. ``stdout`` is reserved for piping
|
||||
output files. ``stdin`` is reserved for piping input files.
|
||||
|
||||
The return codes generated by the OCRmyPDF are considered part of the stable
|
||||
user interface. They may be imported from ``ocrmypdf.exceptions``.
|
||||
|
||||
.. list-table:: Return codes
|
||||
:widths: 5 35 60
|
||||
:header-rows: 1
|
||||
|
||||
* - Code
|
||||
- Name
|
||||
- Interpretation
|
||||
* - 0
|
||||
- ``ExitCode.ok``
|
||||
- Everything worked as expected.
|
||||
* - 1
|
||||
- ``ExitCode.bad_args``
|
||||
- Invalid arguments, exited with an error.
|
||||
* - 2
|
||||
- ``ExitCode.input_file``
|
||||
- The input file does not seem to be a valid PDF.
|
||||
* - 3
|
||||
- ``ExitCode.missing_dependency``
|
||||
- An external program required by OCRmyPDF is missing.
|
||||
* - 4
|
||||
- ``ExitCode.invalid_output_pdf``
|
||||
- An output file was created, but it does not seem to be a valid PDF. The file will be available.
|
||||
* - 5
|
||||
- ``ExitCode.file_access_error``
|
||||
- The user running OCRmyPDF does not have sufficient permissions to read the input file and write the output file.
|
||||
* - 6
|
||||
- ``ExitCode.already_done_ocr``
|
||||
- The file already appears to contain text so it may not need OCR. See output message.
|
||||
* - 7
|
||||
- ``ExitCode.child_process_error``
|
||||
- An error occurred in an external program (child process) and OCRmyPDF cannot continue.
|
||||
* - 8
|
||||
- ``ExitCode.encrypted_pdf``
|
||||
- The input PDF is encrypted. OCRmyPDF does not read encrypted PDFs. Use another program such as ``qpdf`` to remove encryption.
|
||||
* - 9
|
||||
- ``ExitCode.invalid_config``
|
||||
- A custom configuration file was forwarded to Tesseract using ``--tesseract-config``, and Tesseract rejected this file.
|
||||
* - 10
|
||||
- ``ExitCode.pdfa_conversion_failed``
|
||||
- A valid PDF was created, PDF/A conversion failed. The file will be available.
|
||||
* - 15
|
||||
- ``ExitCode.other_error``
|
||||
- Some other error occurred.
|
||||
* - 130
|
||||
- ``ExitCode.ctrl_c``
|
||||
- The program was interrupted by pressing Ctrl+C.
|
||||
|
||||
+74
-2
@@ -18,6 +18,8 @@ The ``--tag`` argument tells parallel to print the filename as a prefix whenever
|
||||
|
||||
parallel --tag -j 2 ocrmypdf '{}' 'output/{}' ::: *.pdf
|
||||
|
||||
OCRmyPDF automatically repairs PDFs before parsing and gathering information from them. If you are already repairing PDFs with ``qpdf`` prior to attempting OCR, or you can use ``--skip-repair`` to skip this step. It may improve performance for large files, since repairing PDFs is single-threaded.
|
||||
|
||||
Directory trees
|
||||
---------------
|
||||
|
||||
@@ -90,13 +92,83 @@ This user contributed script also provides an example of batch processing.
|
||||
API
|
||||
"""
|
||||
|
||||
OCRmyPDF is currently supported as a command line interface. Due to limitations in one of the libraries OCRmyPDF depends on, it is not yet usable as an API.
|
||||
OCRmyPDF is currently supported as a command line interface. This means that even if you are using OCRmyPDF in a Python script, you should run it in a subprocess rather importing the ocrmypdf package.
|
||||
|
||||
The reason for this limitation is that the `ruffus <https://github.com/bunbun/ruffus/>`_ library that OCRmyPDF depends on is unfortunately not reentrant. OCRmyPDF works by defining each operation it does as a ruffus task that takes one or more files as input and generates one or more files as output. As such ruffus is fairly fundamental.
|
||||
|
||||
(If you find individual functions implemented in OCRmyPDF useful (such as ``ocrmypdf.pdfinfo``), you can use these if you wish to.)
|
||||
|
||||
|
||||
Synology DiskStations
|
||||
"""""""""""""""""""""
|
||||
|
||||
Synology DiskStations (Network Attached Storage devices) can run the Docker image of OCRmyPDF if the Synology `Docker package <https://www.synology.com/en-global/dsm/packages/Docker>`_ is installed. Attached is a script to address particular quirks of using OCRmyPDF on one of these devices.
|
||||
|
||||
This is only possible for x86-based Synology products. Some Synology products use ARM or Power processors and do not support Docker. Further adjustments might be needed to deal with the Synology's relatively limited CPU and RAM.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
#!/bin/env python3
|
||||
# Contributed by github.com/Enantiomerie
|
||||
|
||||
# script needs 2 arguments
|
||||
# 1. source dir with *.pdf - default is location of script
|
||||
# 2. move dir where *.pdf and *_OCR.pdf are moved to
|
||||
|
||||
import logging
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
import time
|
||||
import shutil
|
||||
|
||||
script_dir = os.path.dirname(os.path.realpath(__file__))
|
||||
timestamp = time.strftime("%Y-%m-%d-%H%M_")
|
||||
log_file = script_dir + '/' + timestamp + 'ocrmypdf.log'
|
||||
logging.basicConfig(level=logging.INFO, format='%(asctime)s %(message)s', filename=log_file, filemode='w')
|
||||
|
||||
if len(sys.argv) > 1:
|
||||
start_dir = sys.argv[1]
|
||||
else:
|
||||
start_dir = '.'
|
||||
|
||||
for dir_name, subdirs, file_list in os.walk(start_dir):
|
||||
logging.info('\n')
|
||||
logging.info(dir_name + '\n')
|
||||
os.chdir(dir_name)
|
||||
for filename in file_list:
|
||||
file_ext = os.path.splitext(filename)[1]
|
||||
if file_ext == '.pdf':
|
||||
full_path = dir_name + '/' + filename
|
||||
file_noext = os.path.splitext(filename)[0]
|
||||
timestamp_OCR = time.strftime("%Y-%m-%d-%H%M_OCR_")
|
||||
filename_OCR = timestamp_OCR + file_noext + '.pdf'
|
||||
docker_mount = dir_name + ':/home/docker'
|
||||
# create string for pdf processing
|
||||
# diskstation needs a user:group docker:docker. find uid:gid of your diskstation docker:docker with id docker.
|
||||
# use this uid:gid in -u flag
|
||||
# rw rights for docker:docker at source dir are also necessary
|
||||
# the script is processed as root user via chron
|
||||
cmd = ['docker', 'run', '--rm', '-v', docker_mount, '-u=1030:65538', 'jbarlow83/ocrmypdf', , '--deskew' , filename, filename_OCR]
|
||||
logging.info(cmd)
|
||||
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||
result = proc.stdout.read()
|
||||
logging.info(result)
|
||||
full_path_OCR = dir_name + '/' + filename_OCR
|
||||
os.chmod(full_path_OCR, 0o666)
|
||||
os.chmod(full_path, 0o666)
|
||||
full_path_OCR_archive = sys.argv[2]
|
||||
full_path_archive = sys.argv[2] + '/no_ocr'
|
||||
shutil.move(full_path_OCR,full_path_OCR_archive)
|
||||
shutil.move(full_path, full_path_archive)
|
||||
logging.info('Finished.\n')
|
||||
|
||||
|
||||
|
||||
Huge batch jobs
|
||||
"""""""""""""""
|
||||
|
||||
If you have thousands of files to work with, contact the author.
|
||||
If you have thousands of files to work with, contact the author. Consulting work related to OCRmyPDF helps fund this open source project and all inquiries are appreciated.
|
||||
|
||||
|
||||
Hot (watched) folders
|
||||
|
||||
+20
-2
@@ -52,7 +52,7 @@ master_doc = 'index'
|
||||
|
||||
# General information about the project.
|
||||
project = 'ocrmypdf'
|
||||
copyright = '2017, James R. Barlow'
|
||||
copyright = '2018, James R. Barlow. Licensed under Creative Commons Attribution-ShareAlike 4.0.'
|
||||
author = 'James R. Barlow'
|
||||
|
||||
# The version info for the project you're documenting, acts as replacement for
|
||||
@@ -60,7 +60,25 @@ author = 'James R. Barlow'
|
||||
# built documents.
|
||||
#
|
||||
# The short X.Y version.
|
||||
from ocrmypdf import VERSION as OCRMYPDF_VERSION
|
||||
|
||||
import os
|
||||
on_rtd = os.environ.get('READTHEDOCS') == 'True'
|
||||
|
||||
if on_rtd:
|
||||
# Help ReadTheDocs avoid having to install any binary extension modules
|
||||
import sys
|
||||
from unittest.mock import MagicMock
|
||||
|
||||
class Mock(MagicMock):
|
||||
@classmethod
|
||||
def __getattr__(cls, name):
|
||||
return MagicMock()
|
||||
|
||||
MOCK_MODULES = ['pikepdf', 'libxmp', 'libxmp.utils']
|
||||
sys.modules.update((mod_name, Mock()) for mod_name in MOCK_MODULES)
|
||||
|
||||
|
||||
from ocrmypdf import __version__ as OCRMYPDF_VERSION
|
||||
|
||||
_version_parts = OCRMYPDF_VERSION.split('.')
|
||||
|
||||
|
||||
+88
-36
@@ -11,7 +11,7 @@ ocrmypdf has built-in help.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
ocrmypdf --help
|
||||
ocrmypdf --help
|
||||
|
||||
|
||||
Add an OCR layer and convert to PDF/A
|
||||
@@ -19,21 +19,21 @@ Add an OCR layer and convert to PDF/A
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
ocrmypdf input.pdf output.pdf
|
||||
ocrmypdf input.pdf output.pdf
|
||||
|
||||
Add an OCR layer and output a standard PDF
|
||||
""""""""""""""""""""""""""""""""""""""""""
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
ocrmypdf --output-type pdf input.pdf output.pdf
|
||||
ocrmypdf --output-type pdf input.pdf output.pdf
|
||||
|
||||
Create a PDF/A with all color and grayscale images converted to JPEG
|
||||
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
ocrmypdf --output-type pdfa --pdfa-image-compression jpeg input.pdf output.pdf
|
||||
ocrmypdf --output-type pdfa --pdfa-image-compression jpeg input.pdf output.pdf
|
||||
|
||||
Modify a file in place
|
||||
""""""""""""""""""""""
|
||||
@@ -42,7 +42,7 @@ The file will only be overwritten if OCRmyPDF is successful.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
ocrmypdf myfile.pdf myfile.pdf
|
||||
ocrmypdf myfile.pdf myfile.pdf
|
||||
|
||||
Correct page rotation
|
||||
"""""""""""""""""""""
|
||||
@@ -51,20 +51,22 @@ OCR will attempt to automatic correct the rotation of each page. This can help f
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
ocrmypdf --rotate-pages myfile.pdf myfile.pdf
|
||||
ocrmypdf --rotate-pages myfile.pdf myfile.pdf
|
||||
|
||||
You can increase (decrease) the parameter ``--rotate-pages-threshold`` to make page rotation more (less) aggressive.
|
||||
|
||||
If the page is "just a little off horizontal", like a crooked picture, then you want ``--deskew``. ``--rotate-pages`` is for when the cardinal angle is wrong.
|
||||
|
||||
|
||||
OCR languages other than English
|
||||
""""""""""""""""""""""""""""""""
|
||||
|
||||
By default OCRmyPDF assumes the document is English.
|
||||
By default OCRmyPDF assumes the document is English.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
ocrmypdf -l fre LeParisien.pdf LeParisien.pdf
|
||||
ocrmypdf -l eng+fre Bilingual-English-French.pdf Bilingual-English-French.pdf
|
||||
ocrmypdf -l fra LeParisien.pdf LeParisien.pdf
|
||||
ocrmypdf -l eng+fra Bilingual-English-French.pdf Bilingual-English-French.pdf
|
||||
|
||||
Language packs must be installed for all languages specified. See :ref:`Installing additional language packs <lang-packs>`.
|
||||
|
||||
@@ -72,36 +74,41 @@ Language packs must be installed for all languages specified. See :ref:`Installi
|
||||
Produce PDF and text file containing OCR text
|
||||
"""""""""""""""""""""""""""""""""""""""""""""
|
||||
|
||||
This produces a file named "output.pdf" and a companion text file named "output.txt". The ``pdftotext`` program from
|
||||
`Poppler <https://poppler.freedesktop.org/>`_ is used to extract text from the finished PDF.
|
||||
|
||||
This produces a file named "output.pdf" and a companion text file named "output.txt".
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
ocrmypdf input.pdf - | tee output.pdf | pdftotext - output.txt
|
||||
|
||||
.. note::
|
||||
|
||||
To get pdftotext, Debian/Ubuntu users may ``apt-get install poppler-utils``
|
||||
and macOS users may ``brew install poppler`` respectively.
|
||||
|
||||
ocrmypdf --sidecar output.txt input.pdf output.pdf
|
||||
|
||||
OCR images, not PDFs
|
||||
--------------------
|
||||
|
||||
Use a program like `img2pdf <https://gitlab.mister-muffin.de/josch/img2pdf>`_ to convert your images to PDFs, and then pipe the results to run ocrmypdf:
|
||||
If you are starting with images, you can just use Tesseract 3.04 or later directly to convert images to PDFs:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
img2pdf my-images*.jpg | ocrmypdf - myfile.pdf
|
||||
|
||||
``img2pdf`` also has features to control the position of images on a page, if desired.
|
||||
|
||||
For convenience, OCRmyPDF can convert single images to PDFs on its own. If the resolution (dots per inch, DPI) of an image is not set or is incorrect, it can be overridden with ``--image-dpi``. (As 1 inch is 2.54 cm, 1 dpi = 0.39 dpcm).
|
||||
tesseract my-image.jpg output-prefix pdf
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
ocrmypdf --image-dpi 300 image.png myfile.pdf
|
||||
# When there are multiple images
|
||||
tesseract text-file-containing-list-of-image-filenames.txt output-prefix pdf
|
||||
|
||||
Tesseract's PDF output is quite good – OCRmyPDF uses it by internally by default. However, OCRmyPDF has many features not available in Tesseract like like image processing, metadata control, and PDF/A generation.
|
||||
|
||||
Use a program like `img2pdf <https://gitlab.mister-muffin.de/josch/img2pdf>`_ to convert your images to PDFs, and then pipe the results to run ocrmypdf. The `-` tells ocrmypdf to read standard input.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
img2pdf my-images*.jpg | ocrmypdf - myfile.pdf
|
||||
|
||||
``img2pdf`` is recommended because it does an excellent job at generating PDFs without transcoding images.
|
||||
|
||||
For convenience, OCRmyPDF can also convert single images to PDFs on its own. If the resolution (dots per inch, DPI) of an image is not set or is incorrect, it can be overridden with ``--image-dpi``. (As 1 inch is 2.54 cm, 1 dpi = 0.39 dpcm).
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
ocrmypdf --image-dpi 300 image.png myfile.pdf
|
||||
|
||||
If you have multiple images, you must use ``img2pdf`` to convert the images to PDF.
|
||||
|
||||
@@ -109,11 +116,6 @@ If you have multiple images, you must use ``img2pdf`` to convert the images to P
|
||||
|
||||
ImageMagick ``convert`` can also convert a group of images to PDF, but in the author's experience it takes a long time, transcodes unnecessarily and gives poor results.
|
||||
|
||||
You can also use Tesseract 3.04+ directly to convert single page images or multi-page TIFFs to PDF:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
tesseract my-image.jpg output-prefix pdf
|
||||
|
||||
Image processing
|
||||
----------------
|
||||
@@ -125,18 +127,18 @@ OCRmyPDF perform some image processing on each page of a PDF, if desired. The s
|
||||
* ``--remove-background`` attempts to detect and remove a noisy background from grayscale or color images. Monochrome images are ignored. This should not be used on documents that contain color photos as it may remove them.
|
||||
|
||||
* ``--deskew`` will correct pages were scanned at a skewed angle by rotating them back into place. Skew determination and correction is performed using `Postl's variance of line sums <http://www.leptonica.com/skew-measurement.html>`_ algorithm as implemented in `Leptonica <http://www.leptonica.com/index.html>`_.
|
||||
|
||||
|
||||
* ``--clean`` uses `unpaper <https://www.flameeyes.eu/projects/unpaper>`_ to clean up pages before OCR, but does not alter the final output. This makes it less likely that OCR will try to find text in background noise.
|
||||
|
||||
* ``--clean-final`` uses unpaper to clean up pages before OCR and inserts the page into the final output. You will want to review each page to ensure that unpaper did not remove something important.
|
||||
|
||||
.. note::
|
||||
|
||||
In many cases image processing will rasterize PDF pages as images, potentially losing quality.
|
||||
In many cases image processing will rasterize PDF pages as images, potentially losing quality.
|
||||
|
||||
.. warning::
|
||||
|
||||
``--clean-final`` and ``-remove-background`` may leave undesirable visual artifacts in some images where their algorithms have shortcomings. Files should be visually reviewed after using these options.
|
||||
``--clean-final`` and ``-remove-background`` may leave undesirable visual artifacts in some images where their algorithms have shortcomings. Files should be visually reviewed after using these options.
|
||||
|
||||
|
||||
OCR and correct document skew (crooked scan)
|
||||
@@ -146,13 +148,46 @@ Deskew:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
ocrmypdf --deskew input.pdf output.pdf
|
||||
ocrmypdf --deskew input.pdf output.pdf
|
||||
|
||||
Image processing commands can be combined. The order in which options are given does not matter. OCRmyPDF always applies the steps of the image processing pipeline in the same order (rotate, remove background, deskew, clean).
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
ocrmypdf --deskew --clean --rotate-pages input.pdf output.pdf
|
||||
ocrmypdf --deskew --clean --rotate-pages input.pdf output.pdf
|
||||
|
||||
|
||||
Don't actually OCR my PDF
|
||||
"""""""""""""""""""""""""
|
||||
|
||||
If you set ``--tesseract-timeout 0`` OCRmyPDF will apply its image processing without performing OCR, if all you want to is to apply image processing or PDF/A conversion.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
ocrmypdf --tesseract-timeout=0 --remove-background input.pdf output.pdf
|
||||
|
||||
|
||||
Redo OCR
|
||||
""""""""
|
||||
|
||||
To redo OCR on a file OCRed with other OCR software or a previous version of OCRmyPDF and/or Tesseract, you may use the ``--force-ocr`` argument. Normally, OCRmyPDF does not modify files that already appear to contain OCR text.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
ocrmypdf --force-ocr input.pdf output.pdf
|
||||
|
||||
Note that the method above will force rasterization of all pages, potentially reducing quality or losing vector content.
|
||||
|
||||
To ensure quality is preserved, one could extract all of the images and rebuild the PDF for a lossless transformation. This recipe does not work when PDFs contain multiple images per page, as many do in practice. It will also lose any page rotation information.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
pdfimages -all old-ocr.pdf prefix # extract all images
|
||||
img2pdf -o temp.pdf prefix* # construct new PDF from the images
|
||||
# review the new PDF to ensure it visually matches the old one
|
||||
ocrmypdf --output-type pdf temp.pdf new-ocr.pdf
|
||||
|
||||
``--output-type pdf`` is used here to avoid using Ghostscript which will also rasterize images.
|
||||
|
||||
|
||||
Improving OCR quality
|
||||
@@ -164,3 +199,20 @@ Rotating pages and deskewing helps to ensure that the page orientation is correc
|
||||
|
||||
OCR quality will suffer if the resolution of input images is not correct (since the range of pixel sizes that will be checked for possible fonts will also be incorrect).
|
||||
|
||||
|
||||
PDF optimization
|
||||
----------------
|
||||
|
||||
By default OCRmyPDF will attempt to perform lossless optimizations on the images inside PDFs after OCR is complete. Optimization is performed even if no OCR text is found.
|
||||
|
||||
The ``--optimize N`` (short form ``-O``) argument controls optimization, where ``N`` ranges from 0 to 3. ``--optimize 0`` disables optimizations. ``1`` enables lossless optimizations that can be performed safely with no quality loss. ``2`` enables lossy optimizations such as image color quantizations. ``3`` enables more aggressive optimizations and targets a lower JPEG quality.
|
||||
|
||||
Optimization is improved when a JBIG2 encoder is available and when ``pngquant`` is installed. If either of these components are missing, then some types of images will not be optimized.
|
||||
|
||||
Currently optimization attempts to find more efficient encodings for images. The types of optimization available may expand over time. By default, OCRmyPDF compresses data streams inside PDFs, and will change inefficient encodings to more modern versions. A program like ``qpdf`` can be used to change encodings, e.g. to inspect the internals fo a PDF.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
ocrmypdf --optimize 3 in.pdf out.pdf # Make it small
|
||||
|
||||
Some users may consider enabling lossy JBIG2. See: :ref:`jbig2-lossy`.
|
||||
|
||||
+2
-2
@@ -9,7 +9,7 @@ OCRmyPDF documentation
|
||||
OCRmyPDF adds an OCR text layer to scanned PDF files, allowing them to
|
||||
be searched.
|
||||
|
||||
PDFs are the best format for scanned documents. Unfortunately, PDFs can be difficult to work with. OCRmyPDF makes it easy to apply image processing and OCR to existing PDFs.
|
||||
PDF is the best format for storing and exchanging scanned documents. Unfortunately, PDFs can be difficult to modify. OCRmyPDF makes it easy to apply image processing and OCR to existing PDFs.
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
@@ -18,6 +18,7 @@ PDFs are the best format for scanned documents. Unfortunately, PDFs can be diff
|
||||
release_notes
|
||||
installation
|
||||
languages
|
||||
jbig2
|
||||
|
||||
.. toctree::
|
||||
:caption: Usage
|
||||
@@ -36,4 +37,3 @@ Indices and tables
|
||||
* :ref:`genindex`
|
||||
* :ref:`modindex`
|
||||
* :ref:`search`
|
||||
|
||||
|
||||
+395
-214
@@ -1,10 +1,53 @@
|
||||
Installation
|
||||
============
|
||||
|
||||
OCRmyPDF requires Python 3.5 (or newer) and Tesseract 3.04 (or newer).
|
||||
.. |latest| image:: https://img.shields.io/pypi/v/ocrmypdf.svg
|
||||
:alt: OCRmyPDF latest released version on PyPI
|
||||
|
||||
Installing on Debian and Ubuntu 16.10 or newer
|
||||
----------------------------------------------
|
||||
|latest|
|
||||
|
||||
The easiest way to install OCRmyPDF to follow the steps for your operating system/platform.
|
||||
|
||||
If you want to use the latest version of OCRmyPDF, your best bet is to install the most recent version your platform provides, and then upgrade that version by installing the Python binary wheels.
|
||||
|
||||
.. contents:: Platform-specific steps
|
||||
:depth: 2
|
||||
:local:
|
||||
|
||||
Installing on Linux
|
||||
-------------------
|
||||
|
||||
Debian and Ubuntu 16.10 or newer
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. |deb-stable| image:: https://repology.org/badge/version-for-repo/debian_stable/ocrmypdf.svg
|
||||
:alt: Debian 9 stable ("stretch")
|
||||
|
||||
.. |deb-testing| image:: https://repology.org/badge/version-for-repo/debian_testing/ocrmypdf.svg
|
||||
:alt: Debian 10 testing ("buster")
|
||||
|
||||
.. |deb-unstable| image:: https://repology.org/badge/version-for-repo/debian_unstable/ocrmypdf.svg
|
||||
:alt: Debian unstable
|
||||
|
||||
.. |ubu-1710| image:: https://repology.org/badge/version-for-repo/ubuntu_17_10/ocrmypdf.svg
|
||||
:alt: Ubuntu 17.10
|
||||
|
||||
.. |ubu-1804| image:: https://repology.org/badge/version-for-repo/ubuntu_18_04/ocrmypdf.svg
|
||||
:alt: Ubuntu 18.04 LTS
|
||||
|
||||
.. |ubu-1810| image:: https://repology.org/badge/version-for-repo/ubuntu_18_10/ocrmypdf.svg
|
||||
:alt: Ubuntu 18.10
|
||||
|
||||
|
||||
+-------------------------------------------+
|
||||
| **OCRmyPDF version** |
|
||||
+-------------------------------------------+
|
||||
| |latest| |
|
||||
+-------------------------------------------+
|
||||
| |deb-stable| |deb-testing| |deb-unstable| |
|
||||
+-------------------------------------------+
|
||||
| |ubu-1710| |ubu-1804| |ubu-1810| |
|
||||
+-------------------------------------------+
|
||||
|
||||
Users of Debian 9 ("stretch") or later or Ubuntu 16.10 or later may simply
|
||||
|
||||
@@ -12,38 +55,264 @@ Users of Debian 9 ("stretch") or later or Ubuntu 16.10 or later may simply
|
||||
|
||||
apt-get install ocrmypdf
|
||||
|
||||
Installing on macOS
|
||||
-------------------
|
||||
As indicated in the table above, Debian and Ubuntu releases may lag behind the latest version. If the version available for your platform is out of date, you could opt to install the latest version from source. See `Installing HEAD revision from sources`_.
|
||||
|
||||
A `Homebrew <https://brew.sh>`_ tap is available for macOS:
|
||||
For full details on version availability for your platform, check the `Debian Package Tracker <https://tracker.debian.org/pkg/ocrmypdf>`_ or `Ubuntu launchpad.net <https://launchpad.net/ocrmypdf>`_.
|
||||
|
||||
.. note::
|
||||
|
||||
OCRmyPDF for Debian and Ubuntu currently omit the JBIG2 encoder. OCRmyPDF works fine without it but will produce larger output files. If you build jbig2enc from source, ocrmypdf 7.0.0 and later will automatically detect it (specifically the ``jbig2`` binary) on the ``PATH``. To add JBIG2 encoding, see :ref:`jbig2`.
|
||||
|
||||
Installing the latest version on Ubuntu 18.04 LTS
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Ubuntu 18.04 includes ocrmypdf 6.1.2. To install a more recent version, first
|
||||
install the system version to get most of the dependencies:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
sudo apt-get update
|
||||
sudo apt-get install \
|
||||
ocrmypdf \
|
||||
python3-pip
|
||||
|
||||
There are a few dependency changes between ocrmypdf 6.1.2 and 7.x. Let's get
|
||||
these, too.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
sudo apt-get install \
|
||||
libexempi3 \
|
||||
pngquant
|
||||
|
||||
Then install the most recent ocrmypdf for the local user and set the user's ``PATH`` to check for the user's Python packages.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
export PATH=$HOME/.local/bin:$PATH
|
||||
pip3 install --user ocrmypdf
|
||||
|
||||
To add JBIG2 encoding, see :ref:`jbig2`.
|
||||
|
||||
Ubuntu 16.04 LTS
|
||||
^^^^^^^^^^^^^^^^
|
||||
|
||||
No package is currently available for Ubuntu 16.04, but you can install the dependencies manually:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
sudo apt-get update
|
||||
sudo apt-get install \
|
||||
ghostscript \
|
||||
libexempi3 \
|
||||
pngquant \
|
||||
python3-cffi \
|
||||
python3-pip \
|
||||
qpdf \
|
||||
tesseract-ocr \
|
||||
unpaper
|
||||
|
||||
If you wish install OCRmyPDF for the current user, and ensure that the ``PATH``
|
||||
environment variable contains ``$HOME/.local/bin``.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
export PATH=$HOME/.local/bin:$PATH
|
||||
pip3 install --user ocrmypdf
|
||||
|
||||
Alternately, you can install ocrmypdf system-wide. (Not recommended.)
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
sudo pip3 install ocrmypdf
|
||||
|
||||
At your option, you may upgrade Ubuntu 16.04 LTS to Tesseract 4.0 for improved OCR results.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
sudo apt-get install -y software-properties-common python-software-properties
|
||||
sudo add-apt-repository ppa:alex-p/tesseract-ocr -y
|
||||
sudo apt-get update
|
||||
sudo apt-get upgrade tesseract-ocr
|
||||
|
||||
To add JBIG2 encoding, see :ref:`jbig2`.
|
||||
|
||||
Ubuntu 14.04 LTS
|
||||
^^^^^^^^^^^^^^^^
|
||||
|
||||
Installing on Ubuntu 14.04 LTS (trusty) is more difficult than some other options, because it is older and does not provide ``pip``.
|
||||
|
||||
Update apt-get:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
sudo apt-get update
|
||||
|
||||
Install system dependencies:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
sudo apt-get install \
|
||||
software-properties-common python-software-properties \
|
||||
zlib1g-dev \
|
||||
libexempi3 \
|
||||
libjpeg-dev \
|
||||
libffi-dev \
|
||||
pngquant \
|
||||
qpdf
|
||||
|
||||
We will need backports of Ghostscript 9.16, libav-11 (for unpaper 6.1), Tesseract 4.00 (alpha), and Python 3.6. This will replace Ghostscript and Tesseract 3.x on your system. Python 3.6 will be installed alongside the system Python 3.4.
|
||||
|
||||
If you prefer to not modify your system in this matter, consider using a Docker container.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
sudo add-apt-repository ppa:vshn/ghostscript -y
|
||||
sudo add-apt-repository ppa:heyarje/libav-11 -y
|
||||
sudo add-apt-repository ppa:alex-p/tesseract-ocr -y
|
||||
sudo add-apt-repository ppa:jonathonf/python-3.6 -y
|
||||
|
||||
sudo apt-get update
|
||||
|
||||
sudo apt-get install \
|
||||
python3.6-dev \
|
||||
ghostscript \
|
||||
tesseract-ocr \
|
||||
tesseract-ocr-eng \
|
||||
libavformat56 libavcodec56 libavutil54 \
|
||||
wget
|
||||
|
||||
Now we need to install ``pip`` and let it install ocrmypdf:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
curl https://bootstrap.pypa.io/ez_setup.py -o - | python3.6 && python3.6 -m easy_install pip
|
||||
pip3.6 install ocrmypdf
|
||||
|
||||
The ``wget`` command will download a program and run it.
|
||||
|
||||
These installation instructions omit the optional dependency ``unpaper``, which is only available at version 0.4.2 in Ubuntu 14.04. The author could not find a backport of ``unpaper``, and created a .deb package to do the job of installing unpaper 6.1 (for x86 64-bit only):
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
wget -q 'https://www.dropbox.com/s/vaq0kbwi6e6au80/unpaper_6.1-1.deb?raw=1' -O unpaper_6.1-1.deb
|
||||
sudo dpkg -i unpaper_6.1-1.deb
|
||||
|
||||
To add JBIG2 encoding, see :ref:`jbig2`.
|
||||
|
||||
ArchLinux
|
||||
^^^^^^^^^
|
||||
|
||||
.. image:: https://repology.org/badge/version-for-repo/aur/ocrmypdf.svg
|
||||
:alt: ArchLinux
|
||||
:target: https://repology.org/metapackage/ocrmypdf
|
||||
|
||||
The author is aware of an `ArchLinux User Repository package for ocrmypdf <https://aur.archlinux.org/packages/ocrmypdf/>`_. You can use the following command.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
yaourt -S ocrmypdf
|
||||
|
||||
If you have any difficulties with installation, check the repository package page.
|
||||
|
||||
Other Linux packages
|
||||
^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
See the `Repology <https://repology.org/metapackage/ocrmypdf/versions>`_ page.
|
||||
|
||||
In general, first install the OCRmyPDF package for your system, then optionally use the procedure `Installing with Python pip`_ to install a more recent version.
|
||||
|
||||
Installing on macOS
|
||||
-------------------
|
||||
|
||||
Homebrew
|
||||
^^^^^^^^
|
||||
|
||||
.. image:: https://img.shields.io/homebrew/v/ocrmypdf.svg
|
||||
:alt: homebrew
|
||||
:target: http://brewformulas.org/Ocrmypdf
|
||||
|
||||
OCRmyPDF is now a standard `Homebrew <https://brew.sh>`_ formula. To install on macOS:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
brew tap jbarlow83/ocrmypdf
|
||||
brew install ocrmypdf
|
||||
|
||||
|
||||
.. warning::
|
||||
.. note::
|
||||
|
||||
Users who previously installed OCRmyPDF on macOS using ``pip install ocrmypdf`` should remove the pip version (``pip3 uninstall ocrmypdf``) before switching to the Homebrew version.
|
||||
|
||||
.. _Docker-install:
|
||||
.. note::
|
||||
|
||||
Users who previously installed OCRmyPDF from the private tap should switch to the mainline version (``brew untap jbarlow83/ocrmypdf``) and install from there.
|
||||
|
||||
Manual installation on macOS
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
These instructions probably work on all macOS supported by Homebrew.
|
||||
|
||||
If it's not already present, `install Homebrew <http://brew.sh/>`_.
|
||||
|
||||
Update Homebrew:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
brew update
|
||||
|
||||
Install or upgrade the required Homebrew packages, if any are missing. To do this, download the ``Brewfile`` that lists all of the dependencies to the current directory, and run ``brew bundle`` to process them (installing or upgrading as needed). ``Brewfile`` is a plain text file.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
wget https://github.com/jbarlow83/OCRmyPDF/raw/master/.travis/Brewfile
|
||||
brew bundle
|
||||
|
||||
This will include the English, French, German and Spanish language packs. If you need other languages you can optionally install them all:
|
||||
|
||||
.. _macos-all-languages:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
brew install tesseract --with-all-languages # Option 2: for all language packs
|
||||
|
||||
Update the homebrew pip:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
pip3 install --upgrade pip
|
||||
|
||||
You can then install OCRmyPDF from PyPI, for the current user:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
pip3 install --user ocrmypdf
|
||||
|
||||
or system-wide:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
pip3 install ocrmypdf
|
||||
|
||||
The command line program should now be available:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
ocrmypdf --help
|
||||
|
||||
.. _docker-install:
|
||||
|
||||
Installing the Docker image
|
||||
---------------------------
|
||||
|
||||
For many users, installing the Docker image will be easier than installing all of OCRmyPDF's dependencies. For Windows, it is the only option.
|
||||
For some users, installing the Docker image will be easier than installing all of OCRmyPDF's dependencies. For Windows, it is the only option.
|
||||
|
||||
If you have `Docker <https://docs.docker.com/>`_ installed on your system, you can install
|
||||
a Docker image of the latest release.
|
||||
If you have `Docker <https://docs.docker.com/>`_ installed on your system, you can install a Docker image of the latest release.
|
||||
|
||||
Follow the Docker installation instructions for your platform. If you can run this command
|
||||
successfully, your system is ready to download and execute the image:
|
||||
Follow the Docker installation instructions for your platform. If you can run this command successfully, your system is ready to download and execute the image:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
docker run hello-world
|
||||
|
||||
|
||||
OCRmyPDF will use all available CPU cores. By default, the VirtualBox machine instance on Windows and macOS has only a single CPU core enabled. Use the VirtualBox Manager to determine the name of your Docker engine host, and then follow these optional steps to enable multiple CPUs:
|
||||
|
||||
.. code-block:: bash
|
||||
@@ -56,28 +325,31 @@ OCRmyPDF will use all available CPU cores. By default, the VirtualBox machine i
|
||||
|
||||
Assuming you have a Docker engine running, you can download one of the three available images:
|
||||
|
||||
+-----------------------------+---------------------------------------------+---------------------------------------------------------------------------------+
|
||||
| Image name | Download command | Notes |
|
||||
+-----------------------------+---------------------------------------------+---------------------------------------------------------------------------------+
|
||||
| ocrmypdf | ``docker pull jbarlow83/ocrmypdf`` | Latest ocrmypdf with Tesseract 3.04. Includes English, French, German, Spanish. |
|
||||
+-----------------------------+---------------------------------------------+---------------------------------------------------------------------------------+
|
||||
| ocrmypdf-polyglot | ``docker pull jbarlow83/ocrmypdf-polyglot`` | As above, with all available language packs. |
|
||||
+-----------------------------+---------------------------------------------+---------------------------------------------------------------------------------+
|
||||
| ocrmypdf-tess4 | ``docker pull jbarlow83/ocrmypdf-tess4`` | Latest ocrmypdf with Tesseract 4.00.00alpha and English, French, German, |
|
||||
| | | Spanish, Portuguese, Chinese Simplified, Arabic and Russian (the top 8). |
|
||||
+-----------------------------+---------------------------------------------+---------------------------------------------------------------------------------+
|
||||
.. list-table::
|
||||
:widths: auto
|
||||
:header-rows: 1
|
||||
|
||||
* - Image name
|
||||
- Download command
|
||||
- Notes
|
||||
* - ocrmypdf
|
||||
- ``docker pull jbarlow83/ocrmypdf``
|
||||
- Latest ocrmypdf with Tesseract 4.0.0-beta1 on Ubuntu 18.04. Includes English, French, German, Spanish, Portugeuse and Simplified Chinese.
|
||||
* - ocrmypdf-polyglot
|
||||
- ``docker pull jbarlow83/ocrmypdf-polyglot``
|
||||
- As above, with all available language packs.
|
||||
|
||||
For example:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
docker pull jbarlow83/ocrmypdf-tess4
|
||||
docker pull jbarlow83/ocrmypdf
|
||||
|
||||
Then tag it to give a more convenient name, just ocrmypdf:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
docker tag jbarlow83/ocrmypdf-tess4 ocrmypdf
|
||||
docker tag jbarlow83/ocrmypdf ocrmypdf
|
||||
|
||||
.. _docker-polyglot:
|
||||
|
||||
@@ -88,14 +360,14 @@ You can then run ocrmypdf using the command:
|
||||
.. code-block:: bash
|
||||
|
||||
docker run --rm ocrmypdf --help
|
||||
|
||||
|
||||
To execute the OCRmyPDF on a local file, you must `provide a writable volume to the Docker image <https://docs.docker.com/userguide/dockervolumes/>`_, and both the input and output file must be inside the writable volume. This example command uses the current working directory as the writable volume:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
docker run --rm -v "$(pwd):/home/docker" <other docker arguments> ocrmypdf <your arguments to ocrmypdf>
|
||||
|
||||
In this worked example, the current working directory contains an input file called ``test.pdf`` and the output will go to ``output.pdf``:
|
||||
In this worked example, the current working directory contains an input file called ``test.pdf`` and the output will go to ``output.pdf``:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
@@ -105,6 +377,12 @@ In this worked example, the current working directory contains an input file cal
|
||||
|
||||
Note that ``ocrmypdf`` has its own separate ``-v VERBOSITYLEVEL`` argument to control debug verbosity. All Docker arguments should before the ``ocrmypdf`` image name and all arguments to ``ocrmypdf`` should be listed after.
|
||||
|
||||
In some environments the permissions associated with Docker can be complex to configure. The process that executes Docker may end up not having the permissions to write the specified file system. In that case one can stream the file into and out of the Docker process and avoid all permission hassles, using ``-`` as the input and output filename:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
docker run --rm -i ocrmypdf <other arguments to ocrmypdf> - - <input.pdf >output.pdf
|
||||
|
||||
For convenience, a shell alias can hide the docker command:
|
||||
|
||||
.. code-block:: bash
|
||||
@@ -119,182 +397,17 @@ Or in the wonderful `fish shell <https://fishshell.com/>`_:
|
||||
alias ocrmypdf 'docker run --rm -v (pwd):/home/docker ocrmypdf'
|
||||
funcsave ocrmypdf
|
||||
|
||||
.. note::
|
||||
|
||||
Manual installation on macOS
|
||||
----------------------------
|
||||
|
||||
These instructions probably work on all macOS supported by Homebrew.
|
||||
|
||||
If it's not already present, `install Homebrew <http://brew.sh/>`_.
|
||||
|
||||
Update Homebrew:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
brew update
|
||||
|
||||
Install or upgrade the required Homebrew packages, if any are missing:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
brew install libpng openjpeg jbig2dec libtiff # image libraries
|
||||
brew install qpdf
|
||||
brew install ghostscript
|
||||
brew install python3
|
||||
brew install libxml2 libffi leptonica
|
||||
brew install unpaper # optional
|
||||
|
||||
Python 3.5 and 3.6 are supported.
|
||||
|
||||
Install the required Tesseract OCR engine with the language packs you plan to use:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
brew install tesseract # Option 1: for English, French, German, Spanish
|
||||
|
||||
.. _macos-all-languages:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
brew install tesseract --with-all-languages # Option 2: for all language packs
|
||||
|
||||
Update the homebrew pip and install Pillow:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
pip3 install --upgrade pip
|
||||
pip3 install --upgrade pillow
|
||||
|
||||
You can then install OCRmyPDF from PyPI:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
pip3 install ocrmypdf
|
||||
|
||||
The command line program should now be available:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
ocrmypdf --help
|
||||
|
||||
|
||||
Installing on Ubuntu 16.04 LTS
|
||||
------------------------------
|
||||
|
||||
No package is currently available for Ubuntu 16.04, but you can install the dependencies manually:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
sudo apt-get update
|
||||
sudo apt-get install \
|
||||
unpaper \
|
||||
ghostscript \
|
||||
tesseract-ocr \
|
||||
qpdf \
|
||||
python3-pip \
|
||||
python3-cffi
|
||||
|
||||
If you wish install OCRmyPDF to the system Python, then install as follows (note this installs new packages
|
||||
into your system Python, which could interfere with other programs):
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
sudo pip3 install ocrmypdf
|
||||
|
||||
If you wish to install OCRmyPDF to a virtual environment to isolate the system Python, you can
|
||||
follow these steps.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
python3 -m venv venv-ocrmypdf
|
||||
source venv-ocrmypdf/bin/activate
|
||||
pip3 install ocrmypdf
|
||||
|
||||
|
||||
Installing on Ubuntu 14.04 LTS
|
||||
------------------------------
|
||||
|
||||
Installing on Ubuntu 14.04 LTS (trusty) is more difficult than some other options, because of bugs in Python package installation and because OCRmyPDF depends on some packages newer than are available in the main distribution.
|
||||
|
||||
Add new "apt" repositories needed for backports of Ghostscript 9.16, libav-11 (for unpaper 6.1) and Tesseract 4.00 (alpha). This will replace Ghostscript and Tesseract 3.x on your system. If you prefer to not modify your system in this matter, consider using a Docker container.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
sudo add-apt-repository ppa:vshn/ghostscript -y
|
||||
sudo add-apt-repository ppa:heyarje/libav-11 -y
|
||||
sudo add-apt-repository ppa:alex-p/tesseract-ocr
|
||||
|
||||
Update apt-get:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
sudo apt-get update
|
||||
|
||||
Install system dependencies:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
sudo apt-get install \
|
||||
software-properties-common python-software-properties \
|
||||
zlib1g-dev \
|
||||
libjpeg-dev \
|
||||
libffi-dev \
|
||||
libavformat56 libavcodec56 libavutil54 \
|
||||
ghostscript \
|
||||
qpdf \
|
||||
python3-pip \
|
||||
python3-pil \
|
||||
python3-pytest \
|
||||
python3-reportlab \
|
||||
python3-wheel \
|
||||
python3-venv \
|
||||
tesseract-ocr \
|
||||
tesseract-ocr-eng
|
||||
|
||||
If you wish install OCRmyPDF to the system Python, then install as follows (note this installs new packages
|
||||
into your system Python, which could interfere with other programs):
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
sudo pip3 install ocrmypdf
|
||||
|
||||
If you wish to install OCRmyPDF to a virtual environment to isolate the system Python, you can
|
||||
follow these steps. This includes a workaround `for a known, unresolved issue in Ubuntu 14.04's ensurepip
|
||||
package <http://www.thefourtheye.in/2014/12/Python-venv-problem-with-ensurepip-in-Ubuntu.html>`_:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
sudo apt-get install python3-venv
|
||||
python3 -m venv venv-ocrmypdf --without-pip
|
||||
source venv-ocrmypdf/bin/activate
|
||||
wget -O - -o /dev/null https://bootstrap.pypa.io/get-pip.py | python
|
||||
deactivate
|
||||
python3 -m venv --system-site-packages venv-ocrmypdf
|
||||
source venv-ocrmypdf/bin/activate
|
||||
pip install ocrmypdf
|
||||
|
||||
These installation instructions omit the optional dependency ``unpaper``, which is only available at version 0.4.2 in Ubuntu 14.04. The author could not find a backport of ``unpaper``, and created a .deb package to do the job of installing unpaper 6.1 (for x86 64-bit only):
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
wget -q 'https://www.dropbox.com/s/vaq0kbwi6e6au80/unpaper_6.1-1.deb?raw=1' -O unpaper_6.1-1.deb
|
||||
sudo dpkg -i unpaper_6.1-1.deb
|
||||
|
||||
|
||||
Installing on ArchLinux
|
||||
-----------------------
|
||||
|
||||
The author is aware of an `ArchLinux package for ocrmypdf <https://aur.archlinux.org/packages/ocrmypdf/>`_. It seems like the following command might work.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
pacman -S ocrmypdf
|
||||
|
||||
The ocrmypdf Docker images are designed for application delivery, to enable use of OCRmyPDF without fussing with dependencies. ``docker run --rm`` argument tells Docker to delete the container after it runs, because each container is only good for a single job. The Docker image is not designed for use as a persistent web service or for use on Amazon EC2 Container Service (AWS ECS).
|
||||
|
||||
Installing on Windows
|
||||
---------------------
|
||||
|
||||
Direct installation on Windows is not possible. Install the _`Docker` container as described above. Ensure that your command prompt can run the docker "hello world" container.
|
||||
Direct installation on Windows is not possible. `Install the Docker <docker-install_>`_ container as described above. Ensure that your command prompt can run the docker "hello world" container.
|
||||
|
||||
It would probably not be too difficult to run on Windows. The main reason this has been avoided is the difficulty of packaging and installing the various non-Python dependencies: Tesseract, QPDF, Ghostscript, Leptonica. Pull requests to add or improve Windows support would be quite welcome.
|
||||
|
||||
|
||||
Running on Windows
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
@@ -309,11 +422,71 @@ where /c/Users/sampleuser is a Unix representation of the Windows path C:\\Users
|
||||
|
||||
`Bash on Ubuntu on Windows <https://github.com/Microsoft/BashOnWindows>`_ should also be a viable route for running the OCRmyPDF Docker container.
|
||||
|
||||
|
||||
Installing with Python pip
|
||||
--------------------------
|
||||
|
||||
OCRmyPDF is delivered by PyPI because it is a convenient way to install the latest version. However, PyPI and ``pip`` cannot address the fact that ``ocrmypdf`` depends on certain non-Python system libraries and programs being instsalled.
|
||||
|
||||
For best results, first install `your platform's version <https://repology.org/metapackage/ocrmypdf/versions>`_ of ``ocrmypdf``, using the instructions elsewhere in this document. Then you can use ``pip`` to get the latest version if your platform version is out of date. Chances are that this will satisfy most dependencies.
|
||||
|
||||
Use ``ocrmypdf --version`` to confirm what version was installed.
|
||||
|
||||
Then you can install the latest OCRmyPDF from the Python wheels. First try:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
pip3 install --user ocrmypdf
|
||||
|
||||
You should then be able to run ``ocrmypdf --version`` and see that the latest version was located.
|
||||
|
||||
Since ``pip3 install --user`` does not work correctly on some platforms, notably Ubuntu 16.04 and older, and the Homebrew version of Python, instead use this for a system wide installation:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
pip3 install ocrmypdf
|
||||
|
||||
Requirements for pip and HEAD install
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
OCRmyPDF currently requires these external programs and libraries to be installed, and must be satisfied using the operating system package manager. ``pip`` cannot provide them.
|
||||
|
||||
- Python 3.5 or newer
|
||||
- Ghostscript 9.15 or newer
|
||||
- libexempi3 2.2.0 or newer
|
||||
- qpdf 8.1.0 or newer
|
||||
- Tesseract 3.04 or newer
|
||||
|
||||
As of ocrmypdf 7.0.0, the following versions are recommended:
|
||||
|
||||
- Python 3.7
|
||||
- Ghostscript 9.23
|
||||
- libexempi3 2.4.5
|
||||
- qpdf 8.1.0
|
||||
- Tesseract 4.0.0-beta1
|
||||
- jbig2enc 0.29 or newer
|
||||
- pngquant 2.5 or newer
|
||||
- unpaper 6.1
|
||||
|
||||
jbig2enc, pngquant, and unpaper are optional. If missing certain features are disabled. OCRmyPDF will discover them as soon as they are available.
|
||||
|
||||
**jbig2enc**, if present, will be used to optimize the encoding of monochrome images. This can significantly reduce the file size of the output file. It is not required. `jbig2enc <https://github.com/agl/jbig2enc>`_ is not generally available for Ubuntu or Debian due to lingering concerns about patent issues, but can easily be built from source. To add JBIG2 encoding, see :ref:`jbig2`.
|
||||
|
||||
**pngquant**, if present, is optionally used to optimize the encoding of PNG-style images in PDFs (actually, any that are that losslessly encoded) by lossily quantizing to a smaller color palette. It is only activated then the ``--optimize`` argument is ``2`` or ``3``.
|
||||
|
||||
**unpaper**, if present, enables the ``--clean`` and ``--clean-final`` command line options.
|
||||
|
||||
These are in addition to the Python packaging dependencies, meaning that unfortunately, the ``pip install`` command cannot satisfy all of them.
|
||||
|
||||
Python 3.7 and Tesseract 4.0.0-beta.1 are recommended for best OCR results and best performance.
|
||||
|
||||
|
||||
Installing HEAD revision from sources
|
||||
-------------------------------------
|
||||
|
||||
If you have ``git`` and Python 3.5 or newer installed, you can install from source. When the ``pip`` installer runs,
|
||||
it will alert you if dependencies are missing.
|
||||
If you have ``git`` and Python 3.5 or newer installed, you can install from source. When the ``pip`` installer runs, it will alert you if dependencies are missing.
|
||||
|
||||
If you prefer to build every from source, you will need to `build pikepdf from source <https://pikepdf.readthedocs.io/en/latest/installation.html#building-from-source>`_. First ensure you can build and install pikepdf.
|
||||
|
||||
To install the HEAD revision from sources in the current Python 3 environment:
|
||||
|
||||
@@ -327,15 +500,7 @@ Or, to install in `development mode <https://pythonhosted.org/setuptools/setupto
|
||||
|
||||
pip3 install -e git+https://github.com/jbarlow83/OCRmyPDF.git
|
||||
|
||||
On certain Linux distributions such as Ubuntu, you may need to use
|
||||
run the install command as superuser:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
sudo pip3 install [-e] git+https://github.com/jbarlow83/OCRmyPDF.git
|
||||
|
||||
Note that this will alter your system's Python distribution. If you prefer
|
||||
to not install as superuser, you can install the package in a Python virtual environment:
|
||||
You may find it easiest to install in a virtual environment, rather than system-wide:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
@@ -345,8 +510,8 @@ to not install as superuser, you can install the package in a Python virtual env
|
||||
cd OCRmyPDF
|
||||
pip3 install .
|
||||
|
||||
However, ``ocrmypdf`` will only be accessible on the system PATH after
|
||||
you activate the virtual environment.
|
||||
However, ``ocrmypdf`` will only be accessible on the system PATH
|
||||
when you activate the virtual environment.
|
||||
|
||||
To run the program:
|
||||
|
||||
@@ -358,3 +523,19 @@ If not yet installed, the script will notify you about dependencies that
|
||||
need to be installed. The script requires specific versions of the
|
||||
dependencies. Older version than the ones mentioned in the release notes
|
||||
are likely not to be compatible to OCRmyPDF.
|
||||
|
||||
For development
|
||||
~~~~~~~~~~~~~~~
|
||||
|
||||
To install all of the development and test requirements:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
git clone -b master https://github.com/jbarlow83/OCRmyPDF.git
|
||||
python3 -m venv
|
||||
source venv/bin/activate
|
||||
cd OCRmyPDF
|
||||
pip install -e .
|
||||
pip install -r dev_requirements.txt -r test_requirements.txt
|
||||
|
||||
To add JBIG2 encoding, see :ref:`jbig2`.
|
||||
|
||||
+20
-14
@@ -1,9 +1,7 @@
|
||||
Introduction
|
||||
============
|
||||
|
||||
OCRmyPDF is a Python 3 package that adds OCR layers to PDFs.
|
||||
|
||||
|
||||
About OCR
|
||||
---------
|
||||
|
||||
@@ -16,7 +14,7 @@ OCRmyPDF uses `Tesseract <https://github.com/tesseract-ocr/tesseract>`_, the bes
|
||||
About PDFs
|
||||
----------
|
||||
|
||||
PDFs are page description files that attempts to preserve a layout exactly. They can contain `vector graphic files <http://vector-conversions.com/vectorizing/raster_vs_vector.html>`_ that can contain raster objects such as scanned images. Because PDFs can contain multiple pages (unlike many image formats) and can contain fonts and text, it is a good formats for exchanging scanned documents.
|
||||
PDFs are page description files that attempts to preserve a layout exactly. They contain `vector graphics <http://vector-conversions.com/vectorizing/raster_vs_vector.html>`_ that can contain raster objects such as scanned images. Because PDFs can contain multiple pages (unlike many image formats) and can contain fonts and text, it is a good formats for exchanging scanned documents.
|
||||
|
||||
.. image:: bitmap_vs_svg.svg
|
||||
|
||||
@@ -42,15 +40,13 @@ PDF/A has a few drawbacks. Some PDF viewers include an alert that the file is a
|
||||
What OCRmyPDF does
|
||||
------------------
|
||||
|
||||
OCRmyPDF analyzes each page of a PDF to determine the colorspace and resolution (DPI) needed to capture all of the information on that page without losing content. It uses `Ghostscript <http://ghostscript.com/>`_ to rasterize the page, and then performs on OCR on the rasterized image. It is not enough to simply extract the images from each page and run OCR on them individually. Of course one could use Ghostscript or another PDF rasterizer and then pass the image to Tesseract. OCRmyPDF automates this process and produces a minimally changed output file that contains the same information, colorspace and resolution.
|
||||
OCRmyPDF analyzes each page of a PDF to determine the colorspace and resolution (DPI) needed to capture all of the information on that page without losing content. It uses `Ghostscript <http://ghostscript.com/>`_ to rasterize the page, and then performs on OCR on the rasterized image to create an OCR "layer". The layer is then grafted back onto the original PDF.
|
||||
|
||||
The Tesseract OCR engine can output 'hOCR' files, which are XML files that contain a description of the text it found on the page. OCRmyPDF will render a new PDF that contains only the hidden text layer, and merge this with the original page.
|
||||
While one can use a program like Ghostscript or ImageMagick to get an image and put the image through Tesseract, that actually creates a new PDF and many details may be lost. OCRmyPDF can produce a minimally changed PDF as output.
|
||||
|
||||
Alternately, OCRmyPDF can use the Tesseract OCR engine to directly output PDFs for each page, then merge them.
|
||||
OCRmyPDF also some image processing options like deskew which improve the appearance of files and quality of OCR. When these are used, the OCR layer is grafted onto the processed image instead.
|
||||
|
||||
By default, OCRmyPDF will convert the file to a PDF/A. This behavior can be disabled with the ``--output-type pdf`` argument.
|
||||
|
||||
Depending on the settings selected, OCRmyPDF may "graft" the OCR layer into the existing PDF, or reconstruct a visually equivalent new PDF.
|
||||
By default, OCRmyPDF produces archival PDFs – PDF/A, which are a stricter subset of PDF features designed for long term archives. If regular PDFs are desired, this can be disabled with ``--output-type pdf``.
|
||||
|
||||
|
||||
Why you shouldn't do this manually
|
||||
@@ -68,6 +64,8 @@ In the case of a PDF that is nothing other than a container of images (no rotati
|
||||
|
||||
OCRmyPDF uses several strategies depending on input options and the input PDF itself, but generally speaking it rasterizes a page for OCR and then grafts the OCR back onto the original. As such it can handle complex PDFs and still preserve their contents as much as possible.
|
||||
|
||||
OCRmyPDF also supports a many, many edge cases that have cropped over several years of development. We support PDF features like images inside of Form XObjects, and pages with UserUnit scaling. We support rare image formats like non-monochrome 1-bit images. Thanks to pikepdf and QPDF, we auto-repair PDFs that are damaged. (Not that you need to know what any of these are! You should be able to throw any PDF at it.)
|
||||
|
||||
|
||||
Limitations
|
||||
-----------
|
||||
@@ -80,20 +78,23 @@ OCRmyPDF is limited by the Tesseract OCR engine. As such it experiences these l
|
||||
* If a document contains languages outside of those given in the ``-l LANG`` arguments, results may be poor.
|
||||
* It is not always good at analyzing the natural reading order of documents. For example, it may fail to recognize that a document contains two columns and join text across the columns.
|
||||
* Poor quality scans may produce poor quality OCR. Garbage in, garbage out.
|
||||
* PDFs that use transparent layers are not currently checked in the test suite, so they may not work correctly.
|
||||
|
||||
* It does not expose information about what font family text belongs to.
|
||||
|
||||
OCRmyPDF is also limited by the PDF specification:
|
||||
|
||||
* PDF encodes the position of text glyphs but does not encode document structure. There is no markup that divides a document in sections, paragraphs, sentences, or even words (since blank spaces are not represented). As such all elements of document structure including the spaces between words must be derived heuristically. Some PDF viewers do a better job of this than others.
|
||||
* Because some popular open source PDF viewers have a particularly hard time with spaces betweem words, OCRmyPDF appends a space to each text element as a workaround. While this mixes document structure with graphical information that ideally should be left to the PDF viewer to interpret, it improves compatibility with some viewers and does not cause problems for better ones.
|
||||
|
||||
Ghostscript also imposes some limitations:
|
||||
|
||||
* PDFs containing JBIG2-encoded content will be converted to CCITT Group4 encoding, which has lower compression ratios, if Ghostscript PDF/A is enabled.
|
||||
* PDFs containing JPEG 2000-encoded content will be converted to JPEG encoding, which may introduce compression artifacts, if Ghostscript PDF/A is enabled.
|
||||
* Ghostscript may transcode grayscale and color images, either lossy to lossless or lossless to lossy, based on an internal algorithm. This behavior can be suppressed by setting ``--pdfa-image-compression`` to ``jpeg`` or ``lossless`` to set all images to one type or the other. Ghostscript has no option to maintain the input image's format.
|
||||
|
||||
OCRmyPDF is currently not designed to be used as a Python API; it is designed to be run as a command line tool. ``import ocrmypf`` currently attempts to process the command line on ``sys.argv`` at import time so it has side effects that will interfere with its use as a package. The API it presents should not be considered stable.
|
||||
|
||||
Regarding OCRmyPDF itself:
|
||||
|
||||
* PDFs that use transparency are not currently represented in the test suite
|
||||
* The Python API exported by ``import ocrmypdf`` is design to help scripts that use OCRmyPDF but is not currently capable of running OCRmyPDF jobs due to limitations in an underlying library.
|
||||
|
||||
Similar programs
|
||||
----------------
|
||||
@@ -105,5 +106,10 @@ To the author's knowledge, OCRmyPDF is the most feature-rich and thoroughly test
|
||||
* pypdfocr
|
||||
* pdfbeads
|
||||
|
||||
If you are looking for a micro web-frontend for OCRmyPDF, consider the third-party `OCRmyPDF-web <https://github.com/sseemayer/OCRmyPDF-web>`_. Bear in mind that OCRmyPDF is not designed to be secure against malware-bearing PDFs (see `Using OCRmyPDF online`_).
|
||||
Web front-ends
|
||||
--------------
|
||||
|
||||
* `Nextcloud OCR <https://github.com/janis91/ocr>`_ is a free software plugin for the Nextcloud private cloud software
|
||||
* `OCRmyPDF-web <https://github.com/sseemayer/OCRmyPDF-web>`_, a micro web-frontend for OCRmyPDF (third-party, not actively maintained)
|
||||
|
||||
Bear in mind that OCRmyPDF is not designed to be secure against malware-bearing PDFs (see `Using OCRmyPDF online`_).
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
.. _jbig2:
|
||||
|
||||
Installing the JBIG2 encoder
|
||||
============================
|
||||
|
||||
Most Linux distributions do not include a JBIG2 encoder since JBIG2 encoding was patented for a long time. All known JBIG2 US patents have expired as of 2017, but it is possible that unknown patents exist.
|
||||
|
||||
JBIG2 encoding is recommended for OCRmyPDF and is used to losslessly create smaller PDFs. If JBIG2 encoding not available, lower quality encodings will be used.
|
||||
|
||||
JBIG2 decoding is not patented and is performed automatically by most PDF viewers. It is widely supported has been part of the PDF specification since 2001.
|
||||
|
||||
On macOS, Homebrew packages jbig2enc and OCRmyPDF includes it by default. The Docker image for OCRmyPDF also builds its own JBIG2 encoder from source.
|
||||
|
||||
For all other Linux, you must build a JBIG2 encoder from source:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
git clone https://github.com/agl/jbig2enc
|
||||
cd jbig2enc
|
||||
./autogen.sh
|
||||
./configure && make
|
||||
[sudo] make install
|
||||
|
||||
.. _jbig2-lossy:
|
||||
|
||||
Lossy mode JBIG2
|
||||
----------------
|
||||
|
||||
OCRmyPDF provides lossy mode JBIG2 as an advanced feature. Users should `review the technical concerns with JBIG2 in lossy mode <https://abbyy.technology/en:kb:tip:jbig2_compression_and_ocr>`_ and decide if this feature is acceptable for their use case.
|
||||
|
||||
JBIG2 lossy mode does achieve higher compression ratios than any other monochrome (bitonal) compression technology; for large text documents the savings are considerable. JBIG2 lossless still gives great compression ratios and is a major improvement over the older CCITT G4 standard. As explained above, there is some risk of substitution errors.
|
||||
|
||||
To turn on JBIG2 lossy mode, add the argument ``--jbig2-lossy``. ``--optimize {1,2,3}`` are necessary for the argument to take effect also required. Also, a JBIG2 encoder must be installed as described in the previous section.
|
||||
|
||||
*ocrmypdf v7.0 and v7.1 used lossy mode by default.*
|
||||
+20
-7
@@ -33,16 +33,29 @@ Docker users
|
||||
|
||||
Users of the Docker image may use the alternative :ref:`"polyglot" container <docker-polyglot>` which includes all languages.
|
||||
|
||||
Known limitations
|
||||
-----------------
|
||||
Adding individual language packs to a Docker image
|
||||
""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
|
||||
As of v4.2, users of ocrmypdf working languages outside the Latin alphabet should use the following syntax:
|
||||
If you wish to add a single language pack, you could do the following:
|
||||
|
||||
* Download the desired ``.trainedata`` file from the `tessdata <https://github.com/tesseract-ocr/tessdata>`_ repository. Let's use Hebrew in this example (``heb.traineddata``)
|
||||
|
||||
* Copy the file to ``/home/user/downloads/heb.traineddata``.
|
||||
|
||||
* Create a new container based on the ocrmypdf-tess4 image and jump into it with a terminal:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
ocrmypdf -l eng+gre --output-type pdf --pdf-renderer tesseract
|
||||
host$ docker run -v /home/user/downloads:/home/docker -it --entrypoint /bin/bash ocrmypdf-tess4
|
||||
|
||||
The reasons for this are:
|
||||
* Put the file where Tesseract expects it:
|
||||
|
||||
* The latest version of Ghostscript (9.19 as of this writing) has unfixed bugs in Unicode handling that generate invalid character maps, so Ghostscript cannot be used for PDF/A conversion
|
||||
* The default "hocr" PDF renderer does not handle Asian fonts properly
|
||||
.. code-block:: bash
|
||||
|
||||
docker$ cp /home/docker/heb.traineddata /usr/share/tesseract-ocr/tessdata
|
||||
|
||||
* Note the container id, and save it as a new image (in this example, ``ocrmypdf-tess4-heb``)
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
host$ docker commit <container_id> ocrmypdf-tess4-heb
|
||||
|
||||
+358
-358
@@ -1,392 +1,392 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
|
||||
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<!-- Generated by graphviz version 2.38.0 (20140413.2041)
|
||||
<!-- Generated by graphviz version 2.40.1 (20161225.0304)
|
||||
-->
|
||||
<!-- Title: Pipeline: Pages: 1 -->
|
||||
<svg width="1544pt" height="1089pt"
|
||||
viewBox="0.00 0.00 1544.00 1089.14" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 1085.14)">
|
||||
<svg width="1484pt" height="1277pt"
|
||||
viewBox="0.00 0.00 1484.00 1277.20" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 1273.1977)">
|
||||
<title>Pipeline:</title>
|
||||
<polygon fill="white" stroke="none" points="-4,4 -4,-1085.14 1540,-1085.14 1540,4 -4,4"/>
|
||||
<g id="clust1" class="cluster"><title>clustertasks</title>
|
||||
<polygon fill="none" stroke="black" points="8,-8 8,-1073.14 1528,-1073.14 1528,-8 8,-8"/>
|
||||
<text text-anchor="middle" x="768" y="-1045.14" font-family="Times,serif" font-size="30.00" fill="#ff3232">Pipeline:</text>
|
||||
<polygon fill="#ffffff" stroke="transparent" points="-4,4 -4,-1273.1977 1480,-1273.1977 1480,4 -4,4"/>
|
||||
<g id="clust1" class="cluster">
|
||||
<title>clustertasks</title>
|
||||
<polygon fill="none" stroke="#000000" points="8,-8 8,-1261.1977 1468,-1261.1977 1468,-8 8,-8"/>
|
||||
<text text-anchor="middle" x="738" y="-1233.1977" font-family="Times,serif" font-size="30.00" fill="#ff3232">Pipeline:</text>
|
||||
</g>
|
||||
<!-- t0 -->
|
||||
<g id="node1" class="node"><title>t0</title>
|
||||
<polygon fill="#efa03b" stroke="black" points="750.705,-1027.14 541.295,-1027.14 537.295,-1023.14 537.295,-991.141 746.705,-991.141 750.705,-995.141 750.705,-1027.14"/>
|
||||
<polyline fill="none" stroke="black" points="746.705,-1023.14 537.295,-1023.14 "/>
|
||||
<polyline fill="none" stroke="black" points="746.705,-1023.14 746.705,-991.141 "/>
|
||||
<polyline fill="none" stroke="black" points="746.705,-1023.14 750.705,-1027.14 "/>
|
||||
<text text-anchor="middle" x="644" y="-1003.14" font-family="Times,serif" font-size="20.00">ocrmypdf.pipeline.triage</text>
|
||||
<g id="node1" class="node">
|
||||
<title>t0</title>
|
||||
<polygon fill="#efa03b" stroke="#000000" points="1215.7053,-1215.1977 1006.2947,-1215.1977 1002.2947,-1211.1977 1002.2947,-1179.1977 1211.7053,-1179.1977 1215.7053,-1183.1977 1215.7053,-1215.1977"/>
|
||||
<polyline fill="none" stroke="#000000" points="1211.7053,-1211.1977 1002.2947,-1211.1977 "/>
|
||||
<polyline fill="none" stroke="#000000" points="1211.7053,-1211.1977 1211.7053,-1179.1977 "/>
|
||||
<polyline fill="none" stroke="#000000" points="1211.7053,-1211.1977 1215.7053,-1215.1977 "/>
|
||||
<text text-anchor="middle" x="1109" y="-1191.1977" font-family="Times,serif" font-size="20.00" fill="#000000">ocrmypdf.pipeline.triage</text>
|
||||
</g>
|
||||
<!-- t1 -->
|
||||
<g id="node2" class="node"><title>t1</title>
|
||||
<polygon fill="#efa03b" stroke="black" points="769.969,-969.141 522.031,-969.141 518.031,-965.141 518.031,-933.141 765.969,-933.141 769.969,-937.141 769.969,-969.141"/>
|
||||
<polyline fill="none" stroke="black" points="765.969,-965.141 518.031,-965.141 "/>
|
||||
<polyline fill="none" stroke="black" points="765.969,-965.141 765.969,-933.141 "/>
|
||||
<polyline fill="none" stroke="black" points="765.969,-965.141 769.969,-969.141 "/>
|
||||
<text text-anchor="middle" x="644" y="-945.141" font-family="Times,serif" font-size="20.00">ocrmypdf.pipeline.repair_pdf</text>
|
||||
<g id="node2" class="node">
|
||||
<title>t1</title>
|
||||
<polygon fill="#efa03b" stroke="#000000" points="1280.0433,-1157.1977 941.9567,-1157.1977 937.9567,-1153.1977 937.9567,-1121.1977 1276.0433,-1121.1977 1280.0433,-1125.1977 1280.0433,-1157.1977"/>
|
||||
<polyline fill="none" stroke="#000000" points="1276.0433,-1153.1977 937.9567,-1153.1977 "/>
|
||||
<polyline fill="none" stroke="#000000" points="1276.0433,-1153.1977 1276.0433,-1121.1977 "/>
|
||||
<polyline fill="none" stroke="#000000" points="1276.0433,-1153.1977 1280.0433,-1157.1977 "/>
|
||||
<text text-anchor="middle" x="1109" y="-1133.1977" font-family="Times,serif" font-size="20.00" fill="#000000">ocrmypdf.pipeline.repair_and_parse_pdf</text>
|
||||
</g>
|
||||
<!-- t0->t1 -->
|
||||
<g id="edge1" class="edge"><title>t0->t1</title>
|
||||
<path fill="none" stroke="#0044a0" d="M644,-991.035C644,-987.344 644,-983.354 644,-979.384"/>
|
||||
<polygon fill="#0044a0" stroke="#0044a0" points="647.5,-979.142 644,-969.142 640.5,-979.142 647.5,-979.142"/>
|
||||
<g id="edge1" class="edge">
|
||||
<title>t0->t1</title>
|
||||
<path fill="none" stroke="#0044a0" d="M1109,-1179.1641C1109,-1175.4895 1109,-1171.5395 1109,-1167.604"/>
|
||||
<polygon fill="#0044a0" stroke="#0044a0" points="1112.5001,-1167.4199 1109,-1157.4199 1105.5001,-1167.42 1112.5001,-1167.4199"/>
|
||||
</g>
|
||||
<!-- t2 -->
|
||||
<g id="node3" class="node"><title>t2</title>
|
||||
<polygon fill="#efa03b" stroke="black" points="869.82,-890.215 644,-907.116 418.18,-890.215 418.391,-862.869 869.609,-862.869 869.82,-890.215"/>
|
||||
<polygon fill="none" stroke="black" points="873.852,-893.922 644,-911.125 414.148,-893.922 414.419,-858.871 873.581,-858.871 873.852,-893.922"/>
|
||||
<text text-anchor="middle" x="644" y="-876.657" font-family="Times,serif" font-size="20.00">ocrmypdf.pipeline.split_pages</text>
|
||||
<g id="node3" class="node">
|
||||
<title>t2</title>
|
||||
<polygon fill="#efa03b" stroke="#000000" points="1030.0926,-1078.2732 785,-1095.1731 539.9074,-1078.2732 540.1362,-1050.9285 1029.8638,-1050.9285 1030.0926,-1078.2732"/>
|
||||
<polygon fill="none" stroke="#000000" points="1034.1249,-1082.0021 785,-1099.1801 535.8751,-1082.0021 536.1685,-1046.931 1033.8315,-1046.931 1034.1249,-1082.0021"/>
|
||||
<text text-anchor="middle" x="785" y="-1064.7153" font-family="Times,serif" font-size="20.00" fill="#000000">ocrmypdf.pipeline.marker_pages</text>
|
||||
</g>
|
||||
<!-- t1->t2 -->
|
||||
<g id="edge2" class="edge"><title>t1->t2</title>
|
||||
<path fill="none" stroke="#0044a0" d="M644,-933.019C644,-929.4 644,-925.445 644,-921.399"/>
|
||||
<polygon fill="#0044a0" stroke="#0044a0" points="647.5,-921.295 644,-911.295 640.5,-921.295 647.5,-921.295"/>
|
||||
</g>
|
||||
<!-- t18 -->
|
||||
<g id="node20" class="node"><title>t18</title>
|
||||
<polygon fill="#efa03b" stroke="black" points="383.516,-832.173 20.4844,-832.173 16.4844,-828.173 16.4844,-796.173 379.516,-796.173 383.516,-800.173 383.516,-832.173"/>
|
||||
<polyline fill="none" stroke="black" points="379.516,-828.173 16.4844,-828.173 "/>
|
||||
<polyline fill="none" stroke="black" points="379.516,-828.173 379.516,-796.173 "/>
|
||||
<polyline fill="none" stroke="black" points="379.516,-828.173 383.516,-832.173 "/>
|
||||
<text text-anchor="middle" x="200" y="-808.173" font-family="Times,serif" font-size="20.00">ocrmypdf.pipeline.generate_postscript_stub</text>
|
||||
</g>
|
||||
<!-- t1->t18 -->
|
||||
<g id="edge29" class="edge"><title>t1->t18</title>
|
||||
<path fill="none" stroke="#0044a0" d="M518.14,-936.259C481.198,-930.408 441.05,-922.284 405,-911.141 344.394,-892.407 278.709,-859.14 238.448,-837.118"/>
|
||||
<polygon fill="#0044a0" stroke="#0044a0" points="239.963,-833.956 229.517,-832.188 236.581,-840.085 239.963,-833.956"/>
|
||||
</g>
|
||||
<!-- t21 -->
|
||||
<g id="node22" class="node"><title>t21</title>
|
||||
<polygon fill="#efa03b" stroke="black" points="751.49,-156.424 963,-129.109 1174.51,-156.424 1174.31,-200.62 751.688,-200.62 751.49,-156.424"/>
|
||||
<polygon fill="none" stroke="black" points="747.474,-152.906 963,-125.073 1178.53,-152.906 1178.29,-204.623 747.705,-204.623 747.474,-152.906"/>
|
||||
<text text-anchor="middle" x="963" y="-162.639" font-family="Times,serif" font-size="20.00">ocrmypdf.pipeline.merge_pages_qpdf</text>
|
||||
</g>
|
||||
<!-- t1->t21 -->
|
||||
<g id="edge39" class="edge"><title>t1->t21</title>
|
||||
<path fill="none" stroke="#0044a0" d="M769.832,-943.539C1011.96,-929.143 1519,-890.056 1519,-815.173 1519,-815.173 1519,-815.173 1519,-309.173 1519,-237.474 1342.87,-202.283 1188.87,-185.216"/>
|
||||
<polygon fill="#0044a0" stroke="#0044a0" points="1189.08,-181.719 1178.76,-184.118 1188.32,-188.678 1189.08,-181.719"/>
|
||||
</g>
|
||||
<!-- t3 -->
|
||||
<g id="node4" class="node"><title>t3</title>
|
||||
<polygon fill="#efa03b" stroke="black" points="712.317,-832.173 405.683,-832.173 401.683,-828.173 401.683,-796.173 708.317,-796.173 712.317,-800.173 712.317,-832.173"/>
|
||||
<polyline fill="none" stroke="black" points="708.317,-828.173 401.683,-828.173 "/>
|
||||
<polyline fill="none" stroke="black" points="708.317,-828.173 708.317,-796.173 "/>
|
||||
<polyline fill="none" stroke="black" points="708.317,-828.173 712.317,-832.173 "/>
|
||||
<text text-anchor="middle" x="557" y="-808.173" font-family="Times,serif" font-size="20.00">ocrmypdf.pipeline.rasterize_preview</text>
|
||||
</g>
|
||||
<!-- t2->t3 -->
|
||||
<g id="edge3" class="edge"><title>t2->t3</title>
|
||||
<path fill="none" stroke="#0044a0" d="M614.06,-858.777C605.418,-852.173 595.983,-844.963 587.319,-838.342"/>
|
||||
<polygon fill="#0044a0" stroke="#0044a0" points="589.37,-835.504 579.299,-832.213 585.119,-841.066 589.37,-835.504"/>
|
||||
</g>
|
||||
<!-- t4 -->
|
||||
<g id="node5" class="node"><title>t4</title>
|
||||
<polygon fill="#efa03b" stroke="black" points="688.082,-774.173 429.918,-774.173 425.918,-770.173 425.918,-738.173 684.082,-738.173 688.082,-742.173 688.082,-774.173"/>
|
||||
<polyline fill="none" stroke="black" points="684.082,-770.173 425.918,-770.173 "/>
|
||||
<polyline fill="none" stroke="black" points="684.082,-770.173 684.082,-738.173 "/>
|
||||
<polyline fill="none" stroke="black" points="684.082,-770.173 688.082,-774.173 "/>
|
||||
<text text-anchor="middle" x="557" y="-750.173" font-family="Times,serif" font-size="20.00">ocrmypdf.pipeline.orient_page</text>
|
||||
</g>
|
||||
<!-- t2->t4 -->
|
||||
<g id="edge5" class="edge"><title>t2->t4</title>
|
||||
<path fill="none" stroke="#0044a0" d="M695.691,-858.661C705.833,-851.667 715.136,-842.912 721,-832.173 728.668,-818.13 730.919,-808.727 721,-796.173 714.915,-788.471 700.759,-782.127 683.18,-776.959"/>
|
||||
<polygon fill="#0044a0" stroke="#0044a0" points="683.659,-773.462 673.091,-774.208 681.817,-780.216 683.659,-773.462"/>
|
||||
</g>
|
||||
<!-- t3->t4 -->
|
||||
<g id="edge4" class="edge"><title>t3->t4</title>
|
||||
<path fill="none" stroke="#0044a0" d="M557,-796.066C557,-792.375 557,-788.385 557,-784.415"/>
|
||||
<polygon fill="#0044a0" stroke="#0044a0" points="560.5,-784.174 557,-774.174 553.5,-784.174 560.5,-784.174"/>
|
||||
</g>
|
||||
<!-- t5 -->
|
||||
<g id="node6" class="node"><title>t5</title>
|
||||
<polygon fill="#efa03b" stroke="black" points="1064.73,-716.173 689.268,-716.173 685.268,-712.173 685.268,-680.173 1060.73,-680.173 1064.73,-684.173 1064.73,-716.173"/>
|
||||
<polyline fill="none" stroke="black" points="1060.73,-712.173 685.268,-712.173 "/>
|
||||
<polyline fill="none" stroke="black" points="1060.73,-712.173 1060.73,-680.173 "/>
|
||||
<polyline fill="none" stroke="black" points="1060.73,-712.173 1064.73,-716.173 "/>
|
||||
<text text-anchor="middle" x="875" y="-692.173" font-family="Times,serif" font-size="20.00">ocrmypdf.pipeline.rasterize_with_ghostscript</text>
|
||||
</g>
|
||||
<!-- t4->t5 -->
|
||||
<g id="edge6" class="edge"><title>t4->t5</title>
|
||||
<path fill="none" stroke="#0044a0" d="M653.706,-738.143C689.783,-731.789 730.943,-724.541 767.902,-718.033"/>
|
||||
<polygon fill="#0044a0" stroke="#0044a0" points="768.965,-721.399 778.206,-716.218 767.751,-714.505 768.965,-721.399"/>
|
||||
</g>
|
||||
<!-- t15 -->
|
||||
<g id="node13" class="node"><title>t15</title>
|
||||
<polygon fill="#ff69b4" stroke="black" points="440.27,-396.173 59.7304,-396.173 55.7304,-392.173 55.7304,-360.173 436.27,-360.173 440.27,-364.173 440.27,-396.173"/>
|
||||
<polyline fill="none" stroke="black" points="436.27,-392.173 55.7304,-392.173 "/>
|
||||
<polyline fill="none" stroke="black" points="436.27,-392.173 436.27,-360.173 "/>
|
||||
<polyline fill="none" stroke="black" points="436.27,-392.173 440.27,-396.173 "/>
|
||||
<text text-anchor="middle" x="248" y="-372.173" font-family="Times,serif" font-size="20.00">ocrmypdf.pipeline.ocr_tesseract_textonly_pdf</text>
|
||||
</g>
|
||||
<!-- t4->t15 -->
|
||||
<g id="edge14" class="edge"><title>t4->t15</title>
|
||||
<path fill="none" stroke="#0044a0" d="M425.857,-745.263C361.241,-732.425 297,-703.891 297,-641.173 297,-641.173 297,-641.173 297,-523.173 297,-480.18 277.182,-433.63 262.754,-405.436"/>
|
||||
<polygon fill="#0044a0" stroke="#0044a0" points="265.677,-403.477 257.916,-396.265 259.486,-406.743 265.677,-403.477"/>
|
||||
</g>
|
||||
<!-- t12 -->
|
||||
<g id="node15" class="node"><title>t12</title>
|
||||
<polygon fill="#00cc66" stroke="black" points="781,-406.173 458.414,-378.173 781,-350.173 1103.59,-378.173 781,-406.173"/>
|
||||
<text text-anchor="middle" x="781" y="-372.173" font-family="Times,serif" font-size="20.00">ocrmypdf.pipeline.select_image_layer</text>
|
||||
</g>
|
||||
<!-- t4->t12 -->
|
||||
<g id="edge20" class="edge"><title>t4->t12</title>
|
||||
<path fill="none" stroke="#0044a0" d="M471.449,-738.167C421.018,-722.605 367,-693.681 367,-641.173 367,-641.173 367,-641.173 367,-523.173 367,-480.717 347.218,-458.43 377,-428.173 392.917,-412.001 494.592,-399.721 591.948,-391.499"/>
|
||||
<polygon fill="#0044a0" stroke="#0044a0" points="592.284,-394.983 601.96,-390.666 591.704,-388.007 592.284,-394.983"/>
|
||||
</g>
|
||||
<!-- t19 -->
|
||||
<g id="node18" class="node"><title>t19</title>
|
||||
<polygon fill="#efa03b" stroke="black" points="323.772,-270.173 78.2284,-270.173 74.2284,-266.173 74.2284,-234.173 319.772,-234.173 323.772,-238.173 323.772,-270.173"/>
|
||||
<polyline fill="none" stroke="black" points="319.772,-266.173 74.2284,-266.173 "/>
|
||||
<polyline fill="none" stroke="black" points="319.772,-266.173 319.772,-234.173 "/>
|
||||
<polyline fill="none" stroke="black" points="319.772,-266.173 323.772,-270.173 "/>
|
||||
<text text-anchor="middle" x="199" y="-246.173" font-family="Times,serif" font-size="20.00">ocrmypdf.pipeline.skip_page</text>
|
||||
</g>
|
||||
<!-- t4->t19 -->
|
||||
<g id="edge26" class="edge"><title>t4->t19</title>
|
||||
<path fill="none" stroke="#0044a0" d="M425.782,-752.078C271.736,-744.795 37,-720.655 37,-641.173 37,-641.173 37,-641.173 37,-377.173 37,-325.92 88.7624,-292.989 133.769,-274.043"/>
|
||||
<polygon fill="#0044a0" stroke="#0044a0" points="135.289,-277.203 143.249,-270.211 132.666,-270.713 135.289,-277.203"/>
|
||||
</g>
|
||||
<!-- t17 -->
|
||||
<g id="node19" class="node"><title>t17</title>
|
||||
<polygon fill="#66ccff" stroke="black" points="1499.67,-328.173 1094.33,-328.173 1090.33,-324.173 1090.33,-292.173 1495.67,-292.173 1499.67,-296.173 1499.67,-328.173"/>
|
||||
<polyline fill="none" stroke="black" points="1495.67,-324.173 1090.33,-324.173 "/>
|
||||
<polyline fill="none" stroke="black" points="1495.67,-324.173 1495.67,-292.173 "/>
|
||||
<polyline fill="none" stroke="black" points="1495.67,-324.173 1499.67,-328.173 "/>
|
||||
<text text-anchor="middle" x="1295" y="-304.173" font-family="Times,serif" font-size="20.00">ocrmypdf.pipeline.ocr_tesseract_and_render_pdf</text>
|
||||
</g>
|
||||
<!-- t4->t17 -->
|
||||
<g id="edge28" class="edge"><title>t4->t17</title>
|
||||
<path fill="none" stroke="#0044a0" d="M688.477,-752.611C947.521,-745.804 1499,-721.841 1499,-641.173 1499,-641.173 1499,-641.173 1499,-455.173 1499,-407.201 1508.25,-383.766 1474,-350.173 1465.98,-342.302 1448.74,-335.804 1427.99,-330.522"/>
|
||||
<polygon fill="#0044a0" stroke="#0044a0" points="1428.77,-327.11 1418.23,-328.18 1427.14,-333.917 1428.77,-327.11"/>
|
||||
</g>
|
||||
<!-- t6 -->
|
||||
<g id="node7" class="node"><title>t6</title>
|
||||
<polygon fill="#efa03b" stroke="black" points="1089.08,-658.173 664.92,-658.173 660.92,-654.173 660.92,-622.173 1085.08,-622.173 1089.08,-626.173 1089.08,-658.173"/>
|
||||
<polyline fill="none" stroke="black" points="1085.08,-654.173 660.92,-654.173 "/>
|
||||
<polyline fill="none" stroke="black" points="1085.08,-654.173 1085.08,-622.173 "/>
|
||||
<polyline fill="none" stroke="black" points="1085.08,-654.173 1089.08,-658.173 "/>
|
||||
<text text-anchor="middle" x="875" y="-634.173" font-family="Times,serif" font-size="20.00">ocrmypdf.pipeline.preprocess_remove_background</text>
|
||||
</g>
|
||||
<!-- t5->t6 -->
|
||||
<g id="edge7" class="edge"><title>t5->t6</title>
|
||||
<path fill="none" stroke="#0044a0" d="M875,-680.066C875,-676.375 875,-672.385 875,-668.415"/>
|
||||
<polygon fill="#0044a0" stroke="#0044a0" points="878.5,-668.174 875,-658.174 871.5,-668.174 878.5,-668.174"/>
|
||||
</g>
|
||||
<!-- t11 -->
|
||||
<g id="node14" class="node"><title>t11</title>
|
||||
<polygon fill="#efa03b" stroke="black" points="1096,-484.173 712.187,-456.173 1096,-428.173 1479.81,-456.173 1096,-484.173"/>
|
||||
<text text-anchor="middle" x="1096" y="-450.173" font-family="Times,serif" font-size="20.00">ocrmypdf.pipeline.select_visible_page_image</text>
|
||||
</g>
|
||||
<!-- t5->t11 -->
|
||||
<g id="edge18" class="edge"><title>t5->t11</title>
|
||||
<path fill="none" stroke="#0044a0" d="M1051.07,-680.0px8C1072.76,-674.712 1090.1,-667.576 1098,-658.173 1136.53,-612.317 1122.5,-537.602 1109.06,-493.335"/>
|
||||
<polygon fill="#0044a0" stroke="#0044a0" points="1112.33,-492.043 1105.96,-483.573 1105.65,-494.164 1112.33,-492.043"/>
|
||||
</g>
|
||||
<!-- t7 -->
|
||||
<g id="node8" class="node"><title>t7</title>
|
||||
<polygon fill="#efa03b" stroke="black" points="1039.68,-600.173 720.324,-600.173 716.324,-596.173 716.324,-564.173 1035.68,-564.173 1039.68,-568.173 1039.68,-600.173"/>
|
||||
<polyline fill="none" stroke="black" points="1035.68,-596.173 716.324,-596.173 "/>
|
||||
<polyline fill="none" stroke="black" points="1035.68,-596.173 1035.68,-564.173 "/>
|
||||
<polyline fill="none" stroke="black" points="1035.68,-596.173 1039.68,-600.173 "/>
|
||||
<text text-anchor="middle" x="878" y="-576.173" font-family="Times,serif" font-size="20.00">ocrmypdf.pipeline.preprocess_deskew</text>
|
||||
</g>
|
||||
<!-- t6->t7 -->
|
||||
<g id="edge8" class="edge"><title>t6->t7</title>
|
||||
<path fill="none" stroke="#0044a0" d="M875.916,-622.066C876.114,-618.375 876.328,-614.385 876.541,-610.415"/>
|
||||
<polygon fill="#0044a0" stroke="#0044a0" points="880.049,-610.347 877.089,-600.174 873.059,-609.972 880.049,-610.347"/>
|
||||
</g>
|
||||
<!-- t6->t11 -->
|
||||
<g id="edge17" class="edge"><title>t6->t11</title>
|
||||
<path fill="none" stroke="#0044a0" d="M990.695,-622.152C1016.54,-616.369 1039.2,-609.066 1049,-600.173 1078.78,-573.156 1089.74,-526.964 1093.74,-494.403"/>
|
||||
<polygon fill="#0044a0" stroke="#0044a0" points="1097.24,-494.666 1094.82,-484.351 1090.28,-493.924 1097.24,-494.666"/>
|
||||
</g>
|
||||
<!-- t8 -->
|
||||
<g id="node9" class="node"><title>t8</title>
|
||||
<polygon fill="#efa03b" stroke="black" points="1030.88,-542.173 729.117,-542.173 725.117,-538.173 725.117,-506.173 1026.88,-506.173 1030.88,-510.173 1030.88,-542.173"/>
|
||||
<polyline fill="none" stroke="black" points="1026.88,-538.173 725.117,-538.173 "/>
|
||||
<polyline fill="none" stroke="black" points="1026.88,-538.173 1026.88,-506.173 "/>
|
||||
<polyline fill="none" stroke="black" points="1026.88,-538.173 1030.88,-542.173 "/>
|
||||
<text text-anchor="middle" x="878" y="-518.173" font-family="Times,serif" font-size="20.00">ocrmypdf.pipeline.preprocess_clean</text>
|
||||
</g>
|
||||
<!-- t7->t8 -->
|
||||
<g id="edge9" class="edge"><title>t7->t8</title>
|
||||
<path fill="none" stroke="#0044a0" d="M878,-564.066C878,-560.375 878,-556.385 878,-552.415"/>
|
||||
<polygon fill="#0044a0" stroke="#0044a0" points="881.5,-552.174 878,-542.174 874.5,-552.174 881.5,-552.174"/>
|
||||
</g>
|
||||
<!-- t7->t11 -->
|
||||
<g id="edge16" class="edge"><title>t7->t11</title>
|
||||
<path fill="none" stroke="#0044a0" d="M995.441,-564.147C1011.26,-558.713 1026.62,-551.566 1040,-542.173 1057.45,-529.919 1070.89,-510.334 1080.22,-493.051"/>
|
||||
<polygon fill="#0044a0" stroke="#0044a0" points="1083.55,-494.243 1084.99,-483.747 1077.31,-491.053 1083.55,-494.243"/>
|
||||
</g>
|
||||
<!-- t9 -->
|
||||
<g id="node10" class="node"><title>t9</title>
|
||||
<polygon fill="#efa03b" stroke="black" points="694.109,-474.173 389.891,-474.173 385.891,-470.173 385.891,-438.173 690.109,-438.173 694.109,-442.173 694.109,-474.173"/>
|
||||
<polyline fill="none" stroke="black" points="690.109,-470.173 385.891,-470.173 "/>
|
||||
<polyline fill="none" stroke="black" points="690.109,-470.173 690.109,-438.173 "/>
|
||||
<polyline fill="none" stroke="black" points="690.109,-470.173 694.109,-474.173 "/>
|
||||
<text text-anchor="middle" x="540" y="-450.173" font-family="Times,serif" font-size="20.00">ocrmypdf.pipeline.select_ocr_image</text>
|
||||
</g>
|
||||
<!-- t8->t9 -->
|
||||
<g id="edge10" class="edge"><title>t8->t9</title>
|
||||
<path fill="none" stroke="#0044a0" d="M790.517,-506.09C743.487,-496.907 685.383,-485.561 636.976,-476.109"/>
|
||||
<polygon fill="#0044a0" stroke="#0044a0" points="637.602,-472.665 627.116,-474.183 636.26,-479.535 637.602,-472.665"/>
|
||||
</g>
|
||||
<!-- t8->t11 -->
|
||||
<g id="edge15" class="edge"><title>t8->t11</title>
|
||||
<path fill="none" stroke="#0044a0" d="M934.424,-506.09C958.693,-498.742 987.536,-490.01 1014.09,-481.971"/>
|
||||
<polygon fill="#0044a0" stroke="#0044a0" points="1015.2,-485.293 1023.75,-479.045 1013.17,-478.593 1015.2,-485.293"/>
|
||||
</g>
|
||||
<!-- t10 -->
|
||||
<g id="node11" class="node"><title>t10</title>
|
||||
<polygon fill="#00cc66" stroke="black" points="1440.1,-396.173 1125.9,-396.173 1121.9,-392.173 1121.9,-360.173 1436.1,-360.173 1440.1,-364.173 1440.1,-396.173"/>
|
||||
<polyline fill="none" stroke="black" points="1436.1,-392.173 1121.9,-392.173 "/>
|
||||
<polyline fill="none" stroke="black" points="1436.1,-392.173 1436.1,-360.173 "/>
|
||||
<polyline fill="none" stroke="black" points="1436.1,-392.173 1440.1,-396.173 "/>
|
||||
<text text-anchor="middle" x="1281" y="-372.173" font-family="Times,serif" font-size="20.00">ocrmypdf.pipeline.ocr_tesseract_hocr</text>
|
||||
</g>
|
||||
<!-- t9->t10 -->
|
||||
<g id="edge11" class="edge"><title>t9->t10</title>
|
||||
<path fill="none" stroke="#0044a0" d="M631.992,-438.111C655.104,-434.327 679.903,-430.697 703,-428.173 884.404,-408.343 931.549,-425.567 1113,-406.173 1133.45,-403.987 1155.2,-400.994 1176.03,-397.794"/>
|
||||
<polygon fill="#0044a0" stroke="#0044a0" points="1176.83,-401.211 1186.17,-396.209 1175.75,-394.295 1176.83,-401.211"/>
|
||||
</g>
|
||||
<!-- t9->t15 -->
|
||||
<g id="edge13" class="edge"><title>t9->t15</title>
|
||||
<path fill="none" stroke="#0044a0" d="M474.47,-438.117C429.651,-426.452 370.0px1,-410.957 323.342,-398.782"/>
|
||||
<polygon fill="#0044a0" stroke="#0044a0" points="324.123,-395.369 313.564,-396.237 322.36,-402.143 324.123,-395.369"/>
|
||||
</g>
|
||||
<!-- t13 -->
|
||||
<g id="node12" class="node"><title>t13</title>
|
||||
<polygon fill="#00cc66" stroke="black" points="683.043,-328.173 374.957,-328.173 370.957,-324.173 370.957,-292.173 679.043,-292.173 683.043,-296.173 683.043,-328.173"/>
|
||||
<polyline fill="none" stroke="black" points="679.043,-324.173 370.957,-324.173 "/>
|
||||
<polyline fill="none" stroke="black" points="679.043,-324.173 679.043,-292.173 "/>
|
||||
<polyline fill="none" stroke="black" points="679.043,-324.173 683.043,-328.173 "/>
|
||||
<text text-anchor="middle" x="527" y="-304.173" font-family="Times,serif" font-size="20.00">ocrmypdf.pipeline.render_hocr_page</text>
|
||||
</g>
|
||||
<!-- t10->t13 -->
|
||||
<g id="edge12" class="edge"><title>t10->t13</title>
|
||||
<path fill="none" stroke="#0044a0" d="M1186.17,-360.113C1162.35,-356.33 1136.79,-352.699 1113,-350.173 929.956,-330.738 880.531,-342.246 693.485,-328.255"/>
|
||||
<polygon fill="#0044a0" stroke="#0044a0" points="693.548,-324.75 683.311,-327.48 693.016,-331.73 693.548,-324.75"/>
|
||||
</g>
|
||||
<!-- t14 -->
|
||||
<g id="node17" class="node"><title>t14</title>
|
||||
<polygon fill="#00cc66" stroke="black" points="1072.92,-328.173 705.08,-328.173 701.08,-324.173 701.08,-292.173 1068.92,-292.173 1072.92,-296.173 1072.92,-328.173"/>
|
||||
<polyline fill="none" stroke="black" points="1068.92,-324.173 701.08,-324.173 "/>
|
||||
<polyline fill="none" stroke="black" points="1068.92,-324.173 1068.92,-292.173 "/>
|
||||
<polyline fill="none" stroke="black" points="1068.92,-324.173 1072.92,-328.173 "/>
|
||||
<text text-anchor="middle" x="887" y="-304.173" font-family="Times,serif" font-size="20.00">ocrmypdf.pipeline.render_hocr_debug_page</text>
|
||||
</g>
|
||||
<!-- t10->t14 -->
|
||||
<g id="edge25" class="edge"><title>t10->t14</title>
|
||||
<path fill="none" stroke="#0044a0" d="M1179.28,-360.133C1124,-350.873 1055.54,-339.405 998.77,-329.896"/>
|
||||
<polygon fill="#0044a0" stroke="#0044a0" points="999.118,-326.405 988.677,-328.205 997.962,-333.309 999.118,-326.405"/>
|
||||
<g id="edge2" class="edge">
|
||||
<title>t1->t2</title>
|
||||
<path fill="none" stroke="#0044a0" d="M1023.449,-1121.1152C984.5695,-1112.8974 938.0675,-1103.0685 896.4957,-1094.2816"/>
|
||||
<polygon fill="#0044a0" stroke="#0044a0" points="897.1066,-1090.8335 886.5989,-1092.1898 895.6589,-1097.6822 897.1066,-1090.8335"/>
|
||||
</g>
|
||||
<!-- t16 -->
|
||||
<g id="node16" class="node"><title>t16</title>
|
||||
<polygon fill="#00cc66" stroke="black" points="636.299,-270.173 345.701,-270.173 341.701,-266.173 341.701,-234.173 632.299,-234.173 636.299,-238.173 636.299,-270.173"/>
|
||||
<polyline fill="none" stroke="black" points="632.299,-266.173 341.701,-266.173 "/>
|
||||
<polyline fill="none" stroke="black" points="632.299,-266.173 632.299,-234.173 "/>
|
||||
<polyline fill="none" stroke="black" points="632.299,-266.173 636.299,-270.173 "/>
|
||||
<text text-anchor="middle" x="489" y="-246.173" font-family="Times,serif" font-size="20.00">ocrmypdf.pipeline.combine_layers</text>
|
||||
<g id="node17" class="node">
|
||||
<title>t16</title>
|
||||
<polygon fill="#00cc66" stroke="#000000" points="1215.5059,-328.1861 942.4941,-328.1861 938.4941,-324.1861 938.4941,-292.1861 1211.5059,-292.1861 1215.5059,-296.1861 1215.5059,-328.1861"/>
|
||||
<polyline fill="none" stroke="#000000" points="1211.5059,-324.1861 938.4941,-324.1861 "/>
|
||||
<polyline fill="none" stroke="#000000" points="1211.5059,-324.1861 1211.5059,-292.1861 "/>
|
||||
<polyline fill="none" stroke="#000000" points="1211.5059,-324.1861 1215.5059,-328.1861 "/>
|
||||
<text text-anchor="middle" x="1077" y="-304.1861" font-family="Times,serif" font-size="20.00" fill="#000000">ocrmypdf.pipeline.weave_layers</text>
|
||||
</g>
|
||||
<!-- t13->t16 -->
|
||||
<g id="edge22" class="edge"><title>t13->t16</title>
|
||||
<path fill="none" stroke="#0044a0" d="M515.392,-292.066C512.519,-287.833 509.379,-283.205 506.299,-278.666"/>
|
||||
<polygon fill="#0044a0" stroke="#0044a0" points="509.048,-276.483 500.537,-270.174 503.256,-280.414 509.048,-276.483"/>
|
||||
<!-- t1->t16 -->
|
||||
<g id="edge24" class="edge">
|
||||
<title>t1->t16</title>
|
||||
<path fill="none" stroke="#0044a0" d="M1097.2373,-1120.9576C1077.987,-1088.7184 1043.7317,-1019.7372 1063,-963.2656 1106.87,-834.6914 1482.8098,-573.3183 1409,-459.2656 1362.7595,-387.8137 1273.2613,-350.2799 1198.8305,-330.7528"/>
|
||||
<polygon fill="#0044a0" stroke="#0044a0" points="1199.4555,-327.3005 1188.9015,-328.2301 1197.7316,-334.0849 1199.4555,-327.3005"/>
|
||||
</g>
|
||||
<!-- t15->t16 -->
|
||||
<g id="edge21" class="edge"><title>t15->t16</title>
|
||||
<path fill="none" stroke="#0044a0" d="M263.466,-359.936C281.645,-340.695 313.598,-309.935 347,-292.173 361.3,-284.568 377.219,-278.339 393.079,-273.27"/>
|
||||
<polygon fill="#0044a0" stroke="#0044a0" points="394.389,-276.53 402.932,-270.262 392.345,-269.835 394.389,-276.53"/>
|
||||
<!-- t17 -->
|
||||
<g id="node18" class="node">
|
||||
<title>t17</title>
|
||||
<polygon fill="#efa03b" stroke="#000000" points="1439.5156,-1009.7492 1076.4844,-1009.7492 1072.4844,-1005.7492 1072.4844,-973.7492 1435.5156,-973.7492 1439.5156,-977.7492 1439.5156,-1009.7492"/>
|
||||
<polyline fill="none" stroke="#000000" points="1435.5156,-1005.7492 1072.4844,-1005.7492 "/>
|
||||
<polyline fill="none" stroke="#000000" points="1435.5156,-1005.7492 1435.5156,-973.7492 "/>
|
||||
<polyline fill="none" stroke="#000000" points="1435.5156,-1005.7492 1439.5156,-1009.7492 "/>
|
||||
<text text-anchor="middle" x="1256" y="-985.7492" font-family="Times,serif" font-size="20.00" fill="#000000">ocrmypdf.pipeline.generate_postscript_stub</text>
|
||||
</g>
|
||||
<!-- t11->t12 -->
|
||||
<g id="edge19" class="edge"><title>t11->t12</title>
|
||||
<path fill="none" stroke="#0044a0" d="M1009.92,-434.405C967.591,-424.191 916.524,-411.87 873.373,-401.459"/>
|
||||
<polygon fill="#0044a0" stroke="#0044a0" points="873.983,-398.006 863.441,-399.063 872.341,-404.811 873.983,-398.006"/>
|
||||
<!-- t1->t17 -->
|
||||
<g id="edge25" class="edge">
|
||||
<title>t1->t17</title>
|
||||
<path fill="none" stroke="#0044a0" d="M1127.0251,-1121.1176C1153.0342,-1095.0292 1201.2007,-1046.7157 1230.7429,-1017.0834"/>
|
||||
<polygon fill="#0044a0" stroke="#0044a0" points="1233.2458,-1019.5302 1237.8275,-1009.9772 1228.2885,-1014.5879 1233.2458,-1019.5302"/>
|
||||
</g>
|
||||
<!-- t18 -->
|
||||
<g id="node19" class="node">
|
||||
<title>t18</title>
|
||||
<polygon fill="#efa03b" stroke="#000000" points="1070.189,-214.4288 1263,-187.1099 1455.811,-214.4288 1455.631,-258.6317 1070.369,-258.6317 1070.189,-214.4288"/>
|
||||
<polygon fill="none" stroke="#000000" points="1066.1715,-210.9543 1263,-183.0662 1459.8285,-210.9543 1459.6181,-262.6353 1066.3819,-262.6353 1066.1715,-210.9543"/>
|
||||
<text text-anchor="middle" x="1263" y="-220.6461" font-family="Times,serif" font-size="20.00" fill="#000000">ocrmypdf.pipeline.metadata_fixup</text>
|
||||
</g>
|
||||
<!-- t1->t18 -->
|
||||
<g id="edge28" class="edge">
|
||||
<title>t1->t18</title>
|
||||
<path fill="none" stroke="#0044a0" d="M1241.1115,-1121.1192C1311.0076,-1105.2558 1393.5851,-1075.5895 1449,-1020.2329 1458.4922,-1010.7507 1459,-1005.1661 1459,-991.7492 1459,-991.7492 1459,-991.7492 1459,-393.7258 1459,-341.9727 1441.8377,-325.2216 1402,-292.1861 1390.9869,-283.0534 1378.4885,-274.871 1365.6104,-267.6415"/>
|
||||
<polygon fill="#0044a0" stroke="#0044a0" points="1367.1079,-264.4723 1356.6476,-262.7888 1363.775,-270.6279 1367.1079,-264.4723"/>
|
||||
</g>
|
||||
<!-- t3 -->
|
||||
<g id="node4" class="node">
|
||||
<title>t3</title>
|
||||
<polygon fill="#efa03b" stroke="#000000" points="1015.5194,-999.3074 785,-1016.2081 554.4806,-999.3074 554.6958,-971.9616 1015.3042,-971.9616 1015.5194,-999.3074"/>
|
||||
<polygon fill="none" stroke="#000000" points="1019.5491,-1003.0204 785,-1020.2165 550.4509,-1003.0204 550.7267,-967.9639 1019.2733,-967.9639 1019.5491,-1003.0204"/>
|
||||
<text text-anchor="middle" x="785" y="-985.7492" font-family="Times,serif" font-size="20.00" fill="#000000">ocrmypdf.pipeline.ocr_or_skip</text>
|
||||
</g>
|
||||
<!-- t2->t3 -->
|
||||
<g id="edge3" class="edge">
|
||||
<title>t2->t3</title>
|
||||
<path fill="none" stroke="#0044a0" d="M785,-1046.5938C785,-1041.5635 785,-1036.139 785,-1030.7273"/>
|
||||
<polygon fill="#0044a0" stroke="#0044a0" points="788.5001,-1030.4427 785,-1020.4427 781.5001,-1030.4428 788.5001,-1030.4427"/>
|
||||
</g>
|
||||
<!-- t4 -->
|
||||
<g id="node5" class="node">
|
||||
<title>t4</title>
|
||||
<polygon fill="#efa03b" stroke="#000000" points="889.3166,-941.2656 582.6834,-941.2656 578.6834,-937.2656 578.6834,-905.2656 885.3166,-905.2656 889.3166,-909.2656 889.3166,-941.2656"/>
|
||||
<polyline fill="none" stroke="#000000" points="885.3166,-937.2656 578.6834,-937.2656 "/>
|
||||
<polyline fill="none" stroke="#000000" points="885.3166,-937.2656 885.3166,-905.2656 "/>
|
||||
<polyline fill="none" stroke="#000000" points="885.3166,-937.2656 889.3166,-941.2656 "/>
|
||||
<text text-anchor="middle" x="734" y="-917.2656" font-family="Times,serif" font-size="20.00" fill="#000000">ocrmypdf.pipeline.rasterize_preview</text>
|
||||
</g>
|
||||
<!-- t3->t4 -->
|
||||
<g id="edge4" class="edge">
|
||||
<title>t3->t4</title>
|
||||
<path fill="none" stroke="#0044a0" d="M767.1627,-967.797C762.8396,-961.9919 758.1927,-955.7519 753.7858,-949.8343"/>
|
||||
<polygon fill="#0044a0" stroke="#0044a0" points="756.3465,-947.4129 747.5666,-941.483 750.7323,-951.5939 756.3465,-947.4129"/>
|
||||
</g>
|
||||
<!-- t5 -->
|
||||
<g id="node6" class="node">
|
||||
<title>t5</title>
|
||||
<polygon fill="#efa03b" stroke="#000000" points="1028.0824,-883.2656 769.9176,-883.2656 765.9176,-879.2656 765.9176,-847.2656 1024.0824,-847.2656 1028.0824,-851.2656 1028.0824,-883.2656"/>
|
||||
<polyline fill="none" stroke="#000000" points="1024.0824,-879.2656 765.9176,-879.2656 "/>
|
||||
<polyline fill="none" stroke="#000000" points="1024.0824,-879.2656 1024.0824,-847.2656 "/>
|
||||
<polyline fill="none" stroke="#000000" points="1024.0824,-879.2656 1028.0824,-883.2656 "/>
|
||||
<text text-anchor="middle" x="897" y="-859.2656" font-family="Times,serif" font-size="20.00" fill="#000000">ocrmypdf.pipeline.orient_page</text>
|
||||
</g>
|
||||
<!-- t3->t5 -->
|
||||
<g id="edge6" class="edge">
|
||||
<title>t3->t5</title>
|
||||
<path fill="none" stroke="#0044a0" d="M869.1177,-967.8063C880.553,-961.0264 890.81,-952.3527 898,-941.2656 907.042,-927.3226 906.9457,-908.7053 904.5139,-893.387"/>
|
||||
<polygon fill="#0044a0" stroke="#0044a0" points="907.914,-892.5383 902.5408,-883.4071 901.0469,-893.8961 907.914,-892.5383"/>
|
||||
</g>
|
||||
<!-- t4->t5 -->
|
||||
<g id="edge5" class="edge">
|
||||
<title>t4->t5</title>
|
||||
<path fill="none" stroke="#0044a0" d="M784.6807,-905.2319C801.0865,-899.3943 819.4462,-892.8614 836.4913,-886.7963"/>
|
||||
<polygon fill="#0044a0" stroke="#0044a0" points="838.1026,-889.938 846.3506,-883.288 835.7559,-883.343 838.1026,-889.938"/>
|
||||
</g>
|
||||
<!-- t6 -->
|
||||
<g id="node7" class="node">
|
||||
<title>t6</title>
|
||||
<polygon fill="#efa03b" stroke="#000000" points="1064.7325,-825.2656 689.2675,-825.2656 685.2675,-821.2656 685.2675,-789.2656 1060.7325,-789.2656 1064.7325,-793.2656 1064.7325,-825.2656"/>
|
||||
<polyline fill="none" stroke="#000000" points="1060.7325,-821.2656 685.2675,-821.2656 "/>
|
||||
<polyline fill="none" stroke="#000000" points="1060.7325,-821.2656 1060.7325,-789.2656 "/>
|
||||
<polyline fill="none" stroke="#000000" points="1060.7325,-821.2656 1064.7325,-825.2656 "/>
|
||||
<text text-anchor="middle" x="875" y="-801.2656" font-family="Times,serif" font-size="20.00" fill="#000000">ocrmypdf.pipeline.rasterize_with_ghostscript</text>
|
||||
</g>
|
||||
<!-- t5->t6 -->
|
||||
<g id="edge7" class="edge">
|
||||
<title>t5->t6</title>
|
||||
<path fill="none" stroke="#0044a0" d="M890.1597,-847.2319C888.6839,-843.3412 887.0909,-839.1417 885.5115,-834.9776"/>
|
||||
<polygon fill="#0044a0" stroke="#0044a0" points="888.731,-833.5965 881.9119,-825.4878 882.186,-836.0791 888.731,-833.5965"/>
|
||||
</g>
|
||||
<!-- t13 -->
|
||||
<g id="node16" class="node">
|
||||
<title>t13</title>
|
||||
<polygon fill="#00cc66" stroke="#000000" points="1077,-515.2656 754.4141,-487.2656 1077,-459.2656 1399.5859,-487.2656 1077,-515.2656"/>
|
||||
<text text-anchor="middle" x="1077" y="-481.2656" font-family="Times,serif" font-size="20.00" fill="#000000">ocrmypdf.pipeline.select_image_layer</text>
|
||||
</g>
|
||||
<!-- t5->t13 -->
|
||||
<g id="edge20" class="edge">
|
||||
<title>t5->t13</title>
|
||||
<path fill="none" stroke="#0044a0" d="M1000.2704,-847.241C1031.2359,-840.6873 1060.5415,-832.9862 1074,-825.2656 1114.0954,-802.2644 1145,-795.4899 1145,-749.2656 1145,-749.2656 1145,-749.2656 1145,-633.2656 1145,-590.368 1154.8687,-575.2844 1135,-537.2656 1131.571,-530.7041 1126.8893,-524.6314 1121.6622,-519.1451"/>
|
||||
<polygon fill="#0044a0" stroke="#0044a0" points="1123.8989,-516.4405 1114.2626,-512.0367 1119.0494,-521.4885 1123.8989,-516.4405"/>
|
||||
</g>
|
||||
<!-- t7 -->
|
||||
<g id="node8" class="node">
|
||||
<title>t7</title>
|
||||
<polygon fill="#efa03b" stroke="#000000" points="856.0801,-767.2656 431.9199,-767.2656 427.9199,-763.2656 427.9199,-731.2656 852.0801,-731.2656 856.0801,-735.2656 856.0801,-767.2656"/>
|
||||
<polyline fill="none" stroke="#000000" points="852.0801,-763.2656 427.9199,-763.2656 "/>
|
||||
<polyline fill="none" stroke="#000000" points="852.0801,-763.2656 852.0801,-731.2656 "/>
|
||||
<polyline fill="none" stroke="#000000" points="852.0801,-763.2656 856.0801,-767.2656 "/>
|
||||
<text text-anchor="middle" x="642" y="-743.2656" font-family="Times,serif" font-size="20.00" fill="#000000">ocrmypdf.pipeline.preprocess_remove_background</text>
|
||||
</g>
|
||||
<!-- t6->t7 -->
|
||||
<g id="edge8" class="edge">
|
||||
<title>t6->t7</title>
|
||||
<path fill="none" stroke="#0044a0" d="M802.5546,-789.2319C777.7884,-783.067 749.9071,-776.1266 724.4138,-769.7806"/>
|
||||
<polygon fill="#0044a0" stroke="#0044a0" points="724.95,-766.3073 714.4006,-767.288 723.259,-773.1 724.95,-766.3073"/>
|
||||
</g>
|
||||
<!-- t12 -->
|
||||
<g id="node15" class="node">
|
||||
<title>t12</title>
|
||||
<polygon fill="#efa03b" stroke="#000000" points="742,-593.2656 358.1874,-565.2656 742,-537.2656 1125.8126,-565.2656 742,-593.2656"/>
|
||||
<text text-anchor="middle" x="742" y="-559.2656" font-family="Times,serif" font-size="20.00" fill="#000000">ocrmypdf.pipeline.select_visible_page_image</text>
|
||||
</g>
|
||||
<!-- t6->t12 -->
|
||||
<g id="edge18" class="edge">
|
||||
<title>t6->t12</title>
|
||||
<path fill="none" stroke="#0044a0" d="M875.1443,-789.1129C874.6867,-773.2956 872.5831,-750.0189 865,-731.2656 844.2991,-680.0716 804.0126,-630.4165 775.1838,-598.9641"/>
|
||||
<polygon fill="#0044a0" stroke="#0044a0" points="777.4937,-596.3085 768.1202,-591.3701 772.3682,-601.076 777.4937,-596.3085"/>
|
||||
</g>
|
||||
<!-- t8 -->
|
||||
<g id="node9" class="node">
|
||||
<title>t8</title>
|
||||
<polygon fill="#efa03b" stroke="#000000" points="732.6759,-709.2656 413.3241,-709.2656 409.3241,-705.2656 409.3241,-673.2656 728.6759,-673.2656 732.6759,-677.2656 732.6759,-709.2656"/>
|
||||
<polyline fill="none" stroke="#000000" points="728.6759,-705.2656 409.3241,-705.2656 "/>
|
||||
<polyline fill="none" stroke="#000000" points="728.6759,-705.2656 728.6759,-673.2656 "/>
|
||||
<polyline fill="none" stroke="#000000" points="728.6759,-705.2656 732.6759,-709.2656 "/>
|
||||
<text text-anchor="middle" x="571" y="-685.2656" font-family="Times,serif" font-size="20.00" fill="#000000">ocrmypdf.pipeline.preprocess_deskew</text>
|
||||
</g>
|
||||
<!-- t7->t8 -->
|
||||
<g id="edge9" class="edge">
|
||||
<title>t7->t8</title>
|
||||
<path fill="none" stroke="#0044a0" d="M619.9243,-731.2319C613.9709,-726.3685 607.4267,-721.0226 601.115,-715.8666"/>
|
||||
<polygon fill="#0044a0" stroke="#0044a0" points="603.2653,-713.1037 593.3065,-709.4878 598.8367,-718.5248 603.2653,-713.1037"/>
|
||||
</g>
|
||||
<!-- t7->t12 -->
|
||||
<g id="edge17" class="edge">
|
||||
<title>t7->t12</title>
|
||||
<path fill="none" stroke="#0044a0" d="M717.0346,-731.1646C726.8757,-725.6884 735.7103,-718.5557 742,-709.2656 763.0291,-678.205 759.4083,-634.0888 752.8082,-602.8898"/>
|
||||
<polygon fill="#0044a0" stroke="#0044a0" points="756.1481,-601.7976 750.487,-592.842 749.3278,-603.3733 756.1481,-601.7976"/>
|
||||
</g>
|
||||
<!-- t9 -->
|
||||
<g id="node10" class="node">
|
||||
<title>t9</title>
|
||||
<polygon fill="#efa03b" stroke="#000000" points="712.8828,-651.2656 411.1172,-651.2656 407.1172,-647.2656 407.1172,-615.2656 708.8828,-615.2656 712.8828,-619.2656 712.8828,-651.2656"/>
|
||||
<polyline fill="none" stroke="#000000" points="708.8828,-647.2656 407.1172,-647.2656 "/>
|
||||
<polyline fill="none" stroke="#000000" points="708.8828,-647.2656 708.8828,-615.2656 "/>
|
||||
<polyline fill="none" stroke="#000000" points="708.8828,-647.2656 712.8828,-651.2656 "/>
|
||||
<text text-anchor="middle" x="560" y="-627.2656" font-family="Times,serif" font-size="20.00" fill="#000000">ocrmypdf.pipeline.preprocess_clean</text>
|
||||
</g>
|
||||
<!-- t8->t9 -->
|
||||
<g id="edge10" class="edge">
|
||||
<title>t8->t9</title>
|
||||
<path fill="none" stroke="#0044a0" d="M567.5798,-673.2319C566.8624,-669.4493 566.0897,-665.3747 565.3216,-661.3247"/>
|
||||
<polygon fill="#0044a0" stroke="#0044a0" points="568.7581,-660.6605 563.4559,-651.4878 561.8807,-661.9649 568.7581,-660.6605"/>
|
||||
</g>
|
||||
<!-- t8->t12 -->
|
||||
<g id="edge16" class="edge">
|
||||
<title>t8->t12</title>
|
||||
<path fill="none" stroke="#0044a0" d="M670.0045,-673.2618C693.2528,-667.2338 713.6919,-659.8307 722,-651.2656 734.1971,-638.6912 739.4901,-620.2051 741.6123,-603.5914"/>
|
||||
<polygon fill="#0044a0" stroke="#0044a0" points="745.1041,-603.8427 742.5574,-593.5585 738.1349,-603.1862 745.1041,-603.8427"/>
|
||||
</g>
|
||||
<!-- t10 -->
|
||||
<g id="node11" class="node">
|
||||
<title>t10</title>
|
||||
<polygon fill="#efa03b" stroke="#000000" points="340.1094,-583.2656 35.8906,-583.2656 31.8906,-579.2656 31.8906,-547.2656 336.1094,-547.2656 340.1094,-551.2656 340.1094,-583.2656"/>
|
||||
<polyline fill="none" stroke="#000000" points="336.1094,-579.2656 31.8906,-579.2656 "/>
|
||||
<polyline fill="none" stroke="#000000" points="336.1094,-579.2656 336.1094,-547.2656 "/>
|
||||
<polyline fill="none" stroke="#000000" points="336.1094,-579.2656 340.1094,-583.2656 "/>
|
||||
<text text-anchor="middle" x="186" y="-559.2656" font-family="Times,serif" font-size="20.00" fill="#000000">ocrmypdf.pipeline.select_ocr_image</text>
|
||||
</g>
|
||||
<!-- t9->t10 -->
|
||||
<g id="edge11" class="edge">
|
||||
<title>t9->t10</title>
|
||||
<path fill="none" stroke="#0044a0" d="M460.7568,-615.2213C409.7279,-605.9434 347.4237,-594.6153 295.0537,-585.0935"/>
|
||||
<polygon fill="#0044a0" stroke="#0044a0" points="295.5223,-581.6214 285.0575,-583.276 294.2701,-588.5085 295.5223,-581.6214"/>
|
||||
</g>
|
||||
<!-- t9->t12 -->
|
||||
<g id="edge15" class="edge">
|
||||
<title>t9->t12</title>
|
||||
<path fill="none" stroke="#0044a0" d="M608.2948,-615.2213C627.0226,-608.2242 648.8712,-600.0609 669.4134,-592.3859"/>
|
||||
<polygon fill="#0044a0" stroke="#0044a0" points="670.9148,-595.5613 679.0573,-588.7826 668.4648,-589.004 670.9148,-595.5613"/>
|
||||
</g>
|
||||
<!-- t11 -->
|
||||
<g id="node12" class="node">
|
||||
<title>t11</title>
|
||||
<polygon fill="#00cc66" stroke="#000000" points="334.0996,-505.2656 19.9004,-505.2656 15.9004,-501.2656 15.9004,-469.2656 330.0996,-469.2656 334.0996,-473.2656 334.0996,-505.2656"/>
|
||||
<polyline fill="none" stroke="#000000" points="330.0996,-501.2656 15.9004,-501.2656 "/>
|
||||
<polyline fill="none" stroke="#000000" points="330.0996,-501.2656 330.0996,-469.2656 "/>
|
||||
<polyline fill="none" stroke="#000000" points="330.0996,-501.2656 334.0996,-505.2656 "/>
|
||||
<text text-anchor="middle" x="175" y="-481.2656" font-family="Times,serif" font-size="20.00" fill="#000000">ocrmypdf.pipeline.ocr_tesseract_hocr</text>
|
||||
</g>
|
||||
<!-- t10->t11 -->
|
||||
<g id="edge12" class="edge">
|
||||
<title>t10->t11</title>
|
||||
<path fill="none" stroke="#0044a0" d="M183.4487,-547.1748C182.1254,-537.7914 180.4788,-526.1154 178.9917,-515.5701"/>
|
||||
<polygon fill="#0044a0" stroke="#0044a0" points="182.4378,-514.9417 177.5755,-505.5285 175.5064,-515.9193 182.4378,-514.9417"/>
|
||||
</g>
|
||||
<!-- t15 -->
|
||||
<g id="node14" class="node">
|
||||
<title>t15</title>
|
||||
<polygon fill="#ff69b4" stroke="#000000" points="736.2696,-505.2656 355.7304,-505.2656 351.7304,-501.2656 351.7304,-469.2656 732.2696,-469.2656 736.2696,-473.2656 736.2696,-505.2656"/>
|
||||
<polyline fill="none" stroke="#000000" points="732.2696,-501.2656 351.7304,-501.2656 "/>
|
||||
<polyline fill="none" stroke="#000000" points="732.2696,-501.2656 732.2696,-469.2656 "/>
|
||||
<polyline fill="none" stroke="#000000" points="732.2696,-501.2656 736.2696,-505.2656 "/>
|
||||
<text text-anchor="middle" x="544" y="-481.2656" font-family="Times,serif" font-size="20.00" fill="#000000">ocrmypdf.pipeline.ocr_tesseract_textonly_pdf</text>
|
||||
</g>
|
||||
<!-- t10->t15 -->
|
||||
<g id="edge14" class="edge">
|
||||
<title>t10->t15</title>
|
||||
<path fill="none" stroke="#0044a0" d="M269.0322,-547.1748C323.4947,-535.3086 394.7854,-519.776 451.1284,-507.5002"/>
|
||||
<polygon fill="#0044a0" stroke="#0044a0" points="452.0829,-510.8744 461.1086,-505.3257 450.5927,-504.0348 452.0829,-510.8744"/>
|
||||
</g>
|
||||
<!-- t14 -->
|
||||
<g id="node13" class="node">
|
||||
<title>t14</title>
|
||||
<polygon fill="#00cc66" stroke="#000000" points="330.0433,-411.7258 21.9567,-411.7258 17.9567,-407.7258 17.9567,-375.7258 326.0433,-375.7258 330.0433,-379.7258 330.0433,-411.7258"/>
|
||||
<polyline fill="none" stroke="#000000" points="326.0433,-407.7258 17.9567,-407.7258 "/>
|
||||
<polyline fill="none" stroke="#000000" points="326.0433,-407.7258 326.0433,-375.7258 "/>
|
||||
<polyline fill="none" stroke="#000000" points="326.0433,-407.7258 330.0433,-411.7258 "/>
|
||||
<text text-anchor="middle" x="174" y="-387.7258" font-family="Times,serif" font-size="20.00" fill="#000000">ocrmypdf.pipeline.render_hocr_page</text>
|
||||
</g>
|
||||
<!-- t11->t14 -->
|
||||
<g id="edge24" class="edge"><title>t11->t14</title>
|
||||
<path fill="none" stroke="#0044a0" d="M1334.06,-445.464C1386.49,-438.209 1431.63,-426.12 1449,-406.173 1465.34,-387.403 1466.07,-368.289 1449,-350.173 1422.45,-321.987 1153.75,-330.0px 1083.05,-328.037"/>
|
||||
<polygon fill="#0044a0" stroke="#0044a0" points="1083,-324.531 1072.85,-327.564 1082.68,-331.524 1083,-324.531"/>
|
||||
<g id="edge13" class="edge">
|
||||
<title>t11->t14</title>
|
||||
<path fill="none" stroke="#0044a0" d="M174.8072,-469.2302C174.6642,-455.8584 174.4666,-437.3702 174.3027,-422.0357"/>
|
||||
<polygon fill="#0044a0" stroke="#0044a0" points="177.8024,-421.987 174.1956,-412.025 170.8028,-422.0619 177.8024,-421.987"/>
|
||||
</g>
|
||||
<!-- t11->t17 -->
|
||||
<g id="edge27" class="edge"><title>t11->t17</title>
|
||||
<path fill="none" stroke="#0044a0" d="M1278.64,-441.463C1364.44,-433.122 1450.86,-421.174 1464,-406.173 1480.4,-387.448 1479.49,-369.65 1464,-350.173 1457.83,-342.418 1443.67,-336.074 1426.02,-330.926"/>
|
||||
<polygon fill="#0044a0" stroke="#0044a0" points="1426.46,-327.418 1415.89,-328.188 1424.63,-334.176 1426.46,-327.418"/>
|
||||
<!-- t19 -->
|
||||
<g id="node22" class="node">
|
||||
<title>t19</title>
|
||||
<polygon fill="#efa03b" stroke="#000000" points="351.7205,-381.5085 545,-354.1897 738.2795,-381.5085 738.0991,-425.7112 351.9009,-425.7112 351.7205,-381.5085"/>
|
||||
<polygon fill="none" stroke="#000000" points="347.7033,-378.0329 545,-350.1463 742.2967,-378.0329 742.0858,-429.7148 347.9142,-429.7148 347.7033,-378.0329"/>
|
||||
<text text-anchor="middle" x="545" y="-387.7258" font-family="Times,serif" font-size="20.00" fill="#000000">ocrmypdf.pipeline.merge_sidecars</text>
|
||||
</g>
|
||||
<!-- t12->t16 -->
|
||||
<g id="edge23" class="edge"><title>t12->t16</title>
|
||||
<path fill="none" stroke="#0044a0" d="M624.426,-363.718C509.174,-353.04 370.992,-338.277 362,-328.173 351.364,-316.22 352.491,-305.04 362,-292.173 366.819,-285.651 372.71,-280.186 379.287,-275.609"/>
|
||||
<polygon fill="#0044a0" stroke="#0044a0" points="381.274,-278.496 387.956,-270.274 377.605,-272.534 381.274,-278.496"/>
|
||||
<!-- t11->t19 -->
|
||||
<g id="edge32" class="edge">
|
||||
<title>t11->t19</title>
|
||||
<path fill="none" stroke="#0044a0" d="M246.3397,-469.2302C287.966,-458.7066 342.1269,-445.0142 392.8772,-432.184"/>
|
||||
<polygon fill="#0044a0" stroke="#0044a0" points="393.8058,-435.5594 402.6429,-429.7151 392.0901,-428.773 393.8058,-435.5594"/>
|
||||
</g>
|
||||
<!-- t14->t16 -->
|
||||
<g id="edge22" class="edge">
|
||||
<title>t14->t16</title>
|
||||
<path fill="none" stroke="#0044a0" d="M230.6615,-375.7128C262.2207,-366.4581 302.4172,-355.9425 339,-350.1861 448.3957,-332.9725 745.7869,-320.7866 927.9215,-314.6743"/>
|
||||
<polygon fill="#0044a0" stroke="#0044a0" points="928.248,-318.1655 938.1258,-314.3342 928.0148,-311.1693 928.248,-318.1655"/>
|
||||
</g>
|
||||
<!-- t15->t16 -->
|
||||
<g id="edge21" class="edge">
|
||||
<title>t15->t16</title>
|
||||
<path fill="none" stroke="#0044a0" d="M630.0636,-469.2083C667.5329,-460.6467 711.76,-449.5912 751,-437.2656 850.4985,-406.0121 963.1653,-359.5222 1026.586,-332.2894"/>
|
||||
<polygon fill="#0044a0" stroke="#0044a0" points="1028.1566,-335.4238 1035.9553,-328.2523 1025.3866,-328.9951 1028.1566,-335.4238"/>
|
||||
</g>
|
||||
<!-- t15->t19 -->
|
||||
<g id="edge31" class="edge">
|
||||
<title>t15->t19</title>
|
||||
<path fill="none" stroke="#0044a0" d="M544.1928,-469.2302C544.2822,-460.8687 544.393,-450.5066 544.5035,-440.166"/>
|
||||
<polygon fill="#0044a0" stroke="#0044a0" points="548.006,-439.9443 544.6132,-429.9075 541.0064,-439.8694 548.006,-439.9443"/>
|
||||
</g>
|
||||
<!-- t12->t13 -->
|
||||
<g id="edge19" class="edge">
|
||||
<title>t12->t13</title>
|
||||
<path fill="none" stroke="#0044a0" d="M833.9833,-543.8486C879.0975,-533.3444 933.4556,-520.6879 979.3116,-510.0109"/>
|
||||
<polygon fill="#0044a0" stroke="#0044a0" points="980.3156,-513.3709 989.2614,-507.6943 978.7282,-506.5532 980.3156,-513.3709"/>
|
||||
</g>
|
||||
<!-- t13->t16 -->
|
||||
<g id="edge23" class="edge">
|
||||
<title>t13->t16</title>
|
||||
<path fill="none" stroke="#0044a0" d="M1077,-459.2068C1077,-426.2624 1077,-371.9187 1077,-338.7552"/>
|
||||
<polygon fill="#0044a0" stroke="#0044a0" points="1080.5001,-338.3818 1077,-328.3819 1073.5001,-338.3819 1080.5001,-338.3818"/>
|
||||
</g>
|
||||
<!-- t16->t18 -->
|
||||
<g id="edge27" class="edge">
|
||||
<title>t16->t18</title>
|
||||
<path fill="none" stroke="#0044a0" d="M1117.3592,-292.0592C1133.8695,-284.6437 1153.6803,-275.7459 1173.2953,-266.9361"/>
|
||||
<polygon fill="#0044a0" stroke="#0044a0" points="1174.8979,-270.0531 1182.586,-262.7632 1172.0299,-263.6676 1174.8979,-270.0531"/>
|
||||
</g>
|
||||
<!-- t17->t18 -->
|
||||
<g id="edge26" class="edge">
|
||||
<title>t17->t18</title>
|
||||
<path fill="none" stroke="#0044a0" d="M1326.2292,-973.7283C1377.8362,-955.768 1439,-922.4247 1439,-865.2656 1439,-865.2656 1439,-865.2656 1439,-393.7258 1439,-338.7092 1393.2056,-296.3464 1348.3356,-268.0433"/>
|
||||
<polygon fill="#0044a0" stroke="#0044a0" points="1350.0403,-264.9831 1339.6842,-262.7465 1346.3852,-270.9531 1350.0403,-264.9831"/>
|
||||
</g>
|
||||
<!-- t20 -->
|
||||
<g id="node21" class="node"><title>t20</title>
|
||||
<polygon fill="#efa03b" stroke="black" points="234.918,-156.426 480,-129.117 725.082,-156.426 724.853,-200.614 235.147,-200.614 234.918,-156.426"/>
|
||||
<polygon fill="none" stroke="black" points="230.903,-152.847 480,-125.09 729.097,-152.847 728.829,-204.616 231.171,-204.616 230.903,-152.847"/>
|
||||
<text text-anchor="middle" x="480" y="-162.639" font-family="Times,serif" font-size="20.00">ocrmypdf.pipeline.merge_pages_ghostscript</text>
|
||||
</g>
|
||||
<!-- t16->t20 -->
|
||||
<g id="edge33" class="edge"><title>t16->t20</title>
|
||||
<path fill="none" stroke="#0044a0" d="M487.091,-233.881C486.46,-228.165 485.726,-221.515 484.974,-214.703"/>
|
||||
<polygon fill="#0044a0" stroke="#0044a0" points="488.446,-214.253 483.87,-204.697 481.488,-215.021 488.446,-214.253"/>
|
||||
</g>
|
||||
<!-- t16->t21 -->
|
||||
<g id="edge37" class="edge"><title>t16->t21</title>
|
||||
<path fill="none" stroke="#0044a0" d="M602.543,-234.159C645.082,-227.582 693.805,-219.809 738,-212.173 748.572,-210.346 759.416,-208.431 770.357,-206.468"/>
|
||||
<polygon fill="#0044a0" stroke="#0044a0" points="771.206,-209.872 780.427,-204.653 769.964,-202.983 771.206,-209.872"/>
|
||||
</g>
|
||||
<!-- t14->t20 -->
|
||||
<g id="edge34" class="edge"><title>t14->t20</title>
|
||||
<path fill="none" stroke="#0044a0" d="M837.094,-292.063C776.411,-271.259 672.165,-235.52 591.922,-208.01"/>
|
||||
<polygon fill="#0044a0" stroke="#0044a0" points="592.855,-204.63 582.26,-204.697 590.584,-211.251 592.855,-204.63"/>
|
||||
</g>
|
||||
<!-- t14->t21 -->
|
||||
<g id="edge38" class="edge"><title>t14->t21</title>
|
||||
<path fill="none" stroke="#0044a0" d="M896.319,-292.063C906.85,-272.729 924.406,-240.497 938.861,-213.958"/>
|
||||
<polygon fill="#0044a0" stroke="#0044a0" points="942.118,-215.294 943.828,-204.838 935.971,-211.946 942.118,-215.294"/>
|
||||
</g>
|
||||
<!-- t19->t20 -->
|
||||
<g id="edge30" class="edge"><title>t19->t20</title>
|
||||
<path fill="none" stroke="#0044a0" d="M257.907,-234.081C284.597,-226.336 317.298,-216.848 349.316,-207.558"/>
|
||||
<polygon fill="#0044a0" stroke="#0044a0" points="350.595,-210.831 359.224,-204.683 348.645,-204.108 350.595,-210.831"/>
|
||||
</g>
|
||||
<!-- t19->t21 -->
|
||||
<g id="edge35" class="edge"><title>t19->t21</title>
|
||||
<path fill="none" stroke="#0044a0" d="M323.792,-235.042C326.891,-234.738 329.964,-234.447 333,-234.173 512.532,-217.929 559.043,-233.851 738,-212.173 751.869,-210.493 766.169,-208.472 780.522,-206.237"/>
|
||||
<polygon fill="#0044a0" stroke="#0044a0" points="781.136,-209.683 790.462,-204.657 780.037,-202.77 781.136,-209.683"/>
|
||||
</g>
|
||||
<!-- t17->t20 -->
|
||||
<g id="edge32" class="edge"><title>t17->t20</title>
|
||||
<path fill="none" stroke="#0044a0" d="M1195.47,-292.133C1071.63,-270.93 856.728,-234.138 694.688,-206.395"/>
|
||||
<polygon fill="#0044a0" stroke="#0044a0" points="695.028,-202.903 684.581,-204.665 693.846,-209.802 695.028,-202.903"/>
|
||||
</g>
|
||||
<!-- t17->t21 -->
|
||||
<g id="edge36" class="edge"><title>t17->t21</title>
|
||||
<path fill="none" stroke="#0044a0" d="M1254.29,-292.063C1205.19,-271.428 1121.13,-236.1 1055.9,-208.683"/>
|
||||
<polygon fill="#0044a0" stroke="#0044a0" points="1056.99,-205.345 1046.42,-204.697 1054.28,-211.799 1056.99,-205.345"/>
|
||||
<g id="node20" class="node">
|
||||
<title>t20</title>
|
||||
<polygon fill="#efa03b" stroke="#000000" points="1400.3184,-161.1062 1129.6816,-161.1062 1125.6816,-157.1062 1125.6816,-125.1062 1396.3184,-125.1062 1400.3184,-129.1062 1400.3184,-161.1062"/>
|
||||
<polyline fill="none" stroke="#000000" points="1396.3184,-157.1062 1125.6816,-157.1062 "/>
|
||||
<polyline fill="none" stroke="#000000" points="1396.3184,-157.1062 1396.3184,-125.1062 "/>
|
||||
<polyline fill="none" stroke="#000000" points="1396.3184,-157.1062 1400.3184,-161.1062 "/>
|
||||
<text text-anchor="middle" x="1263" y="-137.1062" font-family="Times,serif" font-size="20.00" fill="#000000">ocrmypdf.pipeline.optimize_pdf</text>
|
||||
</g>
|
||||
<!-- t18->t20 -->
|
||||
<g id="edge31" class="edge"><title>t18->t20</title>
|
||||
<path fill="none" stroke="#0044a0" d="M120.266,-796.105C70.9512,-780.34 17,-751.202 17,-699.173 17,-699.173 17,-699.173 17,-309.173 17,-269.597 31.8505,-255.79 65,-234.173 92.9782,-215.927 154.085,-202.475 221.024,-192.724"/>
|
||||
<polygon fill="#0044a0" stroke="#0044a0" points="221.533,-196.187 230.939,-191.311 220.546,-189.256 221.533,-196.187"/>
|
||||
<g id="edge29" class="edge">
|
||||
<title>t18->t20</title>
|
||||
<path fill="none" stroke="#0044a0" d="M1263,-182.9188C1263,-179.129 1263,-175.3607 1263,-171.739"/>
|
||||
<polygon fill="#0044a0" stroke="#0044a0" points="1266.5001,-171.4394 1263,-161.4394 1259.5001,-171.4394 1266.5001,-171.4394"/>
|
||||
</g>
|
||||
<!-- t22 -->
|
||||
<g id="node23" class="node"><title>t22</title>
|
||||
<polygon fill="#efa03b" stroke="black" points="554.065,-47.332 721,-20.0049 887.935,-47.332 887.779,-91.5483 554.221,-91.5483 554.065,-47.332"/>
|
||||
<polygon fill="none" stroke="black" points="550.054,-43.9306 721,-15.9468 891.946,-43.9306 891.764,-95.5532 550.236,-95.5532 550.054,-43.9306"/>
|
||||
<text text-anchor="middle" x="721" y="-53.5531" font-family="Times,serif" font-size="20.00">ocrmypdf.pipeline.copy_final</text>
|
||||
<!-- t21 -->
|
||||
<g id="node21" class="node">
|
||||
<title>t21</title>
|
||||
<polygon fill="#efa03b" stroke="#000000" points="1096.0652,-47.332 1263,-20.0049 1429.9348,-47.332 1429.779,-91.5483 1096.221,-91.5483 1096.0652,-47.332"/>
|
||||
<polygon fill="none" stroke="#000000" points="1092.0538,-43.9306 1263,-15.9468 1433.9462,-43.9306 1433.7643,-95.5532 1092.2357,-95.5532 1092.0538,-43.9306"/>
|
||||
<text text-anchor="middle" x="1263" y="-53.5531" font-family="Times,serif" font-size="20.00" fill="#000000">ocrmypdf.pipeline.copy_final</text>
|
||||
</g>
|
||||
<!-- t20->t22 -->
|
||||
<g id="edge41" class="edge"><title>t20->t22</title>
|
||||
<path fill="none" stroke="#0044a0" d="M556.585,-133.609C580.784,-122.857 607.72,-110.888 632.67,-99.8018"/>
|
||||
<polygon fill="#0044a0" stroke="#0044a0" points="634.408,-102.859 642.125,-95.6004 631.566,-96.4625 634.408,-102.859"/>
|
||||
</g>
|
||||
<!-- t21->t22 -->
|
||||
<g id="edge40" class="edge"><title>t21->t22</title>
|
||||
<path fill="none" stroke="#0044a0" d="M888.417,-134.636C863.556,-123.635 835.613,-111.27 809.783,-99.8401"/>
|
||||
<polygon fill="#0044a0" stroke="#0044a0" points="810.933,-96.5216 800.372,-95.6756 808.1,-102.923 810.933,-96.5216"/>
|
||||
<!-- t20->t21 -->
|
||||
<g id="edge30" class="edge">
|
||||
<title>t20->t21</title>
|
||||
<path fill="none" stroke="#0044a0" d="M1263,-124.9764C1263,-119.37 1263,-112.9163 1263,-106.2938"/>
|
||||
<polygon fill="#0044a0" stroke="#0044a0" points="1266.5001,-105.8456 1263,-95.8457 1259.5001,-105.8457 1266.5001,-105.8456"/>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
||||
|
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 25 KiB |
+650
-299
File diff suppressed because it is too large
Load Diff
+45
-12
@@ -1,7 +1,7 @@
|
||||
PDF security issues
|
||||
===================
|
||||
|
||||
OCRmyPDF should only be used on PDFs you trust. It is not designed to protect you against malware.
|
||||
OCRmyPDF should only be used on PDFs you trust. It is not designed to protect you against malware.
|
||||
|
||||
Recognizing that many users have an interest in handling PDFs and applying OCR to PDFs they did not generate themselves, this article discusses the security implications of PDFs and how users can protect themselves.
|
||||
|
||||
@@ -10,7 +10,7 @@ The disclaimer applies: this software has no warranties of any kind.
|
||||
PDFs may contain malware
|
||||
------------------------
|
||||
|
||||
PDF is a rich, complex file format. The official PDF 1.7 specification, ISO 32000:2008, is hundreds of packages long and references several annexes each of which are similar in length. PDFs can contain video, audio, JavaScript and other programming, and forms. In some cases, they can open internet connections to pre-selected URLs. All of these possible attack vectors.
|
||||
PDF is a rich, complex file format. The official PDF 1.7 specification, ISO 32000:2008, is hundreds of pages long and references several annexes each of which are similar in length. PDFs can contain video, audio, XML, JavaScript and other programming, and forms. In some cases, they can open internet connections to pre-selected URLs. All of these possible attack vectors.
|
||||
|
||||
In short, PDFs `may contain viruses <https://security.stackexchange.com/questions/64052/can-a-pdf-file-contain-a-virus>`_.
|
||||
|
||||
@@ -19,26 +19,59 @@ This `article <https://theinvisiblethings.blogspot.ca/2013/02/converting-untrust
|
||||
How OCRmyPDF processes PDFs
|
||||
---------------------------
|
||||
|
||||
OCRmyPDF must open and interpret your PDF in order to insert an OCR layer. First, it runs all PDFs through `qpdf <https://github.com/qpdf/qpdf>`_, a program that repairs PDFs with syntax errors. This is done because, in the author's experience, a significant number of PDFs in the wild especially those created by scanners are not well-formed files. qpdf makes it more likely that OCRmyPDF will succeed, but offers no security guarantees. qpdf is also used to split the PDF into single page PDFs.
|
||||
OCRmyPDF must open and interpret your PDF in order to insert an OCR layer. First, it runs all PDFs through `pikepdf <https://github.com/pikepdf/pikepdf>`_, a library based on `qpdf <https://github.com/qpdf/qpdf>`_, a program that repairs PDFs with syntax errors. This is done because, in the author's experience, a significant number of PDFs in the wild especially those created by scanners are not well-formed files. qpdf makes it more likely that OCRmyPDF will succeed, but offers no security guarantees. qpdf is also used to split the PDF into single page PDFs.
|
||||
|
||||
After qpdf, OCRmyPDF examines each page using `PyPDF2 <https://github.com/mstamy2/PyPDF2>`_. This library also has no warranties or guarantees.
|
||||
|
||||
Finally, OCRmyPDF rasterizes each page of the PDF using `Ghostscript <http://ghostscript.com/>`_ in ``-dSAFER`` mode.
|
||||
Finally, OCRmyPDF rasterizes each page of the PDF using `Ghostscript <http://ghostscript.com/>`_ in ``-dSAFER`` mode.
|
||||
|
||||
Depending on the options specified, OCRmyPDF may graft the OCR layer into the existing PDF or it may essentially reconstruct ("re-fry") a visually identical PDF that may be quite different at the binary level. That said, OCRmyPDF is not a tool designed for sanitizing PDFs.
|
||||
|
||||
Using OCRmyPDF online
|
||||
---------------------
|
||||
Using OCRmyPDF online or as a service
|
||||
-------------------------------------
|
||||
|
||||
OCRmyPDF is not designed to be deployed "as a service", in a setting where a user/attacker could upload a file for OCR processing online. It is not designed to be secure in this case.
|
||||
OCRmyPDF should not be deployed as a public-facing service, such as a website where a potential attacker could upload a PDF of their choice for OCR. OCRmyPDF is not designed to be secure against PDF malware. Another concern is PDFs specifically designed to be a denial of service attack: PDFs can contain recursive data structures that sometimes send parsers into infinite loops, and issue complex graphics drawing commands.
|
||||
|
||||
Setting aside these concerns, a side effect of OCRmyPDF is it may incidentally sanitize PDFs that contain malware. It runs ``qpdf`` to repair the PDF, which could correct malformed PDF structures that are part of an attack. When PDF/A output is selected (the default), the input PDF is partially reconstructed by Ghostscript. When ``--force-ocr`` is used, all pages are rasterized and reconverted to PDF, which could remove malware in embedded images. No guarantees.
|
||||
|
||||
OCRmyPDF should be relatively safe to use in a trusted intranet, with some considerations:
|
||||
|
||||
Limiting CPU usage
|
||||
^^^^^^^^^^^^^^^^^^
|
||||
|
||||
OCRmyPDF will attempt to use all available CPUs and storage, so executing ``nice ocrmypdf`` or limiting the number of jobs with the ``-j`` argument may ensure the server remains available. Another option would be run OCRmyPDF jobs inside a Docker container, a virtual machine, or a cloud instance, which can impose its own limits on CPU usage and be terminated "from orbit" if it fails to complete.
|
||||
|
||||
Temporary storage requirements
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
OCRmyPDF will use a large amount of temporary storage for its work, proportional to the total number of pixels needed to rasterize the PDF. The raster image of a 8.5×11" color page at 300 DPI takes 25 MB uncompressed; OCRmyPDF saves its intermediates as PNG, but that still means it requires about 9 MB per intermediate based on average compression ratios. Multiple intermediates per page are also required, depending on the command line given. A rule of thumb would be to allow 100 MB of temporary storage per page in a file – meaning that a small cloud servers or small VM partitions should be provisioned with plenty of extra space, if say, a 500 page file might be sent.
|
||||
|
||||
To check temporary storage usage on actual files, run ``ocrmypdf -k ...`` which will preserve and print the path to temporary storage when the job is done.
|
||||
|
||||
To change where temporary files are stored, change the ``TMPDIR`` environment variable for ocrmypdf's environment. (Python's ``tempfile.gettempdir()`` returns the root directory in which temporary files will be stored.) For example, one could redirect ``TMPDIR`` to a large RAM disk to avoid wear on HDD/SSD and potentially improve performance. On Amazon Web Services, ``TMPDIR`` can be set to `empheral storage <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/InstanceStorage.html>`_.
|
||||
|
||||
Timeouts
|
||||
^^^^^^^^
|
||||
|
||||
To prevent excessively long OCR jobs consider setting ``--tesseract-timeout`` and/or ``--skip-big`` arguments. ``--skip-big`` is particularly helpful if your PDFs include documents such as reports on standard page sizes with large images attached - often large images are not worth OCR'ing anyway.
|
||||
|
||||
Commercial alternatives
|
||||
^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
The author also provides professional services that include OCR and building databases around PDFs, and is happy to provide consultation.
|
||||
|
||||
Abbyy Cloud OCR is a viable commercial alternative with a web services API.
|
||||
|
||||
Abbyy Cloud OCR is a viable commercial alternative with a web services API. The author also provides professional services that include OCR and building databases around PDFs, and is happy to provide consultation.
|
||||
|
||||
Password protection, digital signatures and certification
|
||||
---------------------------------------------------------
|
||||
|
||||
OCRmyPDF cannot remove password protection from a PDF. ``qpdf``, one of its dependencies, has this capability. After OCR is applied, password protection is not permitted on PDF/A documents but the file can be converted to regular PDF.
|
||||
Password protected PDFs usually have two passwords, and owner and user password. When the user password is set to empty, PDF readers will open the file automatically and marked it as "(SECURED)". While not as reliable as a digital signature, this indicates that whoever set the password approved of the file at that time. When the user password is set, the document cannot be viewed without the password.
|
||||
|
||||
Either way, OCRmyPDF does not remove passwords from PDFs and exits with an error on encountering them.
|
||||
|
||||
``qpdf``, one of OCRmyPDF's dependencies, can remove passwords. If the owner and user password are set, a password is required for ``qpdf``. If only the owner password is set, then the password can be stripped, even if one does not have the owner password.
|
||||
|
||||
After OCR is applied, password protection is not permitted on PDF/A documents but the file can be converted to regular PDF.
|
||||
|
||||
Many programs exist which are capable of inserting an image of someone's signature. On its own, this offers no security guarantees. It is trivial to remove the signature image and apply it to other files. This practice offers no real security.
|
||||
|
||||
Important documents can be digitally signed and certified to attest to their authorship. OCRmyPDF cannot do this. Open source tools such as pdfbox (Java) have this capability as does Adobe Acrobat.
|
||||
Important documents can be digitally signed and certified to attest to their authorship. OCRmyPDF cannot do this. Open source tools such as pdfbox (Java) have this capability as does Adobe Acrobat.
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
# © 2017 James R. Barlow: github.com/jbarlow83
|
||||
|
||||
import pkg_resources
|
||||
|
||||
PROGRAM_NAME = 'ocrmypdf'
|
||||
|
||||
VERSION = pkg_resources.get_distribution('ocrmypdf').version
|
||||
|
||||
|
||||
@@ -1,59 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
# © 2016 James R. Barlow: github.com/jbarlow83
|
||||
|
||||
|
||||
from enum import IntEnum
|
||||
|
||||
class ExitCode(IntEnum):
|
||||
ok = 0
|
||||
bad_args = 1
|
||||
input_file = 2
|
||||
missing_dependency = 3
|
||||
invalid_output_pdf = 4
|
||||
file_access_error = 5
|
||||
already_done_ocr = 6
|
||||
child_process_error = 7
|
||||
encrypted_pdf = 8
|
||||
invalid_config = 9
|
||||
other_error = 15
|
||||
ctrl_c = 130
|
||||
|
||||
|
||||
class ExitCodeException(Exception):
|
||||
pass
|
||||
|
||||
|
||||
class PdfMergeFailedError(ExitCodeException):
|
||||
exit_code = ExitCode.input_file
|
||||
|
||||
|
||||
class MissingDependencyError(ExitCodeException):
|
||||
exit_code = ExitCode.missing_dependency
|
||||
|
||||
|
||||
class UnsupportedImageFormatError(ExitCodeException):
|
||||
exit_code = ExitCode.input_file
|
||||
|
||||
|
||||
class DpiError(ExitCodeException):
|
||||
exit_code = ExitCode.input_file
|
||||
|
||||
|
||||
class PriorOcrFoundError(ExitCodeException):
|
||||
exit_code = ExitCode.already_done_ocr
|
||||
|
||||
|
||||
class InputFileError(ExitCodeException):
|
||||
exit_code = ExitCode.input_file
|
||||
|
||||
|
||||
class SubprocessOutputError(ExitCodeException):
|
||||
exit_code = ExitCode.child_process_error
|
||||
|
||||
|
||||
class EncryptedPdfError(ExitCodeException):
|
||||
exit_code = ExitCode.encrypted_pdf
|
||||
|
||||
|
||||
class TesseractConfigError(ExitCodeException):
|
||||
exit_code = ExitCode.invalid_config
|
||||
@@ -1,11 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
# © 2016 James R. Barlow: github.com/jbarlow83
|
||||
|
||||
"""Wrappers to manage subprocess calls"""
|
||||
|
||||
import os
|
||||
|
||||
|
||||
def get_program(name):
|
||||
envvar = 'OCRMYPDF_' + name.upper()
|
||||
return os.environ.get(envvar, name)
|
||||
@@ -1,167 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
# © 2015 James R. Barlow: github.com/jbarlow83
|
||||
|
||||
from tempfile import NamedTemporaryFile
|
||||
from subprocess import run, PIPE, STDOUT, CalledProcessError
|
||||
from shutil import copy
|
||||
from functools import lru_cache
|
||||
import re
|
||||
import sys
|
||||
from . import get_program
|
||||
from ..exceptions import SubprocessOutputError
|
||||
from PIL import Image
|
||||
|
||||
|
||||
@lru_cache(maxsize=1)
|
||||
def version():
|
||||
args_gs = [
|
||||
get_program('gs'),
|
||||
'--version'
|
||||
]
|
||||
try:
|
||||
version = check_output(
|
||||
args_gs, close_fds=True, universal_newlines=True,
|
||||
stderr=STDOUT)
|
||||
except CalledProcessError as e:
|
||||
print("Could not find Ghostscript executable on system PATH.",
|
||||
file=sys.stderr)
|
||||
raise MissingDependencyError from e
|
||||
|
||||
return version.strip()
|
||||
|
||||
|
||||
def _gs_error_reported(stream):
|
||||
return re.search(r'error', stream, flags=re.IGNORECASE)
|
||||
|
||||
|
||||
def rasterize_pdf(input_file, output_file, xres, yres, raster_device, log,
|
||||
pageno=1, page_dpi=None):
|
||||
"""
|
||||
Rasterize one page of a PDF at resolution (xres, yres) in canvas units.
|
||||
|
||||
The image is sized to match the integer pixels dimensions implied by
|
||||
(xres, yres) even if those numbers are noninteger. The image's DPI will
|
||||
be overridden with the values in page_dpi.
|
||||
|
||||
:param input_file:
|
||||
:param output_file:
|
||||
:param xres: resolution at which to rasterize page
|
||||
:param yres:
|
||||
:param raster_device:
|
||||
:param log:
|
||||
:param pageno: page number to rasterize
|
||||
:param page_dpi: resolution tuple (x, y) overriding output image DPI
|
||||
:return:
|
||||
"""
|
||||
res = xres, yres
|
||||
int_res = round(xres), round(yres)
|
||||
if not page_dpi:
|
||||
page_dpi = res
|
||||
with NamedTemporaryFile(delete=True) as tmp:
|
||||
args_gs = [
|
||||
get_program('gs'),
|
||||
'-dQUIET',
|
||||
'-dSAFER',
|
||||
'-dBATCH',
|
||||
'-dNOPAUSE',
|
||||
'-sDEVICE=%s' % raster_device,
|
||||
'-dFirstPage=%i' % pageno,
|
||||
'-dLastPage=%i' % pageno,
|
||||
'-o', tmp.name,
|
||||
'-r{0}x{1}'.format(str(int_res[0]), str(int_res[1])),
|
||||
input_file
|
||||
]
|
||||
|
||||
p = run(args_gs, stdout=PIPE, stderr=STDOUT,
|
||||
universal_newlines=True)
|
||||
if _gs_error_reported(p.stdout):
|
||||
log.error(p.stdout)
|
||||
else:
|
||||
log.debug(p.stdout)
|
||||
|
||||
if p.returncode != 0:
|
||||
log.error('Ghostscript rasterizing failed')
|
||||
raise SubprocessOutputError()
|
||||
|
||||
# Ghostscript only accepts integers for output resolution
|
||||
# if the resolution happens to be fractional, then the discrepancy
|
||||
# would change the size of the output page, especially if the DPI
|
||||
# is quite low. Resize the image to the expected size
|
||||
tmp.seek(0)
|
||||
with Image.open(tmp) as im:
|
||||
expected_size = round(im.size[0] / int_res[0] * res[0]), \
|
||||
round(im.size[1] / int_res[1] * res[1])
|
||||
if expected_size != im.size or page_dpi != (xres, yres):
|
||||
log.debug(
|
||||
"Ghostscript: resize output image {} -> {}".format(
|
||||
im.size, expected_size))
|
||||
im.resize(expected_size).save(output_file, dpi=page_dpi)
|
||||
else:
|
||||
copy(tmp.name, output_file)
|
||||
|
||||
|
||||
def generate_pdfa(pdf_pages, output_file, compression, log,
|
||||
threads=1, pdf_version='1.5'):
|
||||
compression_args = []
|
||||
if compression == 'jpeg':
|
||||
compression_args = [
|
||||
"-dAutoFilterColorImages=false",
|
||||
"-dColorImageFilter=/DCTEncode",
|
||||
"-dAutoFilterGrayImages=false",
|
||||
"-dGrayImageFilter=/DCTEncode",
|
||||
]
|
||||
elif compression == 'lossless':
|
||||
compression_args = [
|
||||
"-dAutoFilterColorImages=false",
|
||||
"-dColorImageFilter=/FlateEncode",
|
||||
"-dAutoFilterGrayImages=false",
|
||||
"-dGrayImageFilter=/FlateEncode",
|
||||
]
|
||||
else:
|
||||
compression_args = [
|
||||
"-dAutoFilterColorImages=true",
|
||||
"-dAutoFilterGrayImages=true",
|
||||
]
|
||||
|
||||
with NamedTemporaryFile(delete=True) as gs_pdf:
|
||||
args_gs = [
|
||||
get_program("gs"),
|
||||
"-dQUIET",
|
||||
"-dBATCH",
|
||||
"-dNOPAUSE",
|
||||
"-dCompatibilityLevel=" + str(pdf_version),
|
||||
"-dNumRenderingThreads=" + str(threads),
|
||||
"-sDEVICE=pdfwrite",
|
||||
"-dAutoRotatePages=/None",
|
||||
"-sColorConversionStrategy=/RGB",
|
||||
"-sProcessColorModel=DeviceRGB"
|
||||
] + compression_args + [
|
||||
"-dJPEGQ=95",
|
||||
"-dPDFA=2",
|
||||
"-dPDFACompatibilityPolicy=1",
|
||||
"-sOutputFile=" + gs_pdf.name,
|
||||
]
|
||||
args_gs.extend(pdf_pages)
|
||||
p = run(args_gs, stdout=PIPE, stderr=STDOUT,
|
||||
universal_newlines=True)
|
||||
|
||||
if _gs_error_reported(p.stdout):
|
||||
log.error(p.stdout)
|
||||
elif 'overprint mode not set' in p.stdout:
|
||||
# Unless someone is going to print PDF/A documents on a
|
||||
# magical sRGB printer I can't see the removal of overprinting
|
||||
# being a problem....
|
||||
log.debug(
|
||||
"Ghostscript had to remove PDF 'overprinting' from the "
|
||||
"input file to complete PDF/A conversion. "
|
||||
)
|
||||
else:
|
||||
log.debug(p.stdout)
|
||||
|
||||
if p.returncode == 0:
|
||||
# Ghostscript does not change return code when it fails to create
|
||||
# PDF/A - check PDF/A status elsewhere
|
||||
copy(gs_pdf.name, output_file)
|
||||
else:
|
||||
log.error('Ghostscript PDF/A rendering failed')
|
||||
raise SubprocessOutputError()
|
||||
@@ -1,137 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
# © 2015 James R. Barlow: github.com/jbarlow83
|
||||
|
||||
from subprocess import CalledProcessError, STDOUT, PIPE, run, check_output
|
||||
from functools import lru_cache
|
||||
import sys
|
||||
import os
|
||||
import re
|
||||
|
||||
from ..exceptions import InputFileError, SubprocessOutputError, \
|
||||
MissingDependencyError, EncryptedPdfError
|
||||
from . import get_program
|
||||
|
||||
|
||||
@lru_cache(maxsize=1)
|
||||
def version():
|
||||
args_qpdf = [
|
||||
get_program('qpdf'),
|
||||
'--version'
|
||||
]
|
||||
try:
|
||||
p = run(args_qpdf, universal_newlines=True, stderr=STDOUT,
|
||||
stdout=PIPE)
|
||||
except CalledProcessError as e:
|
||||
print("Could not find qpdf executable on system PATH.",
|
||||
file=sys.stderr)
|
||||
raise MissingDependencyError() from e
|
||||
|
||||
qpdf_version = re.match(r'qpdf version (.+)', p.stdout).group(1)
|
||||
return qpdf_version
|
||||
|
||||
|
||||
def check(input_file, log=None):
|
||||
args_qpdf = [
|
||||
get_program('qpdf'),
|
||||
'--check',
|
||||
input_file
|
||||
]
|
||||
|
||||
if log is None:
|
||||
import logging as log
|
||||
|
||||
try:
|
||||
check_output(args_qpdf, stderr=STDOUT, universal_newlines=True)
|
||||
except CalledProcessError as e:
|
||||
if e.returncode == 2:
|
||||
log.error("{0}: not a valid PDF, and could not repair it.".format(
|
||||
input_file))
|
||||
log.error("Details:")
|
||||
log.error(e.output)
|
||||
elif e.returncode == 3:
|
||||
log.info("qpdf --check returned warnings:")
|
||||
log.info(e.output)
|
||||
else:
|
||||
log.warning(e.output)
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
def _probably_encrypted(e):
|
||||
"""qpdf can report a false positive "file is encrypted" message for damaged
|
||||
files - suppress this"""
|
||||
return e.returncode == 2 and \
|
||||
'invalid password' in e.output and \
|
||||
'file is damaged' not in e.output
|
||||
|
||||
|
||||
def repair(input_file, output_file, log):
|
||||
args_qpdf = [
|
||||
get_program('qpdf'), input_file, output_file
|
||||
]
|
||||
try:
|
||||
check_output(args_qpdf, stderr=STDOUT, universal_newlines=True)
|
||||
except CalledProcessError as e:
|
||||
if e.returncode == 3 and e.output.find("operation succeeded"):
|
||||
log.debug('qpdf found and fixed errors: ' + e.output)
|
||||
log.debug(e.output)
|
||||
return
|
||||
|
||||
if _probably_encrypted(e):
|
||||
log.error("{0}: this PDF is password-protected - password must "
|
||||
"be removed for OCR".format(input_file))
|
||||
raise EncryptedPdfError() from e
|
||||
elif e.returncode == 2:
|
||||
log.error("{0}: not a valid PDF, and could not repair it.".format(
|
||||
input_file))
|
||||
log.error("Details: " + e.output)
|
||||
raise InputFileError() from e
|
||||
else:
|
||||
log.error("{0}: unknown error".format(
|
||||
input_file))
|
||||
log.error(e.output)
|
||||
raise SubprocessOutputError() from e
|
||||
|
||||
|
||||
def get_npages(input_file, log):
|
||||
try:
|
||||
pages = check_output(
|
||||
[get_program('qpdf'), '--show-npages', input_file],
|
||||
universal_newlines=True, close_fds=True)
|
||||
except CalledProcessError as e:
|
||||
if e.returncode == 2 and e.output.find('No such file'):
|
||||
log.error(e.output)
|
||||
raise InputFileError() from e
|
||||
return int(pages)
|
||||
|
||||
|
||||
def split_pages(input_file, work_folder, npages):
|
||||
"""Split multipage PDF into individual pages.
|
||||
|
||||
Incredibly enough, this multiple process approach is about 70 times
|
||||
faster than using Ghostscript.
|
||||
"""
|
||||
for n in range(int(npages)):
|
||||
args_qpdf = [
|
||||
get_program('qpdf'), input_file,
|
||||
'--pages', input_file, '{0}'.format(n + 1), '--',
|
||||
os.path.join(work_folder, '{0:06d}.page.pdf'.format(n + 1))
|
||||
]
|
||||
run(args_qpdf, check=True)
|
||||
|
||||
|
||||
def merge(input_files, output_file, min_version=None):
|
||||
"""Merge the list of input files (all filenames) into the output file.
|
||||
|
||||
The input files may contain one or more pages.
|
||||
"""
|
||||
version_arg = ['--min-version={}'.format(min_version)] \
|
||||
if min_version else []
|
||||
|
||||
args_qpdf = [
|
||||
get_program('qpdf')
|
||||
] + version_arg + [
|
||||
input_files[0], '--pages'
|
||||
] + input_files + ['--', output_file]
|
||||
run(args_qpdf, check=True)
|
||||
|
||||
@@ -1,88 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
# © 2016 James R. Barlow: github.com/jbarlow83
|
||||
|
||||
from functools import partial
|
||||
from collections.abc import Iterable
|
||||
from contextlib import suppress, contextmanager
|
||||
import sys
|
||||
import os
|
||||
|
||||
|
||||
def re_symlink(input_file, soft_link_name, log=None):
|
||||
"""
|
||||
Helper function: relinks soft symbolic link if necessary
|
||||
"""
|
||||
|
||||
if log is None:
|
||||
prdebug = partial(print, file=sys.stderr)
|
||||
else:
|
||||
prdebug = log.debug
|
||||
|
||||
# Guard against soft linking to oneself
|
||||
if input_file == soft_link_name:
|
||||
prdebug("Warning: No symbolic link made. You are using " +
|
||||
"the original data directory as the working directory.")
|
||||
return
|
||||
|
||||
# Soft link already exists: delete for relink?
|
||||
if os.path.lexists(soft_link_name):
|
||||
# do not delete or overwrite real (non-soft link) file
|
||||
if not os.path.islink(soft_link_name):
|
||||
raise FileExistsError(
|
||||
"%s exists and is not a link" % soft_link_name)
|
||||
try:
|
||||
os.unlink(soft_link_name)
|
||||
except:
|
||||
prdebug("Can't unlink %s" % (soft_link_name))
|
||||
|
||||
if not os.path.exists(input_file):
|
||||
raise FileNotFoundError(
|
||||
"trying to create a broken symlink to %s" % input_file)
|
||||
|
||||
prdebug("os.symlink(%s, %s)" % (input_file, soft_link_name))
|
||||
|
||||
# Create symbolic link using absolute path
|
||||
os.symlink(
|
||||
os.path.abspath(input_file),
|
||||
soft_link_name
|
||||
)
|
||||
|
||||
|
||||
def is_iterable_notstr(thing):
|
||||
return isinstance(thing, Iterable) and not isinstance(thing, str)
|
||||
|
||||
|
||||
def page_number(input_file):
|
||||
return int(os.path.basename(input_file)[0:6])
|
||||
|
||||
|
||||
def is_file_writable(test_file):
|
||||
"""Intentionally racy test if target is writable.
|
||||
|
||||
We intend to write to the output file if and only if we succeed and
|
||||
can replace it atomically. Before doing the OCR work, make sure
|
||||
the location is writable.
|
||||
"""
|
||||
if os.path.exists(test_file):
|
||||
return os.access(
|
||||
test_file, os.W_OK,
|
||||
effective_ids=(os.access in os.supports_effective_ids))
|
||||
else:
|
||||
try:
|
||||
fp = open(test_file, 'wb')
|
||||
except OSError as e:
|
||||
return False
|
||||
else:
|
||||
fp.close()
|
||||
with suppress(OSError):
|
||||
os.unlink(test_file)
|
||||
return True
|
||||
|
||||
|
||||
@contextmanager
|
||||
def universal_open(p, *args, **kwargs):
|
||||
"Work around Python 3.5's inability to open(pathlib.Path())"
|
||||
try:
|
||||
yield p.open(*args, **kwargs)
|
||||
except AttributeError:
|
||||
yield open(p, *args, **kwargs)
|
||||
@@ -1,230 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
##############################################################################
|
||||
# Copyright (c) 2013-14: fritz-hh from Github
|
||||
# (https://github.com/fritz-hh)
|
||||
#
|
||||
# Copyright (c) 2010: Jonathan Brinley from Github
|
||||
# (https://github.com/jbrinley/HocrConverter)
|
||||
# Initial version by Jonathan Brinley, jonathanbrinley@gmail.com
|
||||
##############################################################################
|
||||
from reportlab.pdfgen.canvas import Canvas
|
||||
from reportlab.lib.units import inch
|
||||
from xml.etree import ElementTree
|
||||
from PIL import Image
|
||||
from collections import namedtuple
|
||||
import re
|
||||
import argparse
|
||||
|
||||
|
||||
Rect = namedtuple('Rect', ['x1', 'y1', 'x2', 'y2'])
|
||||
|
||||
|
||||
class HocrTransformError(Exception):
|
||||
pass
|
||||
|
||||
|
||||
class HocrTransform():
|
||||
|
||||
"""
|
||||
A class for converting documents from the hOCR format.
|
||||
For details of the hOCR format, see:
|
||||
http://docs.google.com/View?docid=dfxcv4vc_67g844kf
|
||||
"""
|
||||
|
||||
def __init__(self, hocrFileName, dpi):
|
||||
self.dpi = dpi
|
||||
self.boxPattern = re.compile(r'bbox((\s+\d+){4})')
|
||||
|
||||
self.hocr = ElementTree.parse(hocrFileName)
|
||||
|
||||
# if the hOCR file has a namespace, ElementTree requires its use to
|
||||
# find elements
|
||||
matches = re.match(r'({.*})html', self.hocr.getroot().tag)
|
||||
self.xmlns = ''
|
||||
if matches:
|
||||
self.xmlns = matches.group(1)
|
||||
|
||||
# get dimension in pt (not pixel!!!!) of the OCRed image
|
||||
self.width, self.height = None, None
|
||||
for div in self.hocr.findall(
|
||||
".//%sdiv[@class='ocr_page']" % (self.xmlns)):
|
||||
coords = self.element_coordinates(div)
|
||||
pt_coords = self.pt_from_pixel(coords)
|
||||
self.width = pt_coords.x2 - pt_coords.x1
|
||||
self.height = pt_coords.y2 - pt_coords.y1
|
||||
# there shouldn't be more than one, and if there is, we don't want
|
||||
# it
|
||||
break
|
||||
if self.width is None or self.height is None:
|
||||
raise HocrTransformError("hocr file is missing page dimensions")
|
||||
|
||||
def __str__(self):
|
||||
"""
|
||||
Return the textual content of the HTML body
|
||||
"""
|
||||
if self.hocr is None:
|
||||
return ''
|
||||
body = self.hocr.find(".//%sbody" % (self.xmlns))
|
||||
if body:
|
||||
return self._get_element_text(body)
|
||||
else:
|
||||
return ''
|
||||
|
||||
def _get_element_text(self, element):
|
||||
"""
|
||||
Return the textual content of the element and its children
|
||||
"""
|
||||
text = ''
|
||||
if element.text is not None:
|
||||
text += element.text
|
||||
for child in element.getchildren():
|
||||
text += self._get_element_text(child)
|
||||
if element.tail is not None:
|
||||
text += element.tail
|
||||
return text
|
||||
|
||||
def element_coordinates(self, element):
|
||||
"""
|
||||
Returns a tuple containing the coordinates of the bounding box around
|
||||
an element
|
||||
"""
|
||||
out = (0, 0, 0, 0)
|
||||
if 'title' in element.attrib:
|
||||
matches = self.boxPattern.search(element.attrib['title'])
|
||||
if matches:
|
||||
coords = matches.group(1).split()
|
||||
out = Rect._make(int(coords[n]) for n in range(4))
|
||||
return out
|
||||
|
||||
def pt_from_pixel(self, pxl):
|
||||
"""
|
||||
Returns the quantity in PDF units (pt) given quantity in pixels
|
||||
"""
|
||||
return Rect._make(
|
||||
(c / self.dpi * inch) for c in pxl)
|
||||
|
||||
def replace_unsupported_chars(self, s):
|
||||
"""
|
||||
Given an input string, returns the corresponding string that:
|
||||
- is available in the helvetica facetype
|
||||
- does not contain any ligature (to allow easy search in the PDF file)
|
||||
"""
|
||||
# The 'u' before the character to replace indicates that it is a
|
||||
# unicode character
|
||||
s = s.replace(u"fl", "fl")
|
||||
s = s.replace(u"fi", "fi")
|
||||
return s
|
||||
|
||||
def to_pdf(self, outFileName, imageFileName=None, showBoundingboxes=False,
|
||||
fontname="Helvetica", invisibleText=False):
|
||||
"""
|
||||
Creates a PDF file with an image superimposed on top of the text.
|
||||
Text is positioned according to the bounding box of the lines in
|
||||
the hOCR file.
|
||||
The image need not be identical to the image used to create the hOCR
|
||||
file.
|
||||
It can have a lower resolution, different color mode, etc.
|
||||
"""
|
||||
# create the PDF file
|
||||
# page size in points (1/72 in.)
|
||||
pdf = Canvas(
|
||||
outFileName, pagesize=(self.width, self.height), pageCompression=1)
|
||||
|
||||
# draw bounding box for each paragraph
|
||||
# light blue for bounding box of paragraph
|
||||
pdf.setStrokeColorRGB(0, 1, 1)
|
||||
# light blue for bounding box of paragraph
|
||||
pdf.setFillColorRGB(0, 1, 1)
|
||||
pdf.setLineWidth(0) # no line for bounding box
|
||||
for elem in self.hocr.findall(
|
||||
".//%sp[@class='%s']" % (self.xmlns, "ocr_par")):
|
||||
|
||||
elemtxt = self._get_element_text(elem).rstrip()
|
||||
if len(elemtxt) == 0:
|
||||
continue
|
||||
|
||||
pxl_coords = self.element_coordinates(elem)
|
||||
pt = self.pt_from_pixel(pxl_coords)
|
||||
|
||||
# draw the bbox border
|
||||
if showBoundingboxes:
|
||||
pdf.rect(
|
||||
pt.x1, self.height - pt.y2, pt.x2 - pt.x1, pt.y2 - pt.y1,
|
||||
fill=1)
|
||||
|
||||
# check if element with class 'ocrx_word' are available
|
||||
# otherwise use 'ocr_line' as fallback
|
||||
elemclass = "ocr_line"
|
||||
if self.hocr.find(
|
||||
".//%sspan[@class='ocrx_word']" % (self.xmlns)) is not None:
|
||||
elemclass = "ocrx_word"
|
||||
|
||||
# itterate all text elements
|
||||
# light green for bounding box of word/line
|
||||
pdf.setStrokeColorRGB(1, 0, 0)
|
||||
pdf.setLineWidth(0.5) # bounding box line width
|
||||
pdf.setDash(6, 3) # bounding box is dashed
|
||||
pdf.setFillColorRGB(0, 0, 0) # text in black
|
||||
for elem in self.hocr.findall(
|
||||
".//%sspan[@class='%s']" % (self.xmlns, elemclass)):
|
||||
|
||||
elemtxt = self._get_element_text(elem).rstrip()
|
||||
|
||||
elemtxt = self.replace_unsupported_chars(elemtxt)
|
||||
|
||||
if len(elemtxt) == 0:
|
||||
continue
|
||||
|
||||
pxl_coords = self.element_coordinates(elem)
|
||||
pt = self.pt_from_pixel(pxl_coords)
|
||||
|
||||
# draw the bbox border
|
||||
if showBoundingboxes:
|
||||
pdf.rect(
|
||||
pt.x1, self.height - pt.y2, pt.x2 - pt.x1, pt.y2 - pt.y1,
|
||||
fill=0)
|
||||
|
||||
text = pdf.beginText()
|
||||
fontsize = pt.y2 - pt.y1
|
||||
text.setFont(fontname, fontsize)
|
||||
if invisibleText:
|
||||
text.setTextRenderMode(3) # Invisible (indicates OCR text)
|
||||
|
||||
# set cursor to bottom left corner of bbox (adjust for dpi)
|
||||
text.setTextOrigin(pt.x1, self.height - pt.y2)
|
||||
|
||||
# scale the width of the text to fill the width of the bbox
|
||||
text.setHorizScale(
|
||||
100 * (pt.x2 - pt.x1) / pdf.stringWidth(
|
||||
elemtxt, fontname, fontsize))
|
||||
|
||||
# write the text to the page
|
||||
text.textLine(elemtxt)
|
||||
pdf.drawText(text)
|
||||
|
||||
# put the image on the page, scaled to fill the page
|
||||
if imageFileName is not None:
|
||||
pdf.drawImage(imageFileName, 0, 0,
|
||||
width=self.width, height=self.height)
|
||||
|
||||
# finish up the page and save it
|
||||
pdf.showPage()
|
||||
pdf.save()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser(description='Convert hocr file to PDF')
|
||||
parser.add_argument('-b', '--boundingboxes', action="store_true",
|
||||
default=False, help='Show bounding boxes borders')
|
||||
parser.add_argument('-r', '--resolution', type=int,
|
||||
default=300,
|
||||
help='Resolution of the image that was OCRed')
|
||||
parser.add_argument('-i', '--image', default=None,
|
||||
help='Path to the image to be placed above the text')
|
||||
parser.add_argument('hocrfile', help='Path to the hocr file to be parsed')
|
||||
parser.add_argument(
|
||||
'outputfile', help='Path to the PDF file to be generated')
|
||||
args = parser.parse_args()
|
||||
|
||||
hocr = HocrTransform(args.hocrfile, args.resolution)
|
||||
hocr.to_pdf(args.outputfile, args.image, args.boundingboxes)
|
||||
@@ -1,2 +0,0 @@
|
||||
"""Bindings to external libraries"""
|
||||
# © 2017 James R. Barlow: github.com/jbarlow83
|
||||
@@ -1,538 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
# © 2015 James R. Barlow: github.com/jbarlow83
|
||||
|
||||
from subprocess import Popen, PIPE
|
||||
from decimal import Decimal
|
||||
from math import hypot, isclose
|
||||
import re
|
||||
import sys
|
||||
import PyPDF2 as pypdf
|
||||
from collections import namedtuple
|
||||
import warnings
|
||||
|
||||
|
||||
warnings.warn("ocrmypdf.pageinfo is deprecated'; use ocrmypdf.pdfinfo",
|
||||
DeprecationWarning)
|
||||
|
||||
matrix_mult = pypdf.pdf.utils.matrixMultiply
|
||||
|
||||
FRIENDLY_COLORSPACE = {
|
||||
'/DeviceGray': 'gray',
|
||||
'/CalGray': 'gray',
|
||||
'/DeviceRGB': 'rgb',
|
||||
'/CalRGB': 'rgb',
|
||||
'/DeviceCMYK': 'cmyk',
|
||||
'/Lab': 'lab',
|
||||
'/ICCBased': 'icc',
|
||||
'/Indexed': 'index',
|
||||
'/Separation': 'sep',
|
||||
'/DeviceN': 'devn',
|
||||
'/Pattern': '-',
|
||||
'/G': 'gray', # Abbreviations permitted in inline images
|
||||
'/RGB': 'rgb',
|
||||
'/CMYK': 'cmyk',
|
||||
'/I': 'index',
|
||||
}
|
||||
|
||||
FRIENDLY_ENCODING = {
|
||||
'/CCITTFaxDecode': 'ccitt',
|
||||
'/DCTDecode': 'jpeg',
|
||||
'/JPXDecode': 'jpx',
|
||||
'/JBIG2Decode': 'jbig2',
|
||||
'/CCF': 'ccitt', # Abbreviations permitted in inline images
|
||||
'/DCT': 'jpeg',
|
||||
'/AHx': 'asciihex',
|
||||
'/A85': 'ascii85',
|
||||
'/LZW': 'lzw',
|
||||
'/Fl': 'flate',
|
||||
'/RL': 'runlength'
|
||||
}
|
||||
|
||||
FRIENDLY_COMP = {
|
||||
'gray': 1,
|
||||
'rgb': 3,
|
||||
'cmyk': 4,
|
||||
'lab': 3,
|
||||
'index': 1
|
||||
}
|
||||
|
||||
|
||||
UNIT_SQUARE = (1.0, 0.0, 0.0, 1.0, 0.0, 0.0)
|
||||
|
||||
|
||||
def _matrix_from_shorthand(shorthand):
|
||||
"""Convert from PDF matrix shorthand to full matrix
|
||||
|
||||
PDF 1.7 spec defines a shorthand for describing the entries of a matrix
|
||||
since the last column is always (0, 0, 1).
|
||||
"""
|
||||
|
||||
a, b, c, d, e, f = map(float, shorthand)
|
||||
return ((a, b, 0),
|
||||
(c, d, 0),
|
||||
(e, f, 1))
|
||||
|
||||
|
||||
def _shorthand_from_matrix(matrix):
|
||||
"""Convert from transformation matrix to PDF shorthand."""
|
||||
a, b = matrix[0][0], matrix[0][1]
|
||||
c, d = matrix[1][0], matrix[1][1]
|
||||
e, f = matrix[2][0], matrix[2][1]
|
||||
return tuple(map(float, (a, b, c, d, e, f)))
|
||||
|
||||
|
||||
def _is_unit_square(shorthand):
|
||||
values = map(float, shorthand)
|
||||
pairwise = zip(values, UNIT_SQUARE)
|
||||
return all([isclose(a, b, rel_tol=1e-3) for a, b in pairwise])
|
||||
|
||||
XobjectSettings = namedtuple('XobjectSettings',
|
||||
['name', 'shorthand', 'stack_depth'])
|
||||
|
||||
InlineSettings = namedtuple('InlineSettings',
|
||||
['settings', 'shorthand', 'stack_depth'])
|
||||
|
||||
ContentsInfo = namedtuple('ContentsInfo', ['xobject_settings', 'inline_images'])
|
||||
|
||||
|
||||
def _normalize_stack(operations):
|
||||
"""Fix runs of qQ's in the stack
|
||||
|
||||
For some reason PyPDF2 converts runs of qqq, QQ, QQQq, etc. into single
|
||||
operations. Break this silliness up and issue each stack operation
|
||||
individually so we don't lose count.
|
||||
|
||||
"""
|
||||
for operands, command in operations:
|
||||
if re.match(br'Q*q+$', command): # Zero or more Q, one or more q
|
||||
for char in command: # Split into individual bytes
|
||||
yield ([], bytes([char])) # Yield individual bytes
|
||||
else:
|
||||
yield (operands, command)
|
||||
|
||||
|
||||
def _interpret_contents(contentstream, initial_shorthand=UNIT_SQUARE):
|
||||
"""Interpret the PDF content stream
|
||||
|
||||
The stack represents the state of the PDF graphics stack. We are only
|
||||
interested in the current transformation matrix (CTM) so we only track
|
||||
this object; a full implementation would need to track many other items.
|
||||
|
||||
The CTM is initialized to the mapping from user space to device space.
|
||||
PDF units are 1/72". In a PDF viewer or printer this matrix is initialized
|
||||
to the transformation to device space. For example if set to
|
||||
(1/72, 0, 0, 1/72, 0, 0) then all units would be calculated in inches.
|
||||
|
||||
Images are always considered to be (0, 0) -> (1, 1). Before drawing an
|
||||
image there should be a 'cm' that sets up an image coordinate system
|
||||
where drawing from (0, 0) -> (1, 1) will draw on the desired area of the
|
||||
page.
|
||||
|
||||
PDF units suit our needs so we initialize ctm to the identity matrix.
|
||||
|
||||
PyPDF2 replaces inline images with a fake "INLINE IMAGE" operator.
|
||||
|
||||
"""
|
||||
|
||||
operations = contentstream.operations
|
||||
stack = []
|
||||
ctm = _matrix_from_shorthand(initial_shorthand)
|
||||
xobject_settings = []
|
||||
inline_images = []
|
||||
|
||||
for n, op in enumerate(_normalize_stack(operations)):
|
||||
operands, command = op
|
||||
if command == b'q':
|
||||
stack.append(ctm)
|
||||
if len(stack) > 32:
|
||||
raise RuntimeError(
|
||||
"PDF graphics stack overflow, command %i" % n)
|
||||
elif command == b'Q':
|
||||
try:
|
||||
ctm = stack.pop()
|
||||
except IndexError:
|
||||
raise RuntimeError(
|
||||
"PDF graphics stack underflow, command %i" % n)
|
||||
elif command == b'cm':
|
||||
ctm = matrix_mult(
|
||||
_matrix_from_shorthand(operands), ctm)
|
||||
elif command == b'Do':
|
||||
image_name = operands[0]
|
||||
settings = XobjectSettings(
|
||||
name=image_name, shorthand=_shorthand_from_matrix(ctm),
|
||||
stack_depth=len(stack))
|
||||
xobject_settings.append(settings)
|
||||
elif command == b'INLINE IMAGE':
|
||||
settings = operands['settings']
|
||||
inline = InlineSettings(
|
||||
settings=settings, shorthand=_shorthand_from_matrix(ctm),
|
||||
stack_depth=len(stack))
|
||||
inline_images.append(inline)
|
||||
|
||||
return ContentsInfo(
|
||||
xobject_settings=xobject_settings,
|
||||
inline_images=inline_images)
|
||||
|
||||
|
||||
def _get_dpi(ctm_shorthand, image_size):
|
||||
"""Given the transformation matrix and image size, find the image DPI.
|
||||
|
||||
PDFs do not include image resolution information within image data.
|
||||
Instead, the PDF page content stream describes the location where the
|
||||
image will be rasterized, and the effective resolution is the ratio of the
|
||||
pixel size to raster target size.
|
||||
|
||||
Normally a scanned PDF has the paper size set appropriately but this is
|
||||
not guaranteed. The most common case is a cropped image will change the
|
||||
page size (/CropBox) without altering the page content stream. That means
|
||||
it is not sufficient to assume that the image fills the page, even though
|
||||
that is the most common case.
|
||||
|
||||
A PDF image may be scaled (always), cropped, translated, rotated in place
|
||||
to an arbitrary angle (rarely) and skewed. Only equal area mappings can
|
||||
be expressed, that is, it is not necessary to consider distortions where
|
||||
the effective DPI varies with position.
|
||||
|
||||
To determine the image scale, transform an offset axis vector v0 (0, 0),
|
||||
width-axis vector v0 (1, 0), height-axis vector vh (0, 1) with the matrix,
|
||||
which gives the dimensions of the image in PDF units. From there we can
|
||||
compare to actual image dimensions. PDF uses
|
||||
row vector * matrix_tranposed unlike the traditional
|
||||
matrix * column vector.
|
||||
|
||||
The offset, width and height vectors can be combined in a matrix and
|
||||
multiplied by the transform matrix. Then we want to calculated
|
||||
magnitude(width_vector - offset_vector)
|
||||
and
|
||||
magnitude(height_vector - offset_vector)
|
||||
|
||||
When the above is worked out algebraically, the effect of translation
|
||||
cancels out, and the vector magnitudes become functions of the nonzero
|
||||
transformation matrix indices. The results of the derivation are used
|
||||
in this code.
|
||||
|
||||
pdfimages -list does calculate the DPI in some way that is not completely
|
||||
naive, but it does not get the DPI of rotated images right, so cannot be
|
||||
used anymore to validate this. Photoshop works, or using Acrobat to
|
||||
rotate the image back to normal.
|
||||
|
||||
It does not matter if the image is partially cropped, or even out of the
|
||||
/MediaBox.
|
||||
|
||||
"""
|
||||
|
||||
a, b, c, d, _, _ = ctm_shorthand
|
||||
|
||||
# Calculate the width and height of the image in PDF units
|
||||
image_drawn_width = hypot(a, b)
|
||||
image_drawn_height = hypot(c, d)
|
||||
|
||||
# The scale of the image is pixels per PDF unit (1/72")
|
||||
scale_w = image_size[0] / image_drawn_width
|
||||
scale_h = image_size[1] / image_drawn_height
|
||||
|
||||
# DPI = scale * 72
|
||||
dpi_w = scale_w * 72.0
|
||||
dpi_h = scale_h * 72.0
|
||||
|
||||
return (dpi_w, dpi_h)
|
||||
|
||||
|
||||
def _find_inline_images(contentsinfo):
|
||||
"Find inline images in the contentstream"
|
||||
|
||||
for n, inline in enumerate(contentsinfo.inline_images):
|
||||
image = {}
|
||||
image['name'] = str('inline-%02d' % n)
|
||||
image['width'] = inline.settings['/W']
|
||||
image['height'] = inline.settings['/H']
|
||||
if '/BPC' in inline.settings:
|
||||
image['bpc'] = inline.settings['/BPC']
|
||||
else:
|
||||
image['bpc'] = 8
|
||||
if '/CS' in inline.settings:
|
||||
image['color'] = FRIENDLY_COLORSPACE.get(inline.settings['/CS'], '-')
|
||||
else:
|
||||
image['color'] = '-'
|
||||
image['comp'] = FRIENDLY_COMP.get(image['color'], '?')
|
||||
if '/F' in inline.settings:
|
||||
filter_ = inline.settings['/F']
|
||||
if isinstance(filter_, pypdf.generic.ArrayObject):
|
||||
filter_ = filter_[0]
|
||||
image['enc'] = FRIENDLY_ENCODING.get(filter_, 'image')
|
||||
else:
|
||||
image['enc'] = 'image'
|
||||
|
||||
dpi_w, dpi_h = _get_dpi(
|
||||
inline.shorthand, (image['width'], image['height']))
|
||||
image['dpi_w'], image['dpi_h'] = Decimal(dpi_w), Decimal(dpi_h)
|
||||
yield image
|
||||
|
||||
|
||||
def _image_xobjects(container):
|
||||
"""Search for all XObject-based images in the container
|
||||
|
||||
Usually the container is a page, but it could also be a Form XObject
|
||||
that contains images. Filter out the Form XObjects which are dealt with
|
||||
elsewhere.
|
||||
|
||||
Generate a sequence of tuples (image, xobj container), where container,
|
||||
where xobj is the name of the object and image is the object itself,
|
||||
since the object does not know its own name.
|
||||
|
||||
"""
|
||||
|
||||
if '/Resources' not in container:
|
||||
return
|
||||
resources = container['/Resources']
|
||||
if '/XObject' not in resources:
|
||||
return
|
||||
for xobj in resources['/XObject']:
|
||||
candidate = resources['/XObject'][xobj]
|
||||
if candidate['/Subtype'] == '/Image':
|
||||
image = candidate
|
||||
yield (image, xobj)
|
||||
|
||||
|
||||
def _find_regular_images(container, contentsinfo):
|
||||
"""Find images stored in the container's /Resources /XObject
|
||||
|
||||
Usually the container is a page, but it could also be a Form XObject
|
||||
that contains images.
|
||||
|
||||
Generates images with their DPI at time of drawing.
|
||||
|
||||
"""
|
||||
|
||||
for pdfimage, xobj in _image_xobjects(container):
|
||||
image = {}
|
||||
image['name'] = xobj
|
||||
image['width'] = pdfimage['/Width']
|
||||
image['height'] = pdfimage['/Height']
|
||||
if '/BitsPerComponent' in pdfimage:
|
||||
image['bpc'] = pdfimage['/BitsPerComponent']
|
||||
else:
|
||||
image['bpc'] = 8
|
||||
|
||||
# Fixme: this is incorrectly treats explicit masks as stencil masks,
|
||||
# but good enough for now. Explicit masks have /ImageMask true but are
|
||||
# never called for in content stream, instead are drawn as a /Mask on
|
||||
# other images. For our purposes finding out the details of /Mask
|
||||
# will seldom matter.
|
||||
if '/ImageMask' in pdfimage:
|
||||
image['type'] = 'stencil' if pdfimage['/ImageMask'].value \
|
||||
else 'image'
|
||||
else:
|
||||
image['type'] = 'image'
|
||||
if '/Filter' in pdfimage:
|
||||
filter_ = pdfimage['/Filter']
|
||||
if isinstance(filter_, pypdf.generic.ArrayObject):
|
||||
filter_ = filter_[0]
|
||||
image['enc'] = FRIENDLY_ENCODING.get(filter_, 'image')
|
||||
else:
|
||||
image['enc'] = 'image'
|
||||
if '/ColorSpace' in pdfimage:
|
||||
cs = pdfimage['/ColorSpace']
|
||||
if isinstance(cs, pypdf.generic.ArrayObject):
|
||||
cs = cs[0]
|
||||
image['color'] = FRIENDLY_COLORSPACE.get(cs, '-')
|
||||
else:
|
||||
image['color'] = 'jpx' if image['enc'] == 'jpx' else '?'
|
||||
|
||||
image['comp'] = FRIENDLY_COMP.get(image['color'], '?')
|
||||
|
||||
# Bit of a hack... infer grayscale if component count is uncertain
|
||||
# but encoding must be monochrome. This happens if a monochrome image
|
||||
# has an ICC profile attached. Better solution would be to examine
|
||||
# the ICC profile.
|
||||
if image['comp'] == '?' and image['enc'] in ('ccitt', 'jbig2'):
|
||||
image['comp'] = FRIENDLY_COMP['gray']
|
||||
|
||||
image['dpi_w'] = image['dpi_h'] = 0
|
||||
|
||||
for xobj in contentsinfo.xobject_settings:
|
||||
# Loop in case the same image is display multiple times on a page
|
||||
if xobj.name != image['name']:
|
||||
continue
|
||||
|
||||
if xobj.stack_depth == 0 and _is_unit_square(xobj.shorthand):
|
||||
# At least one PDF in the wild (and test suite) draws an image
|
||||
# when the graphics stack depth is 0, meaning that the image
|
||||
# gets drawn into a square of 1x1 PDF units (or 1/72",
|
||||
# or 0.35 mm). The equivalent DPI will be >100,000. Exclude
|
||||
# these from our DPI calculation for the page.
|
||||
continue
|
||||
|
||||
dpi_w, dpi_h = _get_dpi(
|
||||
xobj.shorthand, (image['width'], image['height']))
|
||||
|
||||
# When image is used multiple times take the highest DPI it is
|
||||
# rendered at
|
||||
image['dpi_w'] = max(dpi_w, image.get('dpi_w', 0))
|
||||
image['dpi_h'] = max(dpi_h, image.get('dpi_h', 0))
|
||||
|
||||
DPI_PREC = Decimal('1.000')
|
||||
dpi = Decimal(image['dpi_w'] * image['dpi_h']).sqrt()
|
||||
image['dpi_w'] = Decimal(image['dpi_w']).quantize(DPI_PREC)
|
||||
image['dpi_h'] = Decimal(image['dpi_h']).quantize(DPI_PREC)
|
||||
image['dpi'] = dpi.quantize(DPI_PREC)
|
||||
yield image
|
||||
|
||||
|
||||
def _find_form_xobject_images(pdf, container, contentsinfo):
|
||||
"""Find any images that are in Form XObjects in the container
|
||||
|
||||
The container may be a page, or a parent Form XObject.
|
||||
|
||||
"""
|
||||
if '/Resources' not in container:
|
||||
return
|
||||
resources = container['/Resources']
|
||||
if '/XObject' not in resources:
|
||||
return
|
||||
for xobj in resources['/XObject']:
|
||||
candidate = resources['/XObject'][xobj]
|
||||
if candidate['/Subtype'] != '/Form':
|
||||
continue
|
||||
|
||||
form_xobject = candidate
|
||||
for settings in contentsinfo.xobject_settings:
|
||||
if settings.name != xobj:
|
||||
continue
|
||||
|
||||
# Find images once for each time this Form XObject is drawn.
|
||||
# This could be optimized to cache the multiple drawing events
|
||||
# but in practice both Form XObjects and multiple drawing of the
|
||||
# same object are both very rare.
|
||||
ctm_shorthand = settings.shorthand
|
||||
yield from _find_images(pdf, form_xobject, ctm_shorthand)
|
||||
|
||||
|
||||
def _find_images(pdf, container, shorthand=None):
|
||||
"""Find all individual instances of images drawn in the container
|
||||
|
||||
Usually the container is a page, but it may also be a Form XObject.
|
||||
|
||||
On a typical page images are stored inline or as regular images
|
||||
in an XObject.
|
||||
|
||||
Form XObjects may include inline images, XObject images,
|
||||
and recursively, other Form XObjects; and also vector drawing commands.
|
||||
|
||||
Every instance of an image being drawn somewhere is flattened and
|
||||
treated as a unique image, since if the same image is drawn multiple times
|
||||
on one page it may be drawn at differing resolutions, and our objective
|
||||
is to find the resolution at which the page can be rastered without
|
||||
downsampling.
|
||||
|
||||
"""
|
||||
|
||||
if container.get('/Type') == '/Page' and '/Contents' in container:
|
||||
# For a /Page the content stream is attached to the page's /Contents
|
||||
page = container
|
||||
contentstream = pypdf.pdf.ContentStream(page.getContents(), pdf)
|
||||
initial_shorthand = shorthand or UNIT_SQUARE
|
||||
elif container.get('/Type') == '/XObject' and \
|
||||
container['/Subtype'] == '/Form':
|
||||
# For a Form XObject that content stream is attached to the XObject
|
||||
contentstream = pypdf.pdf.ContentStream(container, pdf)
|
||||
|
||||
# Set the CTM to the state it was when the "Do" operator was
|
||||
# encountered that is drawing this instance of the Form XObject
|
||||
ctm = _matrix_from_shorthand(shorthand or UNIT_SQUARE)
|
||||
|
||||
# A Form XObject may provide its own matrix to map form space into
|
||||
# user space. Get this if one exists
|
||||
form_matrix = _matrix_from_shorthand(
|
||||
container.get('/Matrix', UNIT_SQUARE))
|
||||
|
||||
# Concatenate form matrix with CTM to ensure CTM is correct for
|
||||
# drawing this instance of the XObject
|
||||
ctm = matrix_mult(form_matrix, ctm)
|
||||
initial_shorthand = _shorthand_from_matrix(ctm)
|
||||
else:
|
||||
return
|
||||
|
||||
contentsinfo = _interpret_contents(contentstream, initial_shorthand)
|
||||
|
||||
yield from _find_inline_images(contentsinfo)
|
||||
yield from _find_regular_images(container, contentsinfo)
|
||||
yield from _find_form_xobject_images(pdf, container, contentsinfo)
|
||||
|
||||
|
||||
def _page_has_text(pdf, page):
|
||||
if not '/Contents' in page:
|
||||
return False
|
||||
|
||||
# Simple test
|
||||
text = page.extractText()
|
||||
if text.strip() != '':
|
||||
return True
|
||||
|
||||
# More nuanced test to deal with quirks of Tesseract PDF generation
|
||||
# Check if there's a Glyphless font
|
||||
try:
|
||||
font = page['/Resources']['/Font']
|
||||
except KeyError:
|
||||
pass
|
||||
else:
|
||||
font_objects = list(font.keys())
|
||||
for font_object in font_objects:
|
||||
basefont = font[font_object]['/BaseFont']
|
||||
if basefont.endswith('GlyphLessFont'):
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
|
||||
def _pdf_get_pageinfo(infile, pageno: int):
|
||||
pageinfo = {}
|
||||
pageinfo['pageno'] = pageno
|
||||
pageinfo['images'] = []
|
||||
|
||||
pdf = pypdf.PdfFileReader(infile)
|
||||
page = pdf.pages[pageno]
|
||||
|
||||
pageinfo['has_text'] = _page_has_text(pdf, page)
|
||||
|
||||
width_pt = page.mediaBox.getWidth()
|
||||
height_pt = page.mediaBox.getHeight()
|
||||
pageinfo['width_inches'] = width_pt / Decimal(72.0)
|
||||
pageinfo['height_inches'] = height_pt / Decimal(72.0)
|
||||
|
||||
try:
|
||||
pageinfo['rotate'] = int(page['/Rotate'])
|
||||
except KeyError:
|
||||
pageinfo['rotate'] = 0
|
||||
|
||||
pageinfo['images'] = [im for im in
|
||||
_find_images(pdf, page)]
|
||||
if pageinfo['images']:
|
||||
xres = max(image['dpi_w'] for image in pageinfo['images'])
|
||||
yres = max(image['dpi_h'] for image in pageinfo['images'])
|
||||
pageinfo['xres'], pageinfo['yres'] = xres, yres
|
||||
pageinfo['width_pixels'] = \
|
||||
int(round(xres * pageinfo['width_inches']))
|
||||
pageinfo['height_pixels'] = \
|
||||
int(round(yres * pageinfo['height_inches']))
|
||||
|
||||
return pageinfo
|
||||
|
||||
|
||||
def pdf_get_all_pageinfo(infile):
|
||||
pdf = pypdf.PdfFileReader(infile)
|
||||
return [_pdf_get_pageinfo(infile, n) for n in range(pdf.numPages)]
|
||||
|
||||
|
||||
def main():
|
||||
import argparse
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('infile')
|
||||
args = parser.parse_args()
|
||||
info = pdf_get_all_pageinfo(args.infile)
|
||||
from pprint import pprint
|
||||
pprint(info)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
@@ -1,163 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
# © 2015 James R. Barlow: github.com/jbarlow83
|
||||
#
|
||||
# Generate a PDFA_def.ps file for Ghostscript >= 9.14
|
||||
|
||||
from string import Template
|
||||
import codecs
|
||||
import pkg_resources
|
||||
import PyPDF2 as pypdf
|
||||
|
||||
ICC_PROFILE_RELPATH = 'data/sRGB.icc'
|
||||
|
||||
SRGB_ICC_PROFILE = pkg_resources.resource_filename(
|
||||
'ocrmypdf', ICC_PROFILE_RELPATH)
|
||||
|
||||
|
||||
# This is a template written in PostScript which is needed to create PDF/A
|
||||
# files, from the Ghostscript documentation. Lines beginning with % are
|
||||
# comments. Python substitution variables have a '$' prefix.
|
||||
pdfa_def_template = u"""%!
|
||||
% This is derived from Ghostscript's template for creating a PDF/A document.
|
||||
% This is a small PostScript program that includes some necessary information
|
||||
% to create a PDF/A compliant file.
|
||||
|
||||
% Define entries in the document Info dictionary :
|
||||
/ICCProfile ($icc_profile)
|
||||
def
|
||||
|
||||
[$docinfo
|
||||
/DOCINFO pdfmark
|
||||
|
||||
% Define an ICC profile :
|
||||
|
||||
[/_objdef {icc_PDFA} /type /stream /OBJ pdfmark
|
||||
[{icc_PDFA}
|
||||
<<
|
||||
/N currentpagedevice /ProcessColorModel known {
|
||||
currentpagedevice /ProcessColorModel get dup /DeviceGray eq
|
||||
{pop 1} {
|
||||
/DeviceRGB eq
|
||||
{3}{4} ifelse
|
||||
} ifelse
|
||||
} {
|
||||
(ERROR, unable to determine ProcessColorModel) == flush
|
||||
} ifelse
|
||||
>> /PUT pdfmark
|
||||
[{icc_PDFA} ICCProfile (r) file /PUT pdfmark
|
||||
|
||||
% Define the output intent dictionary :
|
||||
|
||||
[/_objdef {OutputIntent_PDFA} /type /dict /OBJ pdfmark
|
||||
[{OutputIntent_PDFA} <<
|
||||
/Type /OutputIntent % Must be so (the standard requires).
|
||||
/S /GTS_PDFA1 % Must be so (the standard requires).
|
||||
/DestOutputProfile {icc_PDFA} % Must be so (see above).
|
||||
/OutputConditionIdentifier ($icc_identifier)
|
||||
>> /PUT pdfmark
|
||||
[{Catalog} <</OutputIntents [ {OutputIntent_PDFA} ]>> /PUT pdfmark
|
||||
"""
|
||||
|
||||
|
||||
def encode_text_string(s: str) -> str:
|
||||
'''Encode text string to hex string for use in a PDF
|
||||
|
||||
From PDF 32000-1:2008 a string object may be included in hexademical form
|
||||
if it is enclosed in angle brackets. For general Unicode the string should
|
||||
be UTF-16 (big endian) with byte order marks. Many strings including all
|
||||
ASCII strings could be encoded as PdfDocEncoding literals provided
|
||||
that certain Postscript sequences are escaped. But it's far simpler to
|
||||
encode everything as UTF-16.
|
||||
'''
|
||||
|
||||
# Sometimes lazy C programmers leave their NULs at the end of strings they
|
||||
# insert into PDFs
|
||||
# tests/resources/aspect.pdf is one example (created by ImageMagick)
|
||||
s = s.replace('\x00', '')
|
||||
|
||||
if s == '':
|
||||
return ''
|
||||
|
||||
utf16_bytes = s.encode('utf-16be')
|
||||
ascii_hex_bytes = codecs.encode(b'\xfe\xff' + utf16_bytes, 'hex')
|
||||
ascii_hex_str = ascii_hex_bytes.decode('ascii').lower()
|
||||
return ascii_hex_str
|
||||
|
||||
|
||||
def _get_pdfa_def(icc_profile, icc_identifier, pdfmark):
|
||||
# Ghostscript <= 9.21 has a bug where null entries in DOCINFO might produce
|
||||
# ERROR: VMerror (-25) on closing pdfwrite device.
|
||||
# https://bugs.ghostscript.com/show_bug.cgi?id=697684
|
||||
# Work around this by only adding keys that have a nontrivial value
|
||||
docinfo_keys = ('/Title', '/Author', '/Subject', '/Creator', '/Keywords')
|
||||
docinfo_line_template = ' {key} <{value}>'
|
||||
|
||||
def docinfo_gen():
|
||||
for key in docinfo_keys:
|
||||
if key in pdfmark and pdfmark[key].strip() != '':
|
||||
line = docinfo_line_template.format(
|
||||
key=key, value=encode_text_string(pdfmark[key]))
|
||||
yield line
|
||||
|
||||
docinfo = '\n'.join(docinfo_gen())
|
||||
|
||||
t = Template(pdfa_def_template)
|
||||
result = t.substitute(icc_profile=icc_profile,
|
||||
icc_identifier=icc_identifier,
|
||||
docinfo=docinfo)
|
||||
return result
|
||||
|
||||
|
||||
def generate_pdfa_ps(target_filename, pdfmark, icc='sRGB'):
|
||||
if icc == 'sRGB':
|
||||
icc_profile = SRGB_ICC_PROFILE
|
||||
else:
|
||||
raise NotImplementedError("Only supporting sRGB")
|
||||
|
||||
ps = _get_pdfa_def(icc_profile, icc, pdfmark)
|
||||
|
||||
# We should have encoded everything to pure ASCII by this point, and
|
||||
# to be safe, only allow ASCII in PostScript
|
||||
with open(target_filename, 'w', encoding='ascii') as f:
|
||||
f.write(ps)
|
||||
|
||||
|
||||
def file_claims_pdfa(filename):
|
||||
"""Determines if the file claims to be PDF/A compliant
|
||||
|
||||
Checking if a file is a truly compliant PDF/A is a massive undertaking
|
||||
that no open source tool does properly. Some commercial tools are
|
||||
generally reliable (Acrobat).
|
||||
|
||||
This checks if the XMP metadata contains a PDF/A marker.
|
||||
"""
|
||||
|
||||
pdf = pypdf.PdfFileReader(filename)
|
||||
xmp = pdf.getXmpMetadata()
|
||||
|
||||
try:
|
||||
pdfa_nodes = xmp.getNodesInNamespace(
|
||||
aboutUri='',
|
||||
namespace='http://www.aiim.org/pdfa/ns/id/')
|
||||
except AttributeError:
|
||||
return {'pass': False, 'output': 'pdf',
|
||||
'conformance': 'No XMP metadata'}
|
||||
|
||||
pdfa_dict = {attr.localName: attr.value for attr in pdfa_nodes}
|
||||
if not pdfa_dict:
|
||||
return {'pass': False, 'output': 'pdf',
|
||||
'conformance': 'No XMP metadata'}
|
||||
|
||||
part_conformance = pdfa_dict['part'] + pdfa_dict['conformance']
|
||||
valid_part_conforms = {'1A', '1B', '2A', '2B', '2U', '3A', '3B', '3U'}
|
||||
|
||||
conformance = 'PDF/A-{}'.format(
|
||||
part_conformance)
|
||||
|
||||
if part_conformance in valid_part_conforms:
|
||||
pdfa_dict['pass'] = True
|
||||
pdfa_dict['output'] = 'pdfa'
|
||||
pdfa_dict['conformance'] = conformance
|
||||
|
||||
return pdfa_dict
|
||||
|
||||
+7
-5
@@ -1,9 +1,11 @@
|
||||
# requirements.txt can be used to replicate the developer's build environment
|
||||
# setup.py lists a separate set of requirements that are looser to simplify
|
||||
# installation
|
||||
ruffus == 2.6.3
|
||||
Pillow == 4.1.1
|
||||
cffi == 1.11.5
|
||||
img2pdf == 0.3.0
|
||||
pikepdf == 0.3.4
|
||||
Pillow >= 5.0.0, != 5.1.0 ; sys_platform == "darwin"
|
||||
pycparser == 2.18
|
||||
python-xmp-toolkit == 2.0.1
|
||||
reportlab == 3.4.0
|
||||
PyPDF2 == 1.26.0
|
||||
img2pdf == 0.2.3
|
||||
cffi == 1.10.0
|
||||
ruffus == 2.7.0
|
||||
|
||||
@@ -11,4 +11,6 @@ ignore =
|
||||
[tool:pytest]
|
||||
norecursedirs = lib .pc .git output cache resources
|
||||
testpaths = tests
|
||||
addopts = -n auto
|
||||
|
||||
[metadata]
|
||||
license_file = LICENSE
|
||||
@@ -1,6 +1,21 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
# © 2015 James R. Barlow: github.com/jbarlow83
|
||||
#
|
||||
# This file is part of OCRmyPDF.
|
||||
#
|
||||
# OCRmyPDF is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# OCRmyPDF is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with OCRmyPDF. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from __future__ import print_function, unicode_literals
|
||||
|
||||
@@ -13,6 +28,7 @@ from setuptools import setup, find_packages # nopep8
|
||||
from subprocess import STDOUT, check_output, CalledProcessError # nopep8
|
||||
from collections.abc import Mapping # nopep8
|
||||
import re # nopep8
|
||||
import os # nopep8
|
||||
|
||||
|
||||
missing_program = '''
|
||||
@@ -171,13 +187,15 @@ if not forced and command.startswith('install') or \
|
||||
)
|
||||
check_external_program(
|
||||
program='qpdf',
|
||||
need_version='5.1.1', # limited by Travis CI / Ubuntu 14.04 backports
|
||||
package='qpdf',
|
||||
version_check_args=['--version']
|
||||
need_version='8.0.2', # test suite known to fail on 5.1.1
|
||||
package='qpdf'
|
||||
)
|
||||
check_external_program(
|
||||
program='pngquant',
|
||||
need_version='2.0.0',
|
||||
package='pngquant',
|
||||
optional=True
|
||||
)
|
||||
else:
|
||||
print('Skipping external program tests because of --force')
|
||||
|
||||
|
||||
if 'upload' in sys.argv[1:]:
|
||||
print('Use twine to upload the package - setup.py upload is insecure')
|
||||
@@ -185,24 +203,32 @@ if 'upload' in sys.argv[1:]:
|
||||
|
||||
tests_require = open('test_requirements.txt').read().splitlines()
|
||||
|
||||
|
||||
def readme():
|
||||
with open('README.md') as f:
|
||||
return f.read()
|
||||
|
||||
setup(
|
||||
name='ocrmypdf',
|
||||
description='OCRmyPDF adds an OCR text layer to scanned PDF files, allowing them to be searched',
|
||||
long_description=readme(),
|
||||
long_description_content_type='text/markdown',
|
||||
url='https://github.com/jbarlow83/OCRmyPDF',
|
||||
author='James R. Barlow',
|
||||
author_email='jim@purplerock.ca',
|
||||
license='MIT',
|
||||
packages=find_packages(exclude=["tests", "tests.*"]),
|
||||
packages=find_packages('src', exclude=["tests", "tests.*"]),
|
||||
package_dir={'': 'src'},
|
||||
keywords=['PDF', 'OCR', 'optical character recognition', 'PDF/A', 'scanning'],
|
||||
classifiers=[
|
||||
"Programming Language :: Python :: 3.5",
|
||||
"Programming Language :: Python :: 3.6",
|
||||
"Programming Language :: Python :: 3.7",
|
||||
"Development Status :: 5 - Production/Stable",
|
||||
"Environment :: Console",
|
||||
"Intended Audience :: End Users/Desktop",
|
||||
"Intended Audience :: Science/Research",
|
||||
"Intended Audience :: System Administrators",
|
||||
"License :: OSI Approved :: MIT License",
|
||||
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
|
||||
"Operating System :: MacOS :: MacOS X",
|
||||
"Operating System :: POSIX",
|
||||
"Operating System :: POSIX :: BSD",
|
||||
@@ -211,22 +237,31 @@ setup(
|
||||
"Topic :: Text Processing :: Indexing",
|
||||
"Topic :: Text Processing :: Linguistic",
|
||||
],
|
||||
python_requires=' >= 3.5',
|
||||
setup_requires=[
|
||||
'cffi >= 1.9.1', # to build the leptonica module
|
||||
'pytest-runner', # to enable python setup.py test
|
||||
'setuptools_scm', # so that version will work
|
||||
'cffi>=1.9.1' # to build the leptonica module
|
||||
'setuptools_scm_git_archive' # enable version from github tarballs
|
||||
],
|
||||
use_scm_version={'version_scheme': 'post-release'},
|
||||
cffi_modules=[
|
||||
'ocrmypdf/lib/compile_leptonica.py:ffibuilder'
|
||||
'src/ocrmypdf/lib/compile_leptonica.py:ffibuilder'
|
||||
],
|
||||
install_requires=[
|
||||
'ruffus==2.6.3', # pinned - ocrmypdf implements a 2.6.3 workaround
|
||||
'Pillow>=4.0.0', # Pillow < 4 has BytesIO/TIFF bug w/img2pdf 0.2.3
|
||||
'reportlab>=3.3.0', # oldest released version with sane image handling
|
||||
'PyPDF2>=1.26', # pure Python, so track HEAD closely
|
||||
'img2pdf>=0.2.3', # pure Python, so track HEAD closely
|
||||
'cffi>=1.9.1' # must be a setup and install requirement
|
||||
'cffi >= 1.9.1', # must be a setup and install requirement
|
||||
'img2pdf >= 0.2.4, < 0.4', # pure Python, so track HEAD closely
|
||||
'pikepdf >= 0.3.3, < 0.4',
|
||||
'Pillow >= 4.0.0, != 5.1.0 ; sys_platform == "darwin"',
|
||||
# Pillow < 4 has BytesIO/TIFF bug w/img2pdf 0.2.3
|
||||
# block 5.1.0, broken wheels
|
||||
'python-xmp-toolkit >= 2, < 3',
|
||||
'reportlab >= 3.3.0', # oldest released version with sane image handling
|
||||
'ruffus >= 2.7.0',
|
||||
],
|
||||
extras_require={
|
||||
'fitz': [], # Backward compatibility
|
||||
},
|
||||
tests_require=tests_require,
|
||||
entry_points={
|
||||
'console_scripts': [
|
||||
@@ -235,4 +270,10 @@ setup(
|
||||
},
|
||||
package_data={'ocrmypdf': ['data/sRGB.icc']},
|
||||
include_package_data=True,
|
||||
zip_safe=False)
|
||||
zip_safe=False,
|
||||
project_urls={
|
||||
'Documentation': 'https://ocrmypdf.readthedocs.io/',
|
||||
'Source': 'https://github.com/jbarlow83/ocrmypdf',
|
||||
'Tracker': 'https://github.com/jbarlow83/ocrmypdf/issues'
|
||||
}
|
||||
)
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
# © 2017 James R. Barlow: github.com/jbarlow83
|
||||
#
|
||||
# This file is part of OCRmyPDF.
|
||||
#
|
||||
# OCRmyPDF is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# OCRmyPDF is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with OCRmyPDF. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import pkg_resources
|
||||
|
||||
PROGRAM_NAME = 'ocrmypdf'
|
||||
|
||||
# Official PEP 396
|
||||
__version__ = pkg_resources.get_distribution('ocrmypdf').version
|
||||
|
||||
VERSION = __version__
|
||||
|
||||
from .exceptions import (
|
||||
ExitCode, BadArgsError, PdfMergeFailedError, MissingDependencyError,
|
||||
UnsupportedImageFormatError, DpiError, OutputFileAccessError,
|
||||
PriorOcrFoundError, InputFileError, SubprocessOutputError,
|
||||
EncryptedPdfError, TesseractConfigError
|
||||
)
|
||||
|
||||
from . import helpers
|
||||
from . import hocrtransform
|
||||
from . import leptonica
|
||||
from . import pdfa
|
||||
from . import pdfinfo
|
||||
@@ -1,39 +1,49 @@
|
||||
#!/usr/bin/env python3
|
||||
# © 2015-17 James R. Barlow: github.com/jbarlow83
|
||||
#
|
||||
# This file is part of OCRmyPDF.
|
||||
#
|
||||
# OCRmyPDF is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# OCRmyPDF is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with OCRmyPDF. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from contextlib import suppress
|
||||
from tempfile import mkdtemp
|
||||
from collections.abc import Sequence
|
||||
from pathlib import Path
|
||||
import sys
|
||||
import os
|
||||
import re
|
||||
import shutil
|
||||
import warnings
|
||||
import multiprocessing
|
||||
import atexit
|
||||
import textwrap
|
||||
import img2pdf
|
||||
import logging
|
||||
import argparse
|
||||
|
||||
import PyPDF2 as pypdf
|
||||
from PIL import Image
|
||||
import PIL
|
||||
|
||||
import ruffus.ruffus_exceptions as ruffus_exceptions
|
||||
import ruffus.cmdline as cmdline
|
||||
import ruffus.proxy_logger as proxy_logger
|
||||
|
||||
from .pipeline import JobContext, JobContextManager, re_symlink, \
|
||||
cleanup_working_files, build_pipeline
|
||||
from ._jobcontext import JobContext, JobContextManager, cleanup_working_files
|
||||
from ._pipeline import build_pipeline
|
||||
from .pdfa import file_claims_pdfa
|
||||
from .helpers import is_iterable_notstr, re_symlink, is_file_writable
|
||||
from .exec import tesseract, qpdf
|
||||
from .helpers import re_symlink, is_file_writable, \
|
||||
available_cpu_count
|
||||
from .exec import tesseract, qpdf, ghostscript
|
||||
from . import PROGRAM_NAME, VERSION
|
||||
|
||||
from .exceptions import *
|
||||
from .exceptions import ExitCode, ExitCodeException, MissingDependencyError, \
|
||||
InputFileError, BadArgsError, OutputFileAccessError
|
||||
from . import exceptions as ocrmypdf_exceptions
|
||||
|
||||
warnings.simplefilter('ignore', pypdf.utils.PdfReadWarning)
|
||||
from ._unicodefun import verify_python3_env
|
||||
|
||||
|
||||
# -------------
|
||||
@@ -41,6 +51,9 @@ warnings.simplefilter('ignore', pypdf.utils.PdfReadWarning)
|
||||
|
||||
MINIMUM_TESS_VERSION = '3.04'
|
||||
|
||||
HOCR_OK_LANGS = frozenset([
|
||||
'eng', 'deu', 'spa', 'ita', 'por'
|
||||
])
|
||||
|
||||
def complain(message):
|
||||
print(*textwrap.wrap(message), file=sys.stderr)
|
||||
@@ -50,6 +63,11 @@ def complain(message):
|
||||
if 'IDE_PROJECT_ROOTS' in os.environ:
|
||||
os.environ['PATH'] = '/usr/local/bin:' + os.environ['PATH']
|
||||
|
||||
# --------
|
||||
# Critical environment tests
|
||||
|
||||
verify_python3_env()
|
||||
|
||||
if tesseract.version() < MINIMUM_TESS_VERSION:
|
||||
complain(
|
||||
"Please install tesseract {0} or newer "
|
||||
@@ -60,6 +78,21 @@ if tesseract.version() < MINIMUM_TESS_VERSION:
|
||||
# -------------
|
||||
# Parser
|
||||
|
||||
def numeric(basetype, min_=None, max_=None):
|
||||
"""Validator for numeric params"""
|
||||
min_ = basetype(min_) if min_ is not None else None
|
||||
max_ = basetype(max_) if max_ is not None else None
|
||||
def _numeric(string):
|
||||
value = basetype(string)
|
||||
if (min_ is not None and value < min_
|
||||
or max_ is not None and value > max_):
|
||||
msg = "%r not in valid range %r" % (string, (min_, max_))
|
||||
raise argparse.ArgumentTypeError(msg)
|
||||
return value
|
||||
_numeric.__name__ = basetype.__name__
|
||||
return _numeric
|
||||
|
||||
|
||||
parser = argparse.ArgumentParser(
|
||||
prog=PROGRAM_NAME,
|
||||
fromfile_prefix_chars='@',
|
||||
@@ -131,12 +164,16 @@ parser.add_argument(
|
||||
'--image-dpi', metavar='DPI', type=int,
|
||||
help="For input image instead of PDF, use this DPI instead of file's.")
|
||||
parser.add_argument(
|
||||
'--output-type', choices=['pdfa', 'pdf'], default='pdfa',
|
||||
'--output-type', choices=['pdfa', 'pdf', 'pdfa-1', 'pdfa-2', 'pdfa-3'],
|
||||
default='pdfa',
|
||||
help="Choose output type. 'pdfa' creates a PDF/A-2b compliant file for "
|
||||
"long term archiving (default, recommended) but may not suitable "
|
||||
"for users who want their file altered as little as possible. 'pdfa' "
|
||||
"also has problems with full Unicode text. 'pdf' attempts to "
|
||||
"preserve file contents as much as possible.")
|
||||
"preserve file contents as much as possible. 'pdf-a1' creates a "
|
||||
"PDF/A1-b file. 'pdf-a2' is equivalent to 'pdfa'. 'pdf-a3' creates a "
|
||||
"PDF/A3-b file."
|
||||
)
|
||||
|
||||
# Use null string '\0' as sentinel to indicate the user supplied no argument,
|
||||
# since that is the only invalid character for filepaths on all platforms
|
||||
@@ -157,7 +194,7 @@ parser.add_argument(
|
||||
jobcontrol = parser.add_argument_group(
|
||||
"Job control options")
|
||||
jobcontrol.add_argument(
|
||||
'-j', '--jobs', metavar='N', type=int,
|
||||
'-j', '--jobs', metavar='N', type=numeric(int, 0, 256),
|
||||
help="Use up to N CPU cores simultaneously (default: use all).")
|
||||
jobcontrol.add_argument(
|
||||
'-q', '--quiet', action='store_true', help="Suppress INFO messages")
|
||||
@@ -204,7 +241,7 @@ preprocessing.add_argument(
|
||||
help="Clean page as above, and incorporate the cleaned image in the final "
|
||||
"PDF. Might remove desired content.")
|
||||
preprocessing.add_argument(
|
||||
'--oversample', metavar='DPI', type=int, default=0,
|
||||
'--oversample', metavar='DPI', type=numeric(int, 0, 5000), default=0,
|
||||
help="Oversample images to at least the specified DPI, to improve OCR "
|
||||
"results slightly")
|
||||
|
||||
@@ -220,19 +257,65 @@ ocrsettings.add_argument(
|
||||
help="Skip OCR on any pages that already contain text, but include the "
|
||||
"page in final output; useful for PDFs that contain a mix of "
|
||||
"images, text pages, and/or previously OCRed pages")
|
||||
# ocrsettings.add_argument(
|
||||
# '--redo-ocr', action='store_true',
|
||||
# help="removing any existing OCR text, but otherwise preserve mixed PDF "
|
||||
# "pages")
|
||||
|
||||
ocrsettings.add_argument(
|
||||
'--skip-big', type=float, metavar='MPixels',
|
||||
'--skip-big', type=numeric(float, 0, 5000), metavar='MPixels',
|
||||
help="Skip OCR on pages larger than the specified amount of megapixels, "
|
||||
"but include skipped pages in final output")
|
||||
|
||||
optimizing = parser.add_argument_group(
|
||||
"Optimization options",
|
||||
"Control how the PDF is optimized after OCR"
|
||||
)
|
||||
optimizing.add_argument(
|
||||
'-O', '--optimize', type=int, choices=range(0, 4), default=1,
|
||||
help=("Control how PDF is optimized after processing:"
|
||||
"0 - do not optimize; "
|
||||
"1 - do safe, lossless optimizations (default); "
|
||||
"2 - do some lossy optimizations; "
|
||||
"3 - do aggressive lossy optimizations (including lossy JBIG2)"
|
||||
)
|
||||
)
|
||||
optimizing.add_argument(
|
||||
'--jpeg-quality', type=numeric(int, 0, 100), default=0, metavar='Q',
|
||||
help=("Adjust JPEG quality level for JPEG optimization. "
|
||||
"100 is best quality and largest output size; "
|
||||
"1 is lowest quality and smallest output; "
|
||||
"0 uses the default."
|
||||
)
|
||||
)
|
||||
optimizing.add_argument(
|
||||
'--jpg-quality', type=numeric(int, 0, 100), default=0, metavar='Q',
|
||||
dest='jpeg_quality',
|
||||
help=argparse.SUPPRESS # Alias for --jpeg-quality
|
||||
)
|
||||
optimizing.add_argument(
|
||||
'--png-quality', type=numeric(int, 0, 100), default=0, metavar='Q',
|
||||
help=("Adjust PNG quality level to use when quantizing PNGs. "
|
||||
"Values have same meaning as with --jpeg-quality"
|
||||
)
|
||||
)
|
||||
optimizing.add_argument(
|
||||
'--jbig2-lossy', action='store_true',
|
||||
help=("Enable JBIG2 lossy mode (better compression, not suitable for some "
|
||||
"use cases - see documentation)."
|
||||
)
|
||||
)
|
||||
optimizing.add_argument(
|
||||
'--jbig2-page-group-size', type=numeric(int, 1, 10000), default=0,
|
||||
metavar='N',
|
||||
# Adjust number of pages to consider at once for JBIG2 compression
|
||||
help=argparse.SUPPRESS
|
||||
)
|
||||
|
||||
advanced = parser.add_argument_group(
|
||||
"Advanced",
|
||||
"Advanced options to control Tesseract's OCR behavior")
|
||||
advanced.add_argument(
|
||||
'--max-image-mpixels', action='store', type=numeric(float, 0),
|
||||
metavar='MPixels',
|
||||
help="Set maximum number of pixels to unpack before treating an image as a "
|
||||
"decompression bomb",
|
||||
default=128.0)
|
||||
advanced.add_argument(
|
||||
'--tesseract-config', action='append', metavar='CFG', default=[],
|
||||
help="Additional Tesseract configuration files -- see documentation")
|
||||
@@ -251,23 +334,18 @@ advanced.add_argument(
|
||||
)
|
||||
advanced.add_argument(
|
||||
'--pdf-renderer',
|
||||
choices=['auto', 'tesseract', 'hocr', 'tess4', 'sandwich'], default='auto',
|
||||
choices=['auto', 'hocr', 'sandwich'], default='auto',
|
||||
help="Choose OCR PDF renderer - the default option is to let OCRmyPDF "
|
||||
"choose."
|
||||
"auto - let OCRmyPDF choose; "
|
||||
"sandwich - default renderer for Tesseract 3.05.01 and newer; "
|
||||
"hocr - default renderer for older versions of Tesseract; "
|
||||
"tesseract - gives better results for non-Latin languages and "
|
||||
"Tesseract older than 3.05.01 but has problems with some versions "
|
||||
" of Ghostscript; deprecated"
|
||||
"tess4 - deprecated alias for 'sandwich'"
|
||||
"choose. See documentation for discussion."
|
||||
)
|
||||
advanced.add_argument(
|
||||
'--tesseract-timeout', default=180.0, type=float, metavar='SECONDS',
|
||||
'--tesseract-timeout', default=180.0, type=numeric(float, 0),
|
||||
metavar='SECONDS',
|
||||
help='Give up on OCR after the timeout, but copy the preprocessed page '
|
||||
'into the final output')
|
||||
advanced.add_argument(
|
||||
'--rotate-pages-threshold', default=14.0, type=float, metavar='CONFIDENCE',
|
||||
'--rotate-pages-threshold', default=14.0, type=numeric(float, 0, 1000),
|
||||
metavar='CONFIDENCE',
|
||||
help="Only rotate pages when confidence is above this value (arbitrary "
|
||||
"units reported by tesseract)")
|
||||
advanced.add_argument(
|
||||
@@ -281,6 +359,15 @@ advanced.add_argument(
|
||||
"are applied to all pages, including those for which OCR was "
|
||||
"skipped. Not supported for --output-type=pdf ; that setting "
|
||||
"preserves the original compression of all images.")
|
||||
advanced.add_argument(
|
||||
'--user-words', metavar='FILE',
|
||||
help="Specify the location of the Tesseract user words file. This is a "
|
||||
"list of words Tesseract should consider while performing OCR in "
|
||||
"addition to its standard language dictionaries. This can improve "
|
||||
"OCR quality especially for specialized and technical documents.")
|
||||
advanced.add_argument(
|
||||
'--user-patterns', metavar='FILE',
|
||||
help="Specify the location of the Tesseract user patterns file.")
|
||||
|
||||
debugging = parser.add_argument_group(
|
||||
"Debugging",
|
||||
@@ -288,9 +375,6 @@ debugging = parser.add_argument_group(
|
||||
debugging.add_argument(
|
||||
'-k', '--keep-temporary-files', action='store_true',
|
||||
help="Keep temporary files (helpful for debugging)")
|
||||
debugging.add_argument(
|
||||
'-g', '--debug-rendering', action='store_true',
|
||||
help="Render each page twice with debug information on second page")
|
||||
debugging.add_argument(
|
||||
'--flowchart', type=str,
|
||||
help="Generate the pipeline execution flowchart")
|
||||
@@ -304,39 +388,77 @@ def check_options_languages(options, _log):
|
||||
if '+' in options.language[0]:
|
||||
options.language = options.language[0].split('+')
|
||||
|
||||
if not set(options.language).issubset(tesseract.languages()):
|
||||
languages = set(options.language)
|
||||
if not languages.issubset(tesseract.languages()):
|
||||
msg = (
|
||||
"The installed version of tesseract does not have language "
|
||||
"data for the following requested languages: \n")
|
||||
for lang in (set(options.language) - tesseract.languages()):
|
||||
for lang in (languages - tesseract.languages()):
|
||||
msg += lang + '\n'
|
||||
raise argparse.ArgumentError(None, msg)
|
||||
raise MissingDependencyError(msg)
|
||||
|
||||
|
||||
def check_options_output(options, log):
|
||||
# We have these constraints to check for.
|
||||
# 1. Ghostscript < 9.20 mangles multibyte Unicode
|
||||
# 2. Tesseract < 3.05 embeds an older version of GlyphlessFont with which
|
||||
# no version of Ghostscript handles correctly.
|
||||
# 3. hocr doesn't work on non-Latin languages (so don't select it)
|
||||
|
||||
languages = set(options.language)
|
||||
is_latin = languages.issubset(HOCR_OK_LANGS)
|
||||
|
||||
if options.pdf_renderer == 'hocr' and not is_latin:
|
||||
msg = (
|
||||
"The 'hocr' PDF renderer is known to cause problems with one "
|
||||
"or more of the languages in your document. Use "
|
||||
"--pdf-renderer auto (the default) to avoid this issue.")
|
||||
log.warning(msg)
|
||||
|
||||
if ghostscript.version() < '9.20' \
|
||||
and options.output_type != 'pdf' \
|
||||
and not is_latin:
|
||||
# https://bugs.ghostscript.com/show_bug.cgi?id=696874
|
||||
# Ghostscript < 9.20 fails to encode multibyte characters properly
|
||||
msg = (
|
||||
"The installed version of Ghostscript does not work correctly "
|
||||
"with the OCR languages you specified. Use --output-type pdf or "
|
||||
"upgrade to Ghostscript 9.20 or later to avoid this issue.")
|
||||
msg += "Found Ghostscript {}".format(ghostscript.version())
|
||||
log.warning(msg)
|
||||
|
||||
# Decide on what renderer to use
|
||||
if options.pdf_renderer == 'auto':
|
||||
if tesseract.has_textonly_pdf():
|
||||
options.pdf_renderer = 'sandwich'
|
||||
else:
|
||||
if tesseract.version() < '3.05' \
|
||||
and options.output_type.startswith('pdfa') \
|
||||
and is_latin:
|
||||
options.pdf_renderer = 'hocr'
|
||||
else:
|
||||
options.pdf_renderer = 'sandwich'
|
||||
|
||||
if options.pdf_renderer == 'tess4':
|
||||
log.warning("The 'tess4' PDF renderer has been renamed to 'sandwich'. "
|
||||
"Please use --pdf-renderer=sandwich.")
|
||||
options.pdf_renderer = 'sandwich'
|
||||
if options.pdf_renderer == 'sandwich' \
|
||||
and tesseract.version() < '3.05':
|
||||
msg = (
|
||||
"Ghostscript will corrupt the OCR text of PDFs produced by "
|
||||
"Tesseract 3.04.xx and older. For best results, upgrade to a "
|
||||
"newer release of Tesseract. "
|
||||
)
|
||||
|
||||
if options.pdf_renderer == 'tesseract':
|
||||
log.warning("The 'tesseract' PDF renderer is deprecated.")
|
||||
if tesseract.version() < '3.05' and options.output_type == 'pdfa':
|
||||
log.warning(
|
||||
"For best results use --pdf-renderer=tesseract "
|
||||
"--output-type=pdf to disable PDF/A generation via "
|
||||
"Ghostscript, which is known to corrupt the OCR text of "
|
||||
"some PDFs produced your version of Tesseract.")
|
||||
if options.output_type.startswith('pdfa'):
|
||||
msg += (
|
||||
"The argument --output-type=pdfa* requires Ghostscript, so "
|
||||
"the PDF will be invalid. If you cannot upgrade Tesseract, "
|
||||
"use --output-type=pdf.")
|
||||
raise MissingDependencyError(msg)
|
||||
log.warning(msg)
|
||||
|
||||
if options.debug_rendering and options.pdf_renderer != 'hocr':
|
||||
log.info(
|
||||
"Ignoring --debug-rendering because it requires --pdf-renderer=hocr")
|
||||
if options.output_type == 'pdfa':
|
||||
options.output_type = 'pdfa-2'
|
||||
|
||||
if options.output_type == 'pdfa-3' and ghostscript.version() < '9.19':
|
||||
raise MissingDependencyError(
|
||||
"--output-type pdfa-3 requires Ghostscript 9.19 or later"
|
||||
)
|
||||
|
||||
lossless_reconstruction = False
|
||||
if options.pdf_renderer in ('hocr', 'sandwich'):
|
||||
@@ -356,68 +478,93 @@ def check_options_sidecar(options, log):
|
||||
options.sidecar = options.output_file + '.txt'
|
||||
|
||||
|
||||
def _optional_program_required(name, version_fn, min_version, for_argument):
|
||||
try:
|
||||
if version_fn() < min_version:
|
||||
raise MissingDependencyError(
|
||||
"The installed '{}' is not supported. "
|
||||
"Install version {} or newer.".format(name, min_version))
|
||||
except (FileNotFoundError, MissingDependencyError):
|
||||
raise MissingDependencyError(
|
||||
"Install the '{}' program to use {}.".format(name, for_argument))
|
||||
|
||||
|
||||
def _optional_program_recommended(name, version_fn, min_version, for_argument):
|
||||
try:
|
||||
if version_fn() < min_version:
|
||||
raise MissingDependencyError(
|
||||
"The installed '{}' is not supported. "
|
||||
"Install version {} or newer.".format(name, min_version))
|
||||
except (FileNotFoundError, MissingDependencyError):
|
||||
complain(
|
||||
"For best results, install the optional program '{}' to use the "
|
||||
"argument {}.".format(name, for_argument)
|
||||
)
|
||||
|
||||
|
||||
def check_options_preprocessing(options, log):
|
||||
if any((options.clean, options.clean_final)):
|
||||
from .exec import unpaper
|
||||
try:
|
||||
if unpaper.version() < '6.1':
|
||||
raise MissingDependencyError(
|
||||
"The installed 'unpaper' is not supported. "
|
||||
"Install version 6.1 or newer.")
|
||||
except FileNotFoundError:
|
||||
raise MissingDependencyError(
|
||||
"Install the 'unpaper' program to use --clean, --clean-final.")
|
||||
|
||||
if options.clean and \
|
||||
not options.clean_final and \
|
||||
options.pdf_renderer == 'tesseract':
|
||||
log.info(
|
||||
"Tesseract PDF renderer cannot render --clean pages without "
|
||||
"also performing --clean-final, so --clean-final is assumed.")
|
||||
_optional_program_required(
|
||||
'unpaper', unpaper.version, '6.1', '--clean, --clean-final'
|
||||
)
|
||||
|
||||
|
||||
def check_options_ocr_behavior(options, log):
|
||||
if options.force_ocr and options.skip_text:
|
||||
raise argparse.ArgumentError(
|
||||
None,
|
||||
"Error: --force-ocr and --skip-text are mutually incompatible.")
|
||||
"Error: --force-ocr and --skip-text are mutually exclusive.")
|
||||
|
||||
# if options.redo_ocr and (options.skip_text or options.force_ocr):
|
||||
# raise argparse.ArgumentError(
|
||||
# "Error: --redo-ocr and other OCR options are incompatible.")
|
||||
|
||||
if set(options.language) & {'chi_sim', 'chi_tra'} and \
|
||||
(options.pdf_renderer == 'hocr' or options.output_type == 'pdfa'):
|
||||
def check_options_optimizing(options, log):
|
||||
if options.optimize >= 2:
|
||||
from .exec import pngquant, jbig2enc
|
||||
_optional_program_required(
|
||||
'pngquant', pngquant.version, '2.0.1', '--optimize {2,3}'
|
||||
)
|
||||
|
||||
if options.jbig2_lossy:
|
||||
_optional_program_required(
|
||||
'jbig2', jbig2enc.version, '0.28', '--jbig2-lossy'
|
||||
)
|
||||
elif options.optimize >= 2:
|
||||
# Although we use JBIG2 for optimize=1, don't nag about it unless the
|
||||
# user is asking for more optimization
|
||||
_optional_program_recommended(
|
||||
'jbig2', jbig2enc.version, '0.28', '--optimize {2,3}'
|
||||
)
|
||||
|
||||
if options.optimize == 0 and any([
|
||||
options.jbig2_lossy, options.png_quality, options.jpeg_quality
|
||||
]):
|
||||
log.warning(
|
||||
"Your settings are known to cause problems with OCR of Chinese text. "
|
||||
"Try adding these arguments: "
|
||||
" ocrmypdf --pdf-renderer tesseract --output-type pdf")
|
||||
"The arguments --jbig2-lossy, --png-quality, and --jpeg-quality "
|
||||
"will be ignored because --optimize=0."
|
||||
)
|
||||
|
||||
|
||||
def check_options_advanced(options, log):
|
||||
if tesseract.v4():
|
||||
log.info(
|
||||
"Tesseract v4.x.alpha found. OCRmyPDF support is experimental.")
|
||||
if options.tesseract_oem and not tesseract.v4():
|
||||
log.warning(
|
||||
"--tesseract-oem requires Tesseract 4.x -- argument ignored")
|
||||
if options.pdf_renderer == 'tess4' and not tesseract.has_textonly_pdf():
|
||||
raise MissingDependencyError(
|
||||
"--pdf-renderer tess4 requires Tesseract 4.x "
|
||||
"commit 3d9fb3b or later")
|
||||
if options.pdfa_image_compression != 'auto' and \
|
||||
options.output_type != 'pdfa':
|
||||
options.output_type.startswith('pdfa'):
|
||||
log.warning(
|
||||
"--pdfa-image-compression argument has no effect when "
|
||||
"--output-type is not 'pdfa'"
|
||||
"--output-type is not 'pdfa', 'pdfa-1', or 'pdfa-2'"
|
||||
)
|
||||
|
||||
if tesseract.v4() and (options.user_words or options.user_patterns):
|
||||
log.warning(
|
||||
'Tesseract 4.x ignores --user-words, so this has no effect')
|
||||
|
||||
|
||||
def check_options_metadata(options, log):
|
||||
import unicodedata
|
||||
metadata = [options.title, options.author, options.keywords,
|
||||
options.subject]
|
||||
for s in (m for m in metadata if m):
|
||||
docinfo = [options.title, options.author, options.keywords,
|
||||
options.subject]
|
||||
for s in (m for m in docinfo if m):
|
||||
for c in s:
|
||||
if unicodedata.category(c) == 'Co' or ord(c) >= 0x10000:
|
||||
raise ValueError(
|
||||
@@ -427,6 +574,12 @@ def check_options_metadata(options, log):
|
||||
))
|
||||
|
||||
|
||||
def check_options_pillow(options, log):
|
||||
PIL.Image.MAX_IMAGE_PIXELS = int(options.max_image_mpixels * 1000000)
|
||||
if PIL.Image.MAX_IMAGE_PIXELS == 0:
|
||||
PIL.Image.MAX_IMAGE_PIXELS = None
|
||||
|
||||
|
||||
def check_options(options, log):
|
||||
try:
|
||||
check_options_languages(options, log)
|
||||
@@ -435,7 +588,9 @@ def check_options(options, log):
|
||||
check_options_sidecar(options, log)
|
||||
check_options_preprocessing(options, log)
|
||||
check_options_ocr_behavior(options, log)
|
||||
check_options_optimizing(options, log)
|
||||
check_options_advanced(options, log)
|
||||
check_options_pillow(options, log)
|
||||
except ValueError as e:
|
||||
log.error(e)
|
||||
sys.exit(ExitCode.bad_args)
|
||||
@@ -471,24 +626,6 @@ def logging_factory(logger_name, logger_args):
|
||||
return root_logger
|
||||
|
||||
|
||||
def available_cpu_count():
|
||||
try:
|
||||
return multiprocessing.cpu_count()
|
||||
except NotImplementedError:
|
||||
pass
|
||||
|
||||
try:
|
||||
import psutil
|
||||
return psutil.cpu_count()
|
||||
except (ImportError, AttributeError):
|
||||
pass
|
||||
|
||||
complain(
|
||||
"Could not get CPU count. Assuming one (1) CPU."
|
||||
"Use -j N to set manually.")
|
||||
return 1
|
||||
|
||||
|
||||
def cleanup_ruffus_error_message(msg):
|
||||
msg = re.sub(r'\s+', r' ', msg)
|
||||
msg = re.sub(r"\((.+?)\)", r'\1', msg)
|
||||
@@ -499,77 +636,86 @@ def cleanup_ruffus_error_message(msg):
|
||||
def do_ruffus_exception(ruffus_five_tuple, options, log):
|
||||
"""Replace the elaborate ruffus stack trace with a user friendly
|
||||
description of the error message that occurred."""
|
||||
exit_code = None
|
||||
|
||||
task_name, job_name, exc_name, exc_value, exc_stack = ruffus_five_tuple
|
||||
if exc_name == 'builtins.SystemExit':
|
||||
_task_name, _job_name, exc_name, exc_value, exc_stack = ruffus_five_tuple
|
||||
|
||||
if isinstance(exc_name, type):
|
||||
# ruffus is full of mystery... sometimes (probably when the process
|
||||
# group leader is killed) exc_name is the class object of the exception,
|
||||
# rather than a str. So reach into the object and get its name.
|
||||
exc_name = exc_name.__name__
|
||||
|
||||
if exc_name.startswith('ocrmypdf.exceptions.'):
|
||||
base_exc_name = exc_name.replace('ocrmypdf.exceptions.', '')
|
||||
exc_class = getattr(ocrmypdf_exceptions, base_exc_name)
|
||||
exit_code = getattr(exc_class, 'exit_code', ExitCode.other_error)
|
||||
try:
|
||||
if isinstance(exc_value, exc_class):
|
||||
exc_msg = str(exc_value)
|
||||
else:
|
||||
exc_msg = str(exc_class())
|
||||
except Exception:
|
||||
exc_msg = "Unknown"
|
||||
|
||||
if exc_name in ('builtins.SystemExit', 'SystemExit'):
|
||||
match = re.search(r"\.(.+?)\)", exc_value)
|
||||
exit_code_name = match.groups()[0]
|
||||
exit_code = getattr(ExitCode, exit_code_name, 'other_error')
|
||||
return exit_code
|
||||
elif exc_name == 'ruffus.ruffus_exceptions.MissingInputFileError':
|
||||
log.error(cleanup_ruffus_error_message(exc_value))
|
||||
return ExitCode.input_file
|
||||
elif exc_name == 'builtins.TypeError':
|
||||
# Even though repair_pdf will fail, ruffus will still try
|
||||
# to call split_pages with no input files, likely due to a bug
|
||||
if task_name == 'split_pages':
|
||||
log.error("Input file '{0}' is not a valid PDF".format(
|
||||
options.input_file))
|
||||
return ExitCode.input_file
|
||||
elif exc_name == 'builtins.KeyboardInterrupt':
|
||||
log.error("Interrupted by user")
|
||||
return ExitCode.ctrl_c
|
||||
exit_code = ExitCode.input_file
|
||||
elif exc_name in ('builtins.KeyboardInterrupt', 'KeyboardInterrupt'):
|
||||
# We have to print in this case because the log daemon might be toast
|
||||
print("Interrupted by user", file=sys.stderr)
|
||||
exit_code = ExitCode.ctrl_c
|
||||
elif exc_name == 'subprocess.CalledProcessError':
|
||||
# It's up to the subprocess handler to report something useful
|
||||
msg = "Error occurred while running this command:"
|
||||
log.error(msg + '\n' + exc_value)
|
||||
return ExitCode.child_process_error
|
||||
elif exc_name == 'ocrmypdf.exceptions.PdfMergeFailedError':
|
||||
log.error(textwrap.dedent("""\
|
||||
Failed to merge PDF image layer with OCR layer
|
||||
|
||||
Usually this happens because the input PDF file is mal-formed and
|
||||
ocrmypdf cannot automatically correct the problem on its own.
|
||||
|
||||
Try using
|
||||
ocrmypdf --pdf-renderer tesseract [..other args..]
|
||||
"""))
|
||||
return ExitCode.input_file
|
||||
exit_code = ExitCode.child_process_error
|
||||
elif exc_name.startswith('ocrmypdf.exceptions.'):
|
||||
base_exc_name = exc_name.replace('ocrmypdf.exceptions.', '')
|
||||
exc_class = getattr(ocrmypdf_exceptions, base_exc_name)
|
||||
return exc_class.exit_code
|
||||
elif exc_name == 'PyPDF2.utils.PdfReadError' and \
|
||||
'not been decrypted' in exc_value:
|
||||
log.error(textwrap.dedent("""\
|
||||
Input PDF uses either an encryption algorithm or a PDF security
|
||||
handler that is not supported by ocrmypdf.
|
||||
if exc_msg:
|
||||
log.error(exc_msg)
|
||||
elif exc_name == 'PIL.Image.DecompressionBombError':
|
||||
msg = cleanup_ruffus_error_message(exc_value)
|
||||
msg += ("\nUse the --max-image-mpixels argument to set increase the "
|
||||
"maximum number of megapixels to accept.")
|
||||
log.error(msg)
|
||||
exit_code = ExitCode.input_file
|
||||
|
||||
For information about this PDF's security use
|
||||
qpdf --show-encryption [...input PDF...]
|
||||
|
||||
(Only algorithms "R = 1" and "R = 2" are supported.)
|
||||
|
||||
"""))
|
||||
return ExitCode.encrypted_pdf
|
||||
if exit_code is not None:
|
||||
return exit_code
|
||||
|
||||
if not options.verbose:
|
||||
log.error(exc_stack)
|
||||
return ExitCode.other_error
|
||||
|
||||
|
||||
def traverse_ruffus_exception(e_args, options, log):
|
||||
"""Walk through a RethrownJobError and find the first exception.
|
||||
def traverse_ruffus_exception(exceptions, options, log):
|
||||
"""Traverse a RethrownJobError and output the exceptions
|
||||
|
||||
Ruffus presents exceptions as 5 element tuples. The RethrownJobException
|
||||
has a list of exceptions like
|
||||
e.job_exceptions = [(5-tuple), (5-tuple), ...]
|
||||
|
||||
ruffus < 2.7.0 had a bug with exception marshalling that would give
|
||||
different output whether the main or child process raised the exception.
|
||||
We no longer support this.
|
||||
|
||||
Attempting to log the exception itself will re-marshall it to the logger
|
||||
which is normally running in another process. It's better to avoid re-
|
||||
marshalling.
|
||||
|
||||
The exit code will be based on this, even if multiple exceptions occurred
|
||||
at the same time."""
|
||||
|
||||
if isinstance(e_args, Sequence) and isinstance(e_args[0], str) and \
|
||||
len(e_args) == 5:
|
||||
return do_ruffus_exception(e_args, options, log)
|
||||
elif is_iterable_notstr(e_args):
|
||||
for exc in e_args:
|
||||
return traverse_ruffus_exception(exc, options, log)
|
||||
exit_codes = []
|
||||
for exc in exceptions:
|
||||
exit_code = do_ruffus_exception(exc, options, log)
|
||||
exit_codes.append(exit_code)
|
||||
|
||||
return exit_codes[0] # Multiple codes are rare so take the first one
|
||||
|
||||
|
||||
def check_closed_streams(options):
|
||||
@@ -592,6 +738,9 @@ def check_closed_streams(options):
|
||||
|
||||
"""
|
||||
|
||||
if sys.version_info[0:3] >= (3, 6, 4):
|
||||
return True # Issued fixed in Python 3.6.4+
|
||||
|
||||
if sys.stderr is None:
|
||||
sys.stderr = open(os.devnull, 'w')
|
||||
|
||||
@@ -617,9 +766,114 @@ def check_closed_streams(options):
|
||||
return True
|
||||
|
||||
|
||||
def run_pipeline():
|
||||
options = parser.parse_args()
|
||||
def log_page_orientations(pdfinfo, _log):
|
||||
direction = {0: 'n', 90: 'e',
|
||||
180: 's', 270: 'w'}
|
||||
orientations = []
|
||||
for n, page in enumerate(pdfinfo):
|
||||
angle = page.rotation or 0
|
||||
if angle != 0:
|
||||
orientations.append('{0}{1}'.format(
|
||||
n + 1,
|
||||
direction.get(angle, '')))
|
||||
if orientations:
|
||||
_log.info('Page orientations detected: ' + ' '.join(orientations))
|
||||
|
||||
|
||||
def preamble(_log):
|
||||
_log.debug('ocrmypdf ' + VERSION)
|
||||
_log.debug('tesseract ' + tesseract.version())
|
||||
_log.debug('qpdf ' + qpdf.version())
|
||||
_log.debug('gs ' + ghostscript.version())
|
||||
|
||||
|
||||
def check_environ(options, _log):
|
||||
old_envvars = (
|
||||
'OCRMYPDF_TESSERACT',
|
||||
'OCRMYPDF_QPDF',
|
||||
'OCRMYPDF_GS',
|
||||
'OCRMYPDF_UNPAPER')
|
||||
for k in old_envvars:
|
||||
if k in os.environ:
|
||||
_log.warning(textwrap.dedent("""\
|
||||
OCRmyPDF no longer uses the environment variable {}.
|
||||
Change PATH to select alternate programs.""".format(k)))
|
||||
|
||||
|
||||
def check_input_file(options, _log, start_input_file):
|
||||
if options.input_file == '-':
|
||||
# stdin
|
||||
_log.info('reading file from standard input')
|
||||
with open(start_input_file, 'wb') as stream_buffer:
|
||||
from shutil import copyfileobj
|
||||
copyfileobj(sys.stdin.buffer, stream_buffer)
|
||||
else:
|
||||
try:
|
||||
re_symlink(options.input_file, start_input_file, _log)
|
||||
except FileNotFoundError:
|
||||
_log.error("File not found - " + options.input_file)
|
||||
raise InputFileError()
|
||||
|
||||
|
||||
def check_requested_output_file(options, _log):
|
||||
if options.output_file == '-':
|
||||
if sys.stdout.isatty():
|
||||
_log.error(textwrap.dedent("""\
|
||||
Output was set to stdout '-' but it looks like stdout
|
||||
is connected to a terminal. Please redirect stdout to a
|
||||
file."""))
|
||||
raise BadArgsError()
|
||||
elif not is_file_writable(options.output_file):
|
||||
_log.error(
|
||||
"Output file location (" + options.output_file + ") " +
|
||||
"is not a writable file.")
|
||||
raise OutputFileAccessError()
|
||||
|
||||
|
||||
def report_output_file_size(options, _log, input_file, output_file):
|
||||
try:
|
||||
output_size = Path(output_file).stat().st_size
|
||||
input_size = Path(input_file).stat().st_size
|
||||
except FileNotFoundError:
|
||||
return # Outputting to stream or something
|
||||
ratio = output_size / input_size
|
||||
if ratio < 1.35 or input_size < 25000:
|
||||
return # Seems fine
|
||||
|
||||
reasons = []
|
||||
image_preproc = {
|
||||
'deskew',
|
||||
'clean_final',
|
||||
'remove_background',
|
||||
'oversample',
|
||||
'force_ocr'
|
||||
}
|
||||
for arg in image_preproc:
|
||||
attr = getattr(options, arg, None)
|
||||
if not attr:
|
||||
continue
|
||||
reasons.append(
|
||||
"The argument --{} was issued, causing transcoding.".format(
|
||||
arg.replace('_', '-')))
|
||||
|
||||
if reasons:
|
||||
explanation = (
|
||||
"Possible reasons for this include:\n" + '\n'.join(reasons) + "\n")
|
||||
else:
|
||||
explanation = (
|
||||
"No reason for this increase is known. Please report this issue.")
|
||||
|
||||
_log.warning(textwrap.dedent("""\
|
||||
The output file size is {:.2f}× larger than the input file.
|
||||
{}
|
||||
""".format(ratio, explanation)))
|
||||
|
||||
|
||||
def run_pipeline(args=None):
|
||||
options = parser.parse_args(args=args)
|
||||
options.verbose_abbreviated_path = 1
|
||||
if os.environ.get('_OCRMYPDF_THREADS'):
|
||||
options.use_threads = True
|
||||
|
||||
if not check_closed_streams(options):
|
||||
return ExitCode.bad_args
|
||||
@@ -628,16 +882,42 @@ def run_pipeline():
|
||||
|
||||
_log, _log_mutex = proxy_logger.make_shared_logger_and_proxy(
|
||||
logging_factory, __name__, logger_args)
|
||||
_log.debug('ocrmypdf ' + VERSION)
|
||||
_log.debug('tesseract ' + tesseract.version())
|
||||
|
||||
preamble(_log)
|
||||
check_options(options, _log)
|
||||
|
||||
# Complain about qpdf version < 7.0.0
|
||||
# Suppress the warning if in the test suite, since there are no PPAs
|
||||
# for qpdf 7.0.0 for Ubuntu trusty (i.e. Travis)
|
||||
if qpdf.version() < '7.0.0' and not os.environ.get('PYTEST_CURRENT_TEST'):
|
||||
complain(
|
||||
"You are using qpdf version {0} which has known issues including "
|
||||
"security vulnerabilities with certain malformed PDFs. Consider "
|
||||
"upgrading to version 7.0.0 or newer.".format(qpdf.version()))
|
||||
|
||||
if ghostscript.version() == '9.24':
|
||||
complain(
|
||||
"Ghostscript 9.24 contains serious regressions and is not "
|
||||
"supported. Please upgrade to Ghostscript 9.25 or use an older "
|
||||
"version."
|
||||
)
|
||||
return ExitCode.missing_dependency
|
||||
|
||||
# Any changes to options will not take effect for options that are already
|
||||
# bound to function parameters in the pipeline. (For example
|
||||
# options.input_file, options.pdf_renderer are already bound.)
|
||||
if not options.jobs:
|
||||
options.jobs = available_cpu_count()
|
||||
|
||||
# Performance is improved by setting Tesseract to single threaded. In tests
|
||||
# this gives better throughput than letting a smaller number of Tesseract
|
||||
# jobs run multithreaded. Same story for pngquant. Tess <4 ignores this
|
||||
# variable, but harmless to set if ignored.
|
||||
os.environ.setdefault('OMP_THREAD_LIMIT', '1')
|
||||
|
||||
check_environ(options, _log)
|
||||
if os.environ.get('PYTEST_CURRENT_TEST'):
|
||||
os.environ['_OCRMYPDF_TEST_INFILE'] = options.input_file
|
||||
|
||||
try:
|
||||
work_folder = mkdtemp(prefix="com.github.ocrmypdf.")
|
||||
options.history_file = os.path.join(
|
||||
@@ -645,36 +925,14 @@ def run_pipeline():
|
||||
start_input_file = os.path.join(
|
||||
work_folder, 'origin')
|
||||
|
||||
if options.input_file == '-':
|
||||
# stdin
|
||||
_log.info('reading file from standard input')
|
||||
with open(start_input_file, 'wb') as stream_buffer:
|
||||
from shutil import copyfileobj
|
||||
copyfileobj(sys.stdin.buffer, stream_buffer)
|
||||
else:
|
||||
try:
|
||||
re_symlink(options.input_file, start_input_file, _log)
|
||||
except FileNotFoundError:
|
||||
_log.error("File not found - " + options.input_file)
|
||||
return ExitCode.input_file
|
||||
|
||||
if options.output_file == '-':
|
||||
if sys.stdout.isatty():
|
||||
_log.error(textwrap.dedent("""\
|
||||
Output was set to stdout '-' but it looks like stdout
|
||||
is connected to a terminal. Please redirect stdout to a
|
||||
file."""))
|
||||
return ExitCode.bad_args
|
||||
elif not is_file_writable(options.output_file):
|
||||
_log.error(textwrap.dedent("""\
|
||||
Output file location is not writable."""))
|
||||
return ExitCode.file_access_error
|
||||
check_input_file(options, _log, start_input_file)
|
||||
check_requested_output_file(options, _log)
|
||||
|
||||
manager = JobContextManager()
|
||||
manager.register('JobContext', JobContext)
|
||||
manager.register('JobContext', JobContext) # pylint: disable=no-member
|
||||
manager.start()
|
||||
|
||||
context = manager.JobContext()
|
||||
context = manager.JobContext() # pylint: disable=no-member
|
||||
context.set_options(options)
|
||||
context.set_work_folder(work_folder)
|
||||
|
||||
@@ -684,39 +942,28 @@ def run_pipeline():
|
||||
except ruffus_exceptions.RethrownJobError as e:
|
||||
if options.verbose:
|
||||
_log.debug(str(e)) # stringify exception so logger doesn't have to
|
||||
|
||||
# Ruffus flattens exception to 5 element tuples. Because of a bug
|
||||
# in <= 2.6.3 it may present either the single:
|
||||
# (task, job, exc, value, stack)
|
||||
# or something like:
|
||||
# [[(task, job, exc, value, stack)]]
|
||||
#
|
||||
# Generally cross-process exception marshalling doesn't work well
|
||||
# and ruffus doesn't support because BaseException has its own
|
||||
# implementation of __reduce__ that attempts to reconstruct the
|
||||
# exception based on e.__init__(e.args).
|
||||
#
|
||||
# Attempting to log the exception directly marshalls it to the logger
|
||||
# which is probably in another process, so it's better to log only
|
||||
# data from the exception at this point.
|
||||
|
||||
exitcode = traverse_ruffus_exception(e.args, options, _log)
|
||||
exceptions = e.job_exceptions
|
||||
exitcode = traverse_ruffus_exception(exceptions, options, _log)
|
||||
if exitcode is None:
|
||||
_log.error("Unexpected ruffus exception: " + str(e))
|
||||
_log.error(repr(e))
|
||||
return ExitCode.other_error
|
||||
else:
|
||||
return exitcode
|
||||
return exitcode
|
||||
except ExitCodeException as e:
|
||||
return e.exit_code
|
||||
except Exception as e:
|
||||
_log.error(e)
|
||||
_log.error(str(e))
|
||||
return ExitCode.other_error
|
||||
|
||||
if options.flowchart:
|
||||
_log.info("Flowchart saved to {}".format(options.flowchart))
|
||||
elif options.output_file != '-':
|
||||
if options.output_type == 'pdfa':
|
||||
return ExitCode.ok
|
||||
elif options.output_file == '-':
|
||||
_log.info("Output sent to stdout")
|
||||
elif os.path.samefile(options.output_file, os.devnull):
|
||||
pass # Say nothing when sending to dev null
|
||||
else:
|
||||
if options.output_type.startswith('pdfa'):
|
||||
pdfa_info = file_claims_pdfa(options.output_file)
|
||||
if pdfa_info['pass']:
|
||||
msg = 'Output file is a {} (as expected)'
|
||||
@@ -724,29 +971,20 @@ def run_pipeline():
|
||||
else:
|
||||
msg = 'Output file is okay but is not PDF/A (seems to be {})'
|
||||
_log.warning(msg.format(pdfa_info['conformance']))
|
||||
|
||||
return ExitCode.invalid_output_pdf
|
||||
return ExitCode.pdfa_conversion_failed
|
||||
if not qpdf.check(options.output_file, _log):
|
||||
_log.warning('Output file: The generated PDF is INVALID')
|
||||
return ExitCode.invalid_output_pdf
|
||||
else:
|
||||
_log.info("Output sent to stdout")
|
||||
|
||||
report_output_file_size(options, _log, start_input_file,
|
||||
options.output_file)
|
||||
|
||||
pdfinfo = context.get_pdfinfo()
|
||||
if options.verbose:
|
||||
from pprint import pformat
|
||||
_log.debug(pformat(pdfinfo))
|
||||
direction = {0: 'n', 90: 'e',
|
||||
180: 's', 270: 'w'}
|
||||
orientations = []
|
||||
for n, page in enumerate(pdfinfo):
|
||||
angle = pdfinfo[n].rotation or 0
|
||||
if angle != 0:
|
||||
orientations.append('{0}{1}'.format(
|
||||
n + 1,
|
||||
direction.get(angle, '')))
|
||||
if orientations:
|
||||
_log.info('Page orientations detected: ' + ' '.join(orientations))
|
||||
|
||||
log_page_orientations(pdfinfo, _log)
|
||||
|
||||
return ExitCode.ok
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
# © 2018 James R. Barlow: github.com/jbarlow83
|
||||
#
|
||||
# This file is part of OCRmyPDF.
|
||||
#
|
||||
# OCRmyPDF is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# OCRmyPDF is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with OCRmyPDF. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from contextlib import suppress
|
||||
from multiprocessing.managers import SyncManager
|
||||
import sys
|
||||
import shutil
|
||||
|
||||
from .pdfinfo import PdfInfo
|
||||
|
||||
|
||||
class JobContext:
|
||||
"""Holds our context for a particular run of the pipeline
|
||||
|
||||
A multiprocessing manager effectively creates a separate process
|
||||
that keeps the master job context object. Other threads access
|
||||
job context via multiprocessing proxy objects.
|
||||
|
||||
While this would naturally lend itself @property's it seems to make
|
||||
a little more sense to use functions to make it explicitly that the
|
||||
invocation requires marshalling data across a process boundary.
|
||||
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
self.pdfinfo = None
|
||||
self.options = None
|
||||
self.work_folder = None
|
||||
self.rotations = {}
|
||||
|
||||
def generate_pdfinfo(self, infile):
|
||||
self.pdfinfo = PdfInfo(infile)
|
||||
|
||||
def get_pdfinfo(self):
|
||||
"What we know about the input PDF"
|
||||
return self.pdfinfo
|
||||
|
||||
def set_pdfinfo(self, pdfinfo):
|
||||
self.pdfinfo = pdfinfo
|
||||
|
||||
def get_options(self):
|
||||
return self.options
|
||||
|
||||
def set_options(self, options):
|
||||
self.options = options
|
||||
|
||||
def get_work_folder(self):
|
||||
return self.work_folder
|
||||
|
||||
def set_work_folder(self, work_folder):
|
||||
self.work_folder = work_folder
|
||||
|
||||
def get_rotation(self, pageno):
|
||||
return self.rotations.get(pageno, 0)
|
||||
|
||||
def set_rotation(self, pageno, value):
|
||||
self.rotations[pageno] = value
|
||||
|
||||
|
||||
class JobContextManager(SyncManager):
|
||||
pass
|
||||
|
||||
|
||||
def cleanup_working_files(work_folder, options):
|
||||
if options.keep_temporary_files:
|
||||
print("Temporary working files saved at:\n{0}".format(work_folder),
|
||||
file=sys.stderr)
|
||||
else:
|
||||
with suppress(FileNotFoundError):
|
||||
shutil.rmtree(work_folder)
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,113 @@
|
||||
# Copyright (c) 2014, Armin Ronacher
|
||||
#
|
||||
# Copyright (c) 2017, James R Barlow
|
||||
#
|
||||
# Some rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are
|
||||
# met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
#
|
||||
# * Redistributions in binary form must reproduce the above
|
||||
# copyright notice, this list of conditions and the following
|
||||
# disclaimer in the documentation and/or other materials provided
|
||||
# with the distribution.
|
||||
#
|
||||
# * The names of the contributors may not be used to endorse or
|
||||
# promote products derived from this software without specific
|
||||
# prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
import os
|
||||
import sys
|
||||
import codecs
|
||||
|
||||
|
||||
def verify_python3_env():
|
||||
"""Ensures that the environment is good for unicode on Python 3."""
|
||||
|
||||
# PEP 538 changes in Python 3.7 should make this wrangling unnecessary
|
||||
if sys.version_info[0:3] >= (3, 7, 0):
|
||||
return
|
||||
|
||||
try:
|
||||
import locale
|
||||
fs_enc = codecs.lookup(locale.getpreferredencoding()).name
|
||||
except Exception:
|
||||
fs_enc = 'ascii'
|
||||
if fs_enc != 'ascii':
|
||||
return
|
||||
|
||||
extra = ''
|
||||
if os.name == 'posix':
|
||||
import subprocess
|
||||
rv = subprocess.Popen(['locale', '-a'], stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE).communicate()[0]
|
||||
good_locales = set()
|
||||
has_c_utf8 = False
|
||||
|
||||
# Make sure we're operating on text here.
|
||||
if isinstance(rv, bytes):
|
||||
rv = rv.decode('ascii', 'replace')
|
||||
|
||||
for line in rv.splitlines():
|
||||
locale = line.strip()
|
||||
if locale.lower().endswith(('.utf-8', '.utf8')):
|
||||
good_locales.add(locale)
|
||||
if locale.lower() in ('c.utf8', 'c.utf-8'):
|
||||
has_c_utf8 = True
|
||||
|
||||
extra += '\n\n'
|
||||
if not good_locales:
|
||||
extra += (
|
||||
'Additional information: on this system no suitable UTF-8\n'
|
||||
'locales were discovered. This most likely requires resolving\n'
|
||||
'by reconfiguring the locale system.'
|
||||
)
|
||||
elif has_c_utf8:
|
||||
extra += (
|
||||
'This system supports the C.UTF-8 locale which is recommended.\n'
|
||||
'You might be able to resolve your issue by exporting the\n'
|
||||
'following environment variables:\n\n'
|
||||
' export LC_ALL=C.UTF-8\n'
|
||||
' export LANG=C.UTF-8'
|
||||
)
|
||||
else:
|
||||
extra += (
|
||||
'This system lists a couple of UTF-8 supporting locales that\n'
|
||||
'you can pick from. The following suitable locales were\n'
|
||||
'discovered: %s'
|
||||
) % ', '.join(sorted(good_locales))
|
||||
|
||||
bad_locale = None
|
||||
for locale in os.environ.get('LC_ALL'), os.environ.get('LANG'):
|
||||
if locale and locale.lower().endswith(('.utf-8', '.utf8')):
|
||||
bad_locale = locale
|
||||
if locale is not None:
|
||||
break
|
||||
if bad_locale is not None:
|
||||
extra += (
|
||||
'\nocrmypdf discovered that you exported a UTF-8 locale\n'
|
||||
'but the locale system could not pick up from it because\n'
|
||||
'it does not exist. The exported locale is "%s" but it\n'
|
||||
'is not supported'
|
||||
) % bad_locale
|
||||
|
||||
raise RuntimeError('ocrmypdf will abort further execution because Python 3 '
|
||||
'was configured to use ASCII as encoding for the '
|
||||
'environment.' + extra)
|
||||
@@ -0,0 +1,368 @@
|
||||
# © 2018 James R. Barlow: github.com/jbarlow83
|
||||
#
|
||||
# This file is part of OCRmyPDF.
|
||||
#
|
||||
# OCRmyPDF is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# OCRmyPDF is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with OCRmyPDF. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from pathlib import Path
|
||||
from itertools import groupby
|
||||
|
||||
import pikepdf
|
||||
|
||||
from .helpers import flatten_groups, page_number
|
||||
from .exec import tesseract
|
||||
|
||||
|
||||
def _update_page_resources(*, page, font, font_key, procset):
|
||||
"Update this page's fonts with a reference to the Glyphless font"
|
||||
|
||||
if '/Resources' not in page:
|
||||
page['/Resources'] = pikepdf.Dictionary({})
|
||||
resources = page['/Resources']
|
||||
try:
|
||||
fonts = resources['/Font']
|
||||
except KeyError:
|
||||
fonts = pikepdf.Dictionary({})
|
||||
if font_key not in fonts:
|
||||
fonts[font_key] = font
|
||||
resources['/Font'] = fonts
|
||||
|
||||
# Reassign /ProcSet to one that just lists everything - ProcSet is
|
||||
# obsolete and doesn't matter but recommended for old viewer support
|
||||
resources['/ProcSet'] = procset
|
||||
|
||||
|
||||
def _weave_layers_graft(
|
||||
*, pdf_base, page_num, text, font, font_key, procset, rotation, log):
|
||||
"""Insert the text layer from text page 0 on to pdf_base at page_num"""
|
||||
|
||||
log.debug("Grafting")
|
||||
if Path(text).stat().st_size == 0:
|
||||
return
|
||||
|
||||
# This is a pointer indicating a specific page in the base file
|
||||
pdf_text = pikepdf.open(text)
|
||||
pdf_text_contents = pdf_text.pages[0].Contents.read_bytes()
|
||||
|
||||
if not tesseract.has_textonly_pdf():
|
||||
# If we don't have textonly_pdf, edit the stream to delete the
|
||||
# instruction to draw the image Tesseract generated, which we do not
|
||||
# use.
|
||||
stream = bytearray(pdf_text_contents)
|
||||
pattern = b'/Im1 Do'
|
||||
idx = stream.find(pattern)
|
||||
stream[idx:(idx + len(pattern))] = b' ' * len(pattern)
|
||||
pdf_text_contents = bytes(stream)
|
||||
|
||||
base_page = pdf_base.pages.p(page_num)
|
||||
|
||||
# The text page always will be oriented up by this stage but the original
|
||||
# content may have a rotation applied. Wrap the text stream with a rotation
|
||||
# so it will be oriented the same way as the rest of the page content.
|
||||
# (Previous versions OCRmyPDF rotated the content layer to match the text.)
|
||||
mediabox = [float(pdf_text.pages[0].MediaBox[v])
|
||||
for v in range(4)]
|
||||
wt, ht = mediabox[2] - mediabox[0], mediabox[3] - mediabox[1]
|
||||
|
||||
mediabox = [float(base_page.MediaBox[v])
|
||||
for v in range(4)]
|
||||
wp, hp = mediabox[2] - mediabox[0], mediabox[3] - mediabox[1]
|
||||
|
||||
translate = pikepdf.PdfMatrix().translated(-wt / 2, -ht / 2)
|
||||
untranslate = pikepdf.PdfMatrix().translated(wp / 2, hp / 2)
|
||||
# -rotation because the input is a clockwise angle and this formula
|
||||
# uses CCW
|
||||
rotation = -rotation % 360
|
||||
rotate = pikepdf.PdfMatrix().rotated(rotation)
|
||||
|
||||
# Because of rounding of DPI, we might get a text layer that is not
|
||||
# identically sized to the target page. Scale to adjust. Normally this
|
||||
# is within 0.998.
|
||||
if rotation in (90, 270):
|
||||
wt, ht = ht, wt
|
||||
scale_x = wp / wt
|
||||
scale_y = hp / ht
|
||||
|
||||
log.debug('%r', (scale_x, scale_y))
|
||||
scale = pikepdf.PdfMatrix().scaled(scale_x, scale_y)
|
||||
|
||||
# Translate the text so it is centered at (0, 0), rotate it there, adjust
|
||||
# for a size different between initial and text PDF, then untranslate
|
||||
ctm = translate @ rotate @ scale @ untranslate
|
||||
|
||||
pdf_text_contents = (
|
||||
b'q %s cm\n' % ctm.encode() +
|
||||
pdf_text_contents +
|
||||
b'\nQ\n'
|
||||
)
|
||||
|
||||
new_text_layer = pikepdf.Stream(pdf_base, pdf_text_contents)
|
||||
|
||||
base_page.page_contents_add(new_text_layer, prepend=True)
|
||||
|
||||
_update_page_resources(
|
||||
page=base_page, font=font, font_key=font_key, procset=procset
|
||||
)
|
||||
|
||||
|
||||
def _find_font(text, pdf_base):
|
||||
"Copy a font from the filename text into pdf_base"
|
||||
|
||||
font, font_key = None, None
|
||||
possible_font_names = ('/f-0-0', '/F1')
|
||||
try:
|
||||
pdf_text = pikepdf.open(text)
|
||||
pdf_text_fonts = pdf_text.pages[0].Resources.get('/Font', {})
|
||||
except Exception:
|
||||
return None, None
|
||||
|
||||
for f in possible_font_names:
|
||||
pdf_text_font = pdf_text_fonts.get(f, None)
|
||||
if pdf_text_font is not None:
|
||||
font_key = f
|
||||
break
|
||||
if pdf_text_font:
|
||||
font = pdf_base.copy_foreign(pdf_text_font)
|
||||
return font, font_key
|
||||
|
||||
|
||||
def _traverse_toc(pdf_base, visitor_fn, log):
|
||||
"""
|
||||
Walk the table of contents, calling visitor_fn() at each node
|
||||
|
||||
The /Outlines data structure is a messy data structure, but rather than
|
||||
navigating hierarchically we just track unique nodes. Enqueue nodes when
|
||||
we find them, and never visit them again. set() is awesome. We look for
|
||||
the two types of object in the table of contents that can be page bookmarks
|
||||
and update the page entry.
|
||||
|
||||
"""
|
||||
|
||||
visited = set()
|
||||
queue = set()
|
||||
link_keys = ('/Parent', '/First', '/Last', '/Prev', '/Next')
|
||||
|
||||
if not '/Outlines' in pdf_base.root:
|
||||
return
|
||||
|
||||
queue.add(pdf_base.root.Outlines.objgen)
|
||||
while queue:
|
||||
objgen = queue.pop()
|
||||
visited.add(objgen)
|
||||
node = pdf_base.get_object(objgen)
|
||||
log.debug('fix toc: exploring outline entries at %r', objgen)
|
||||
|
||||
# Enumerate other nodes we could visit from here
|
||||
for key in link_keys:
|
||||
if key not in node:
|
||||
continue
|
||||
item = node[key]
|
||||
if not item.is_indirect:
|
||||
# Direct references are not allowed here, but it's not clear
|
||||
# what we should do if we find any. Removing them is an option:
|
||||
# node[key] = pdf_base.make_indirect(None)
|
||||
continue
|
||||
objgen = item.objgen
|
||||
if objgen not in visited:
|
||||
queue.add(objgen)
|
||||
|
||||
if visitor_fn:
|
||||
visitor_fn(pdf_base, node, log)
|
||||
|
||||
|
||||
def _fix_toc(pdf_base, pageref_remap, log):
|
||||
"""Repair the table of contents
|
||||
|
||||
Whenever we replace a page wholesale, it gets assigned a new objgen number
|
||||
and other references to it within the PDF become invalid, most notably in
|
||||
the table of contents (/Outlines in PDF-speak). In weave_layers we collect
|
||||
pageref_remap, a mapping that describes the new objgen number given an old
|
||||
one. (objgen is a tuple, and the gen is almost always zero.)
|
||||
|
||||
It may ultimately be better to find a way to rebuild a page in place.
|
||||
|
||||
"""
|
||||
|
||||
if not pageref_remap:
|
||||
return
|
||||
|
||||
def remap_dest(dest_node):
|
||||
"""
|
||||
Inner helper function: change the objgen for any page from the old we
|
||||
invalidated to its new one.
|
||||
"""
|
||||
if not isinstance(dest_node, pikepdf.Array):
|
||||
return
|
||||
pageref = dest_node[0]
|
||||
if pageref['/Type'] == '/Page' and \
|
||||
pageref.objgen in pageref_remap:
|
||||
new_objgen = pageref_remap[pageref.objgen]
|
||||
dest_node[0] = pdf_base.get_object(new_objgen)
|
||||
|
||||
def visit_remap_dest(pdf_base, node, log):
|
||||
"""
|
||||
Visitor function to fix ToC entries
|
||||
|
||||
Test for the two types of references to pages that can occur in ToCs.
|
||||
Both types have the same final format (an indirect reference to the
|
||||
target page).
|
||||
"""
|
||||
if '/Dest' in node:
|
||||
# /Dest reference to another page (old method)
|
||||
remap_dest(node['/Dest'])
|
||||
elif '/A' in node:
|
||||
# /A (action) command set to "GoTo" (newer method)
|
||||
if '/S' in node['/A'] and node['/A']['/S'] == '/GoTo':
|
||||
remap_dest(node['/A']['/D'])
|
||||
|
||||
_traverse_toc(pdf_base, visit_remap_dest, log)
|
||||
|
||||
|
||||
def weave_layers(
|
||||
infiles,
|
||||
output_file,
|
||||
log,
|
||||
context):
|
||||
"""Apply text layer and/or image layer changes to baseline file
|
||||
|
||||
This is where the magic happens. infiles will be the main PDF to modify,
|
||||
and optional .text.pdf and .image-layer.pdf files, organized however ruffus
|
||||
organizes them.
|
||||
|
||||
From .text.pdf, we copy the content stream (which contains the Tesseract
|
||||
OCR results), and rotate it into place. The first time we do this, we also
|
||||
copy the GlyphlessFont, and then reference that font again.
|
||||
|
||||
For .image-layer.pdf, we check if this is a "pointer" to the original file,
|
||||
or a new file. If a new file, we replace the page and remember that we
|
||||
replaced this page.
|
||||
|
||||
Every 100 open files, we save intermediate results, to avoid any resource
|
||||
limits, since pikepdf/qpdf need to keep a lot of open file handles in the
|
||||
background. When objects are copied from one file to another qpdf, qpdf
|
||||
doesn't actually copy the data until asked to write, so all the resources
|
||||
it may need to remain available.
|
||||
|
||||
For completeness, we set up a /ProcSet on every page, although it's
|
||||
unlikely any PDF viewer cares about this anymore.
|
||||
|
||||
"""
|
||||
|
||||
def input_sorter(key):
|
||||
try:
|
||||
return page_number(key)
|
||||
except ValueError:
|
||||
return -1
|
||||
flat_inputs = sorted(flatten_groups(infiles), key=input_sorter)
|
||||
groups = groupby(flat_inputs, key=input_sorter)
|
||||
|
||||
# Extract first item
|
||||
_, basegroup = next(groups)
|
||||
base = list(basegroup)[0]
|
||||
path_base = Path(base).resolve()
|
||||
pdf_base = pikepdf.open(path_base)
|
||||
keep_open = []
|
||||
font, font_key, procset = None, None, None
|
||||
pdfinfo = context.get_pdfinfo()
|
||||
pagerefs = {}
|
||||
|
||||
# Walk the table of contents first, to trigger pikepdf/qpdf to resolve all
|
||||
# page references in the table of contents. Some PDF generators put invalid
|
||||
# references in the ToC, so we want to resolve them to null before we
|
||||
# create any references, or the ToC will be corrupted
|
||||
_traverse_toc(pdf_base, None, log)
|
||||
|
||||
procset = pdf_base.make_indirect(
|
||||
pikepdf.Object.parse(b'[ /PDF /Text /ImageB /ImageC /ImageI ]'))
|
||||
|
||||
# Iterate rest
|
||||
for page_num, layers in groups:
|
||||
layers = list(layers)
|
||||
log.debug(page_num)
|
||||
log.debug(layers)
|
||||
|
||||
text = next(
|
||||
(ii for ii in layers if ii.endswith('.text.pdf')), None
|
||||
)
|
||||
image = next(
|
||||
(ii for ii in layers if ii.endswith('.image-layer.pdf')), None
|
||||
)
|
||||
|
||||
if text and not font:
|
||||
font, font_key = _find_font(text, pdf_base)
|
||||
|
||||
replacing = False
|
||||
content_rotation = pdfinfo[page_num - 1].rotation
|
||||
|
||||
path_image = Path(image).resolve() if image else None
|
||||
if path_image is not None and path_image != path_base:
|
||||
# We are replacing the old page with a rasterized PDF of the new
|
||||
# page
|
||||
log.debug("Replace")
|
||||
old_objgen = pdf_base.pages[page_num - 1].objgen
|
||||
|
||||
pdf_image = pikepdf.open(image)
|
||||
keep_open.append(pdf_image)
|
||||
image_page = pdf_image.pages[0]
|
||||
pdf_base.pages[page_num - 1] = image_page
|
||||
|
||||
# We're adding a new page, which will get a new objgen number pair,
|
||||
# so we need to update any references to it. qpdf did not like
|
||||
# my attempt to update the old object in place, but that is an
|
||||
# option to consider
|
||||
pagerefs[old_objgen] = pdf_base.pages[page_num - 1].objgen
|
||||
replacing = True
|
||||
|
||||
autorotate_correction = context.get_rotation(page_num - 1)
|
||||
if replacing:
|
||||
content_rotation = autorotate_correction
|
||||
text_rotation = autorotate_correction
|
||||
text_misaligned = (text_rotation - content_rotation) % 360
|
||||
log.debug('%r', [
|
||||
text_rotation, autorotate_correction, text_misaligned,
|
||||
content_rotation]
|
||||
)
|
||||
|
||||
if text and font:
|
||||
# Graft the text layer onto this page, whether new or old
|
||||
_weave_layers_graft(
|
||||
pdf_base=pdf_base, page_num=page_num, text=text, font=font,
|
||||
font_key=font_key, rotation=text_misaligned, procset=procset,
|
||||
log=log
|
||||
)
|
||||
|
||||
# Correct the rotation if applicable
|
||||
pdf_base.pages[page_num - 1].Rotate = \
|
||||
(content_rotation - autorotate_correction) % 360
|
||||
|
||||
if len(keep_open) > 100:
|
||||
# qpdf limitations require us to keep files open when we intend
|
||||
# to copy content from them before saving. However, we want to keep
|
||||
# a lid on file handles and memory usage, so for big files we're
|
||||
# going to stop and save periodically. Attach the font to page 1
|
||||
# even if page 1 doesn't use it, so we have a way to get it back.
|
||||
page0 = pdf_base.pages[0]
|
||||
_update_page_resources(
|
||||
page=page0, font=font, font_key=font_key, procset=procset)
|
||||
interim = output_file + '_working{}.pdf'.format(page_num)
|
||||
pdf_base.save(interim)
|
||||
del pdf_base
|
||||
keep_open = []
|
||||
|
||||
pdf_base = pikepdf.open(interim)
|
||||
procset = pdf_base.pages[0].Resources.ProcSet
|
||||
font = pdf_base.pages[0].Resources.Font.get(font_key)
|
||||
|
||||
_fix_toc(pdf_base, pagerefs, log)
|
||||
pdf_base.save(output_file)
|
||||
@@ -0,0 +1,109 @@
|
||||
# © 2016 James R. Barlow: github.com/jbarlow83
|
||||
#
|
||||
# This file is part of OCRmyPDF.
|
||||
#
|
||||
# OCRmyPDF is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# OCRmyPDF is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with OCRmyPDF. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
from enum import IntEnum
|
||||
from textwrap import dedent
|
||||
|
||||
class ExitCode(IntEnum):
|
||||
ok = 0
|
||||
bad_args = 1
|
||||
input_file = 2
|
||||
missing_dependency = 3
|
||||
invalid_output_pdf = 4
|
||||
file_access_error = 5
|
||||
already_done_ocr = 6
|
||||
child_process_error = 7
|
||||
encrypted_pdf = 8
|
||||
invalid_config = 9
|
||||
pdfa_conversion_failed = 10
|
||||
other_error = 15
|
||||
ctrl_c = 130
|
||||
|
||||
|
||||
class ExitCodeException(Exception):
|
||||
exit_code = ExitCode.other_error
|
||||
message = ""
|
||||
|
||||
def __str__(self):
|
||||
super_msg = super().__str__() # Don't do str(super())
|
||||
if self.message:
|
||||
return self.message.format(super_msg)
|
||||
return super_msg
|
||||
|
||||
|
||||
class BadArgsError(ExitCodeException):
|
||||
exit_code = ExitCode.bad_args
|
||||
|
||||
|
||||
class PdfMergeFailedError(ExitCodeException):
|
||||
exit_code = ExitCode.input_file
|
||||
message = dedent('''\
|
||||
Failed to merge PDF image layer with OCR layer
|
||||
|
||||
Usually this happens because the input PDF file is malformed and
|
||||
ocrmypdf cannot automatically correct the problem on its own.
|
||||
|
||||
Try using
|
||||
ocrmypdf --pdf-renderer sandwich [..other args..]
|
||||
''')
|
||||
|
||||
class MissingDependencyError(ExitCodeException):
|
||||
exit_code = ExitCode.missing_dependency
|
||||
|
||||
|
||||
class UnsupportedImageFormatError(ExitCodeException):
|
||||
exit_code = ExitCode.input_file
|
||||
|
||||
|
||||
class DpiError(ExitCodeException):
|
||||
exit_code = ExitCode.input_file
|
||||
|
||||
|
||||
class OutputFileAccessError(ExitCodeException):
|
||||
exit_code = ExitCode.file_access_error
|
||||
|
||||
|
||||
class PriorOcrFoundError(ExitCodeException):
|
||||
exit_code = ExitCode.already_done_ocr
|
||||
|
||||
|
||||
class InputFileError(ExitCodeException):
|
||||
exit_code = ExitCode.input_file
|
||||
|
||||
|
||||
class SubprocessOutputError(ExitCodeException):
|
||||
exit_code = ExitCode.child_process_error
|
||||
|
||||
|
||||
class EncryptedPdfError(ExitCodeException):
|
||||
exit_code = ExitCode.encrypted_pdf
|
||||
message = dedent('''\
|
||||
Input PDF is encrypted. The encryption must be removed to
|
||||
perform OCR.
|
||||
|
||||
For information about this PDF's security use
|
||||
qpdf --show-encryption infilename
|
||||
|
||||
You can remove the encryption using
|
||||
qpdf --decrypt [--password=[password]] infilename
|
||||
''')
|
||||
|
||||
|
||||
class TesseractConfigError(ExitCodeException):
|
||||
exit_code = ExitCode.invalid_config
|
||||
message = "Error occurred while parsing a Tesseract configuration file"
|
||||
@@ -0,0 +1,59 @@
|
||||
# © 2016 James R. Barlow: github.com/jbarlow83
|
||||
#
|
||||
# This file is part of OCRmyPDF.
|
||||
#
|
||||
# OCRmyPDF is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# OCRmyPDF is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with OCRmyPDF. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
"""Wrappers to manage subprocess calls"""
|
||||
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
from subprocess import run, STDOUT, PIPE, CalledProcessError
|
||||
from ..exceptions import MissingDependencyError
|
||||
|
||||
|
||||
def get_version(program, *,
|
||||
version_arg='--version', regex=r'(\d+(\.\d+)*)'):
|
||||
"Get the version of the specified program"
|
||||
args_prog = [
|
||||
program,
|
||||
version_arg
|
||||
]
|
||||
try:
|
||||
proc = run(
|
||||
args_prog, close_fds=True, universal_newlines=True,
|
||||
stdout=PIPE, stderr=STDOUT, check=True)
|
||||
output = proc.stdout
|
||||
except FileNotFoundError as e:
|
||||
raise MissingDependencyError(
|
||||
"Could not find program '{}' on the PATH".format(
|
||||
program)) from e
|
||||
except CalledProcessError as e:
|
||||
if e.returncode < 0:
|
||||
raise MissingDependencyError(
|
||||
"Ran program '{}' but it exited with an error:\n{}".format(
|
||||
program, e.output)) from e
|
||||
raise MissingDependencyError(
|
||||
"Could not find program '{}' on the PATH".format(
|
||||
program)) from e
|
||||
try:
|
||||
version = re.match(regex, output.strip()).group(1)
|
||||
except AttributeError as e:
|
||||
raise MissingDependencyError(
|
||||
("The program '{}' did not report its version. "
|
||||
"Message was:\n{}").format(program, output)
|
||||
)
|
||||
|
||||
return version
|
||||
@@ -0,0 +1,280 @@
|
||||
# © 2017 James R. Barlow: github.com/jbarlow83
|
||||
#
|
||||
# This file is part of OCRmyPDF.
|
||||
#
|
||||
# OCRmyPDF is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# OCRmyPDF is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with OCRmyPDF. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from tempfile import NamedTemporaryFile
|
||||
from subprocess import run, PIPE, STDOUT
|
||||
from shutil import copy
|
||||
from functools import lru_cache
|
||||
import re
|
||||
from PIL import Image
|
||||
from . import get_version
|
||||
from ..exceptions import SubprocessOutputError
|
||||
from ..helpers import fspath
|
||||
|
||||
|
||||
@lru_cache(maxsize=1)
|
||||
def version():
|
||||
return get_version('gs')
|
||||
|
||||
|
||||
def jpeg_passthrough_available():
|
||||
"""Returns True if the installed version of Ghostscript supports JPEG passthru
|
||||
|
||||
Prior to 9.23, Ghostscript decode and re-encoded JPEGs internally. In 9.23
|
||||
it gained the ability to keep JPEGs unmodified. However, the 9.23
|
||||
implementation was buggy and would deletes the last two bytes of images in
|
||||
some cases, as reported here.
|
||||
https://bugs.ghostscript.com/show_bug.cgi?id=699216
|
||||
|
||||
The issue was fixed for 9.24, hence that is the first version we consider
|
||||
the feature available. (However, we don't use 9.24 at all, so the first
|
||||
version that allows JPEG passthrough is 9.25.
|
||||
|
||||
"""
|
||||
return version() >= '9.24'
|
||||
|
||||
|
||||
def _gs_error_reported(stream):
|
||||
return re.search(r'error', stream, flags=re.IGNORECASE)
|
||||
|
||||
|
||||
def extract_text(input_file, pageno=1):
|
||||
"""Use the txtwrite device to get text layout information out
|
||||
|
||||
For details on options of -dTextFormat see
|
||||
https://www.ghostscript.com/doc/current/VectorDevices.htm#TXT
|
||||
|
||||
Format is like
|
||||
<page>
|
||||
<line>
|
||||
<span bbox="left top right bottom" font="..." size="...">
|
||||
<char bbox="...." c="X"/>
|
||||
|
||||
:param pageno: number of page to extract, or all pages if None
|
||||
:return: XML-ish text representation in bytes
|
||||
"""
|
||||
|
||||
if pageno is not None:
|
||||
pages = [
|
||||
'-dFirstPage=%i' % pageno,
|
||||
'-dLastPage=%i' % pageno
|
||||
]
|
||||
else:
|
||||
pages = []
|
||||
|
||||
args_gs = [
|
||||
'gs',
|
||||
'-dQUIET',
|
||||
'-dSAFER',
|
||||
'-dBATCH',
|
||||
'-dNOPAUSE',
|
||||
'-sDEVICE=txtwrite',
|
||||
'-dTextFormat=0',
|
||||
] + pages + [
|
||||
'-o', '-',
|
||||
fspath(input_file)
|
||||
]
|
||||
|
||||
p = run(args_gs, stdout=PIPE, stderr=PIPE)
|
||||
if p.returncode != 0:
|
||||
raise SubprocessOutputError(
|
||||
'Ghostscript text extraction failed\n%s\n%s\n%s' % (
|
||||
input_file, p.stdout.decode(), p.stderr.decode()
|
||||
)
|
||||
)
|
||||
|
||||
return p.stdout
|
||||
|
||||
|
||||
def rasterize_pdf(input_file, output_file, xres, yres, raster_device, log,
|
||||
pageno=1, page_dpi=None, rotation=None):
|
||||
"""Rasterize one page of a PDF at resolution (xres, yres) in canvas units.
|
||||
|
||||
The image is sized to match the integer pixels dimensions implied by
|
||||
(xres, yres) even if those numbers are noninteger. The image's DPI will
|
||||
be overridden with the values in page_dpi.
|
||||
|
||||
:param input_file: pathlike
|
||||
:param output_file: pathlike
|
||||
:param xres: resolution at which to rasterize page
|
||||
:param yres:
|
||||
:param raster_device:
|
||||
:param log:
|
||||
:param pageno: page number to rasterize (beginning at page 1)
|
||||
:param page_dpi: resolution tuple (x, y) overriding output image DPI
|
||||
:return:
|
||||
"""
|
||||
res = xres, yres
|
||||
int_res = round(xres), round(yres)
|
||||
if not page_dpi:
|
||||
page_dpi = res
|
||||
|
||||
with NamedTemporaryFile(delete=True) as tmp:
|
||||
args_gs = [
|
||||
'gs',
|
||||
'-dQUIET',
|
||||
'-dSAFER',
|
||||
'-dBATCH',
|
||||
'-dNOPAUSE',
|
||||
'-sDEVICE=%s' % raster_device,
|
||||
'-dFirstPage=%i' % pageno,
|
||||
'-dLastPage=%i' % pageno,
|
||||
'-r{0}x{1}'.format(str(int_res[0]), str(int_res[1])),
|
||||
'-o', tmp.name,
|
||||
'-dAutoRotatePages=/None', # Probably has no effect on raster
|
||||
'-f',
|
||||
fspath(input_file)
|
||||
]
|
||||
|
||||
log.debug(args_gs)
|
||||
p = run(args_gs, stdout=PIPE, stderr=STDOUT,
|
||||
universal_newlines=True)
|
||||
if _gs_error_reported(p.stdout):
|
||||
log.error(p.stdout)
|
||||
else:
|
||||
log.debug(p.stdout)
|
||||
|
||||
if p.returncode != 0:
|
||||
log.error('Ghostscript rasterizing failed')
|
||||
raise SubprocessOutputError()
|
||||
|
||||
# Ghostscript only accepts integers for output resolution
|
||||
# if the resolution happens to be fractional, then the discrepancy
|
||||
# would change the size of the output page, especially if the DPI
|
||||
# is quite low. Resize the image to the expected size
|
||||
|
||||
tmp.seek(0)
|
||||
with Image.open(tmp) as im:
|
||||
expected_size = round(im.size[0] / int_res[0] * res[0]), \
|
||||
round(im.size[1] / int_res[1] * res[1])
|
||||
if expected_size != im.size or page_dpi != (xres, yres):
|
||||
log.debug(
|
||||
"Ghostscript: resize output image {} -> {}".format(
|
||||
im.size, expected_size))
|
||||
im = im.resize(expected_size)
|
||||
|
||||
if rotation is not None:
|
||||
log.debug("Rotating output by %i", rotation)
|
||||
# rotation is a clockwise angle and Image.ROTATE_* is
|
||||
# counterclockwise so this cancels out the rotation
|
||||
if rotation == 90:
|
||||
im = im.transpose(Image.ROTATE_90)
|
||||
elif rotation == 180:
|
||||
im = im.transpose(Image.ROTATE_180)
|
||||
elif rotation == 270:
|
||||
im = im.transpose(Image.ROTATE_270)
|
||||
if rotation % 180 == 90:
|
||||
page_dpi = page_dpi[1], page_dpi[0]
|
||||
im.save(fspath(output_file), dpi=page_dpi)
|
||||
|
||||
|
||||
def generate_pdfa(pdf_pages, output_file, compression, log,
|
||||
threads=1, pdf_version='1.5', pdfa_part='2'):
|
||||
"""Generate a PDF/A.
|
||||
|
||||
The pdf_pages, a list files, will be merged into output_file. One or more
|
||||
PDF files may be merged. One of the files in this list must be a pdfmark
|
||||
file that provides Ghostscript with details on how to perform the PDF/A
|
||||
conversion. By default with we pick PDF/A-2b, but this works for 1 or 3.
|
||||
|
||||
compression can be 'jpeg', 'lossless', or an empty string. In 'jpeg',
|
||||
Ghostscript is instructed to convert color and grayscale images to DCT
|
||||
(JPEG encoding). In 'lossless' Ghostscript is told to convert images to
|
||||
Flate (lossless/PNG). If the parameter is omitted Ghostscript is left to
|
||||
make its own decisions about how to encode images; it appears to use a
|
||||
heuristic to decide how to encode images. As of Ghostscript 9.25, we
|
||||
support passthrough JPEG which allows Ghostscript to avoid transcoding
|
||||
images entirely. (The feature was added in 9.23 but broken, and the 9.24
|
||||
release of Ghostscript had regressions, so we don't support it until 9.25.)
|
||||
"""
|
||||
compression_args = []
|
||||
if compression == 'jpeg':
|
||||
compression_args = [
|
||||
"-dAutoFilterColorImages=false",
|
||||
"-dColorImageFilter=/DCTEncode",
|
||||
"-dAutoFilterGrayImages=false",
|
||||
"-dGrayImageFilter=/DCTEncode",
|
||||
]
|
||||
elif compression == 'lossless':
|
||||
compression_args = [
|
||||
"-dAutoFilterColorImages=false",
|
||||
"-dColorImageFilter=/FlateEncode",
|
||||
"-dAutoFilterGrayImages=false",
|
||||
"-dGrayImageFilter=/FlateEncode",
|
||||
]
|
||||
else:
|
||||
compression_args = [
|
||||
"-dAutoFilterColorImages=true",
|
||||
"-dAutoFilterGrayImages=true",
|
||||
]
|
||||
|
||||
# Older versions of Ghostscript expect a leading slash in
|
||||
# sColorConversionStrategy, newer ones should not have it. See Ghostscript
|
||||
# git commit fe1c025d.
|
||||
strategy = 'RGB' if version() >= '9.19' else '/RGB'
|
||||
|
||||
if version() == '9.23':
|
||||
# 9.23: new feature JPEG passthrough is broken in some cases, best to
|
||||
# disable it always
|
||||
# https://bugs.ghostscript.com/show_bug.cgi?id=699216
|
||||
compression_args.append('-dPassThroughJPEGImages=false')
|
||||
|
||||
with NamedTemporaryFile(delete=True) as gs_pdf:
|
||||
# nb no need to specify ProcessColorModel when ColorConversionStrategy
|
||||
# is set; see:
|
||||
# https://bugs.ghostscript.com/show_bug.cgi?id=699392
|
||||
args_gs = [
|
||||
"gs",
|
||||
"-dQUIET",
|
||||
"-dBATCH",
|
||||
"-dNOPAUSE",
|
||||
"-dCompatibilityLevel=" + str(pdf_version),
|
||||
"-dNumRenderingThreads=" + str(threads),
|
||||
"-sDEVICE=pdfwrite",
|
||||
"-dAutoRotatePages=/None",
|
||||
"-sColorConversionStrategy=" + strategy
|
||||
] + compression_args + [
|
||||
"-dJPEGQ=95",
|
||||
"-dPDFA=" + pdfa_part,
|
||||
"-dPDFACompatibilityPolicy=1",
|
||||
"-sOutputFile=" + gs_pdf.name,
|
||||
]
|
||||
args_gs.extend(fspath(s) for s in pdf_pages) # Stringify Path objs
|
||||
log.debug(args_gs)
|
||||
p = run(args_gs, stdout=PIPE, stderr=STDOUT,
|
||||
universal_newlines=True)
|
||||
|
||||
if _gs_error_reported(p.stdout):
|
||||
log.error(p.stdout)
|
||||
elif 'overprint mode not set' in p.stdout:
|
||||
# Unless someone is going to print PDF/A documents on a
|
||||
# magical sRGB printer I can't see the removal of overprinting
|
||||
# being a problem....
|
||||
log.debug(
|
||||
"Ghostscript had to remove PDF 'overprinting' from the "
|
||||
"input file to complete PDF/A conversion. "
|
||||
)
|
||||
else:
|
||||
log.debug(p.stdout)
|
||||
|
||||
if p.returncode == 0:
|
||||
# Ghostscript does not change return code when it fails to create
|
||||
# PDF/A - check PDF/A status elsewhere
|
||||
copy(gs_pdf.name, fspath(output_file))
|
||||
else:
|
||||
log.error('Ghostscript PDF/A rendering failed')
|
||||
raise SubprocessOutputError()
|
||||
@@ -0,0 +1,66 @@
|
||||
# © 2018 James R. Barlow: github.com/jbarlow83
|
||||
#
|
||||
# This file is part of OCRmyPDF.
|
||||
#
|
||||
# OCRmyPDF is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# OCRmyPDF is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with OCRmyPDF. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from subprocess import CalledProcessError, run, PIPE
|
||||
from functools import lru_cache
|
||||
import sys
|
||||
import os
|
||||
import shutil
|
||||
|
||||
from . import get_version
|
||||
from ..exceptions import ExitCode, MissingDependencyError
|
||||
|
||||
|
||||
@lru_cache(maxsize=1)
|
||||
def version():
|
||||
return get_version('jbig2', regex=r'jbig2enc (\d+(\.\d+)*).*')
|
||||
|
||||
|
||||
def available():
|
||||
try:
|
||||
version()
|
||||
except MissingDependencyError:
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
def convert_group(*, cwd, infiles, out_prefix):
|
||||
args = [
|
||||
'jbig2',
|
||||
'-b',
|
||||
out_prefix,
|
||||
'-s', # symbol mode (lossy)
|
||||
# '-r', # refinement mode (lossless symbol mode, currently disabled in
|
||||
# jbig2)
|
||||
'-p',
|
||||
]
|
||||
args.extend(infiles)
|
||||
proc = run(args, cwd=cwd, stdout=PIPE, stderr=PIPE)
|
||||
proc.check_returncode()
|
||||
return proc
|
||||
|
||||
|
||||
def convert_single(*, cwd, infile, outfile):
|
||||
args = [
|
||||
'jbig2',
|
||||
'-p',
|
||||
infile
|
||||
]
|
||||
with open(outfile, 'wb') as fstdout:
|
||||
proc = run(args, cwd=cwd, stdout=fstdout, stderr=PIPE)
|
||||
proc.check_returncode()
|
||||
return proc
|
||||
@@ -0,0 +1,53 @@
|
||||
# © 2018 James R. Barlow: github.com/jbarlow83
|
||||
#
|
||||
# This file is part of OCRmyPDF.
|
||||
#
|
||||
# OCRmyPDF is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# OCRmyPDF is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with OCRmyPDF. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from subprocess import CalledProcessError, run
|
||||
from tempfile import TemporaryFile
|
||||
from functools import lru_cache
|
||||
import sys
|
||||
import os
|
||||
import shutil
|
||||
|
||||
from . import get_version
|
||||
from ..exceptions import ExitCode, MissingDependencyError
|
||||
|
||||
|
||||
@lru_cache(maxsize=1)
|
||||
def version():
|
||||
return get_version('pngquant', regex=r'(\d+(\.\d+)*).*')
|
||||
|
||||
|
||||
def available():
|
||||
try:
|
||||
version()
|
||||
except MissingDependencyError:
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
def quantize(input_file, output_file, quality_min, quality_max):
|
||||
args = [
|
||||
'pngquant',
|
||||
'--force',
|
||||
'--skip-if-larger',
|
||||
'--output', output_file,
|
||||
'--quality', '{}-{}'.format(quality_min, quality_max),
|
||||
'--',
|
||||
input_file
|
||||
]
|
||||
proc = run(args)
|
||||
proc.check_returncode()
|
||||
@@ -0,0 +1,56 @@
|
||||
# © 2017 James R. Barlow: github.com/jbarlow83
|
||||
#
|
||||
# This file is part of OCRmyPDF.
|
||||
#
|
||||
# OCRmyPDF is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# OCRmyPDF is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with OCRmyPDF. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from subprocess import CalledProcessError, STDOUT, PIPE, run
|
||||
from functools import lru_cache
|
||||
|
||||
from ..exceptions import InputFileError, SubprocessOutputError, \
|
||||
EncryptedPdfError
|
||||
from . import get_version
|
||||
|
||||
|
||||
@lru_cache(maxsize=1)
|
||||
def version():
|
||||
return get_version('qpdf', regex=r'qpdf version (.+)')
|
||||
|
||||
|
||||
def check(input_file, log=None):
|
||||
args_qpdf = [
|
||||
'qpdf',
|
||||
'--check',
|
||||
input_file
|
||||
]
|
||||
|
||||
if log is None:
|
||||
import logging as log
|
||||
|
||||
try:
|
||||
run(args_qpdf, stderr=STDOUT, stdout=PIPE, universal_newlines=True,
|
||||
check=True)
|
||||
except CalledProcessError as e:
|
||||
if e.returncode == 2:
|
||||
log.error("%s: not a valid PDF, and could not repair it.",
|
||||
input_file)
|
||||
log.error("Details:")
|
||||
log.error(e.output)
|
||||
elif e.returncode == 3:
|
||||
log.info("qpdf --check returned warnings:")
|
||||
log.info(e.output)
|
||||
else:
|
||||
log.warning(e.output)
|
||||
return False
|
||||
return True
|
||||
@@ -1,21 +1,32 @@
|
||||
#!/usr/bin/env python3
|
||||
# © 2015 James R. Barlow: github.com/jbarlow83
|
||||
# © 2017 James R. Barlow: github.com/jbarlow83
|
||||
#
|
||||
# This file is part of OCRmyPDF.
|
||||
#
|
||||
# OCRmyPDF is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# OCRmyPDF is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with OCRmyPDF. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import sys
|
||||
import os
|
||||
import re
|
||||
import shutil
|
||||
from functools import lru_cache
|
||||
from ..exceptions import MissingDependencyError, TesseractConfigError
|
||||
from ..helpers import page_number
|
||||
from . import get_program
|
||||
from collections import namedtuple
|
||||
from textwrap import dedent
|
||||
import PyPDF2 as pypdf
|
||||
|
||||
from subprocess import Popen, PIPE, CalledProcessError, \
|
||||
TimeoutExpired, check_output, STDOUT, DEVNULL
|
||||
from subprocess import CalledProcessError, TimeoutExpired, check_output, STDOUT
|
||||
from contextlib import suppress
|
||||
|
||||
from ..exceptions import MissingDependencyError, TesseractConfigError
|
||||
from ..helpers import page_number
|
||||
from . import get_version
|
||||
|
||||
OrientationConfidence = namedtuple(
|
||||
'OrientationConfidence',
|
||||
@@ -41,43 +52,30 @@ HOCR_TEMPLATE = """<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
@lru_cache(maxsize=1)
|
||||
def version():
|
||||
args_tess = [
|
||||
get_program('tesseract'),
|
||||
'--version'
|
||||
]
|
||||
try:
|
||||
versions = check_output(
|
||||
args_tess, close_fds=True, universal_newlines=True,
|
||||
stderr=STDOUT)
|
||||
except CalledProcessError as e:
|
||||
print("Could not find Tesseract executable on system PATH.",
|
||||
file=sys.stderr)
|
||||
raise MissingDependencyError from e
|
||||
|
||||
tesseract_version = re.match(r'tesseract\s(.+)', versions).group(1)
|
||||
return tesseract_version
|
||||
return get_version('tesseract', regex=r'tesseract\s(.+)')
|
||||
|
||||
|
||||
def v4():
|
||||
"Is this Tesseract v4.0?"
|
||||
return (version() >= '4')
|
||||
return version() >= '4'
|
||||
|
||||
|
||||
@lru_cache(maxsize=1)
|
||||
def has_textonly_pdf():
|
||||
"""Does Tesseract have textonly_pdf capability?
|
||||
|
||||
Available in 3.05.01, and v4.00.00alpha since January 2017. Best to
|
||||
|
||||
Available in 3.05.01, and v4.00.00alpha since January 2017. Best to
|
||||
parse the parameter list
|
||||
"""
|
||||
args_tess = [
|
||||
get_program('tesseract'),
|
||||
'--print-parameters'
|
||||
'tesseract',
|
||||
'--print-parameters',
|
||||
'pdf'
|
||||
]
|
||||
params = ''
|
||||
try:
|
||||
params = check_output(
|
||||
args_tess, close_fds=True, universal_newlines=True,
|
||||
stderr=STDOUT)
|
||||
args_tess, universal_newlines=True, stderr=STDOUT)
|
||||
except CalledProcessError as e:
|
||||
print("Could not --print-parameters from tesseract",
|
||||
file=sys.stderr)
|
||||
@@ -95,13 +93,12 @@ def psm():
|
||||
@lru_cache(maxsize=1)
|
||||
def languages():
|
||||
args_tess = [
|
||||
get_program('tesseract'),
|
||||
'tesseract',
|
||||
'--list-langs'
|
||||
]
|
||||
try:
|
||||
langs = check_output(
|
||||
args_tess, close_fds=True, universal_newlines=True,
|
||||
stderr=STDOUT)
|
||||
args_tess, universal_newlines=True, stderr=STDOUT)
|
||||
except CalledProcessError as e:
|
||||
msg = dedent("""Tesseract failed to report available languages.
|
||||
Output from Tesseract:
|
||||
@@ -113,20 +110,19 @@ def languages():
|
||||
return set(lang.strip() for lang in langs.splitlines()[1:])
|
||||
|
||||
|
||||
def tess_base_args(languages, engine_mode):
|
||||
def tess_base_args(langs, engine_mode):
|
||||
args = [
|
||||
get_program('tesseract'),
|
||||
'tesseract',
|
||||
]
|
||||
if languages:
|
||||
args.extend(['-l', '+'.join(languages)])
|
||||
if langs:
|
||||
args.extend(['-l', '+'.join(langs)])
|
||||
if engine_mode is not None and v4():
|
||||
args.extend(['--oem', str(engine_mode)])
|
||||
return args
|
||||
|
||||
|
||||
def get_orientation(input_file, language: list, engine_mode, timeout: float,
|
||||
log):
|
||||
args_tesseract = tess_base_args(language, engine_mode) + [
|
||||
def get_orientation(input_file, engine_mode, timeout: float, log):
|
||||
args_tesseract = tess_base_args(['osd'], engine_mode) + [
|
||||
psm(), '0',
|
||||
input_file,
|
||||
'stdout'
|
||||
@@ -134,19 +130,18 @@ def get_orientation(input_file, language: list, engine_mode, timeout: float,
|
||||
|
||||
try:
|
||||
stdout = check_output(
|
||||
args_tesseract, close_fds=True, stderr=STDOUT,
|
||||
universal_newlines=True, timeout=timeout)
|
||||
args_tesseract, stderr=STDOUT, timeout=timeout)
|
||||
except TimeoutExpired:
|
||||
return OrientationConfidence(angle=0, confidence=0.0)
|
||||
except CalledProcessError as e:
|
||||
tesseract_log_output(log, e.output, input_file)
|
||||
if ('Too few characters. Skipping this page' in e.output or
|
||||
'Image too large' in e.output):
|
||||
if (b'Too few characters. Skipping this page' in e.output or
|
||||
b'Image too large' in e.output):
|
||||
return OrientationConfidence(0, 0)
|
||||
raise e from e
|
||||
else:
|
||||
osd = {}
|
||||
for line in stdout.splitlines():
|
||||
for line in stdout.decode().splitlines():
|
||||
line = line.strip()
|
||||
parts = line.split(':', maxsplit=2)
|
||||
if len(parts) == 2:
|
||||
@@ -160,7 +155,7 @@ def get_orientation(input_file, language: list, engine_mode, timeout: float,
|
||||
assert 'Rotate' not in osd
|
||||
angle = -angle % 360
|
||||
else:
|
||||
# Tesseract == 3.04.01, hopefully also Tesseract > 3.04.01
|
||||
# Tesseract >= 3.04.01
|
||||
# reports "Orientation in degrees" as a clockwise angle
|
||||
assert 'Rotate' in osd
|
||||
|
||||
@@ -171,8 +166,17 @@ def get_orientation(input_file, language: list, engine_mode, timeout: float,
|
||||
|
||||
|
||||
def tesseract_log_output(log, stdout, input_file):
|
||||
lines = stdout.splitlines()
|
||||
prefix = "{0:4d}: [tesseract] ".format(page_number(input_file))
|
||||
|
||||
try:
|
||||
text = stdout.decode()
|
||||
except UnicodeDecodeError:
|
||||
log.error(prefix + "command line output was not utf-8. " +
|
||||
"This usually means Tesseract's language packs do not match "
|
||||
"the installed version of Tesseract.")
|
||||
text = stdout.decode('utf-8', 'backslashreplace')
|
||||
|
||||
lines = text.splitlines()
|
||||
for line in lines:
|
||||
if line.startswith("Tesseract Open Source"):
|
||||
continue
|
||||
@@ -182,6 +186,14 @@ def tesseract_log_output(log, stdout, input_file):
|
||||
log.warning(prefix + "lots of diacritics - possibly poor OCR")
|
||||
elif line.startswith('OSD: Weak margin'):
|
||||
log.warning(prefix + "unsure about page orientation")
|
||||
elif 'Error in pixScanForForeground' in line:
|
||||
pass # Appears to be spurious/problem with nonwhite borders
|
||||
elif 'Error in boxClipToRectangle' in line:
|
||||
pass # Always appears with pixScanForForeground message
|
||||
elif 'parameter not found: ' in line.lower():
|
||||
log.error(prefix + line.strip())
|
||||
problem = line.split('found: ')[1]
|
||||
raise TesseractConfigError(problem)
|
||||
elif 'error' in line.lower() or 'exception' in line.lower():
|
||||
log.error(prefix + line.strip())
|
||||
elif 'warning' in line.lower():
|
||||
@@ -213,7 +225,8 @@ def _generate_null_hocr(output_hocr, output_sidecar, image):
|
||||
|
||||
def generate_hocr(input_file, output_files, language: list, engine_mode,
|
||||
tessconfig: list,
|
||||
timeout: float, pagesegmode: int, log):
|
||||
timeout: float, pagesegmode: int, user_words, user_patterns,
|
||||
log):
|
||||
|
||||
output_hocr = next(o for o in output_files if o.endswith('.hocr'))
|
||||
output_sidecar = next(o for o in output_files if o.endswith('.txt'))
|
||||
@@ -224,10 +237,17 @@ def generate_hocr(input_file, output_files, language: list, engine_mode,
|
||||
if pagesegmode is not None:
|
||||
args_tesseract.extend([psm(), str(pagesegmode)])
|
||||
|
||||
if user_words:
|
||||
args_tesseract.extend(['--user-words', user_words])
|
||||
|
||||
if user_patterns:
|
||||
args_tesseract.extend(['--user-patterns', user_patterns])
|
||||
|
||||
# Reminder: test suite tesseract spoofers will break after any changes
|
||||
# to the number of order parameters here
|
||||
# Tesseract 3.04 requires the order here to be "hocr txt" and will fail
|
||||
# on "txt hocr"
|
||||
|
||||
args_tesseract.extend([
|
||||
input_file,
|
||||
prefix,
|
||||
@@ -237,8 +257,8 @@ def generate_hocr(input_file, output_files, language: list, engine_mode,
|
||||
try:
|
||||
log.debug(args_tesseract)
|
||||
stdout = check_output(
|
||||
args_tesseract, close_fds=True, stderr=STDOUT,
|
||||
universal_newlines=True, timeout=timeout)
|
||||
args_tesseract, stderr=STDOUT,
|
||||
timeout=timeout)
|
||||
except TimeoutExpired:
|
||||
# Generate a HOCR file with no recognized text if tesseract times out
|
||||
# Temporary workaround to hocrTransform not being able to function if
|
||||
@@ -247,9 +267,7 @@ def generate_hocr(input_file, output_files, language: list, engine_mode,
|
||||
_generate_null_hocr(output_hocr, output_sidecar, input_file)
|
||||
except CalledProcessError as e:
|
||||
tesseract_log_output(log, e.output, input_file)
|
||||
if 'read_params_file: parameter not found' in e.output:
|
||||
raise TesseractConfigError() from e
|
||||
if 'Image too large' in e.output:
|
||||
if b'Image too large' in e.output:
|
||||
_generate_null_hocr(output_hocr, output_sidecar, input_file)
|
||||
return
|
||||
|
||||
@@ -266,26 +284,22 @@ def use_skip_page(text_only, skip_pdf, output_pdf, output_text):
|
||||
with open(output_text, 'w') as f:
|
||||
f.write('[skipped page]')
|
||||
|
||||
if not text_only:
|
||||
if skip_pdf and not text_only:
|
||||
# Substitute a "skipped page"
|
||||
with suppress(FileNotFoundError):
|
||||
os.remove(output_pdf) # In case it was partially created
|
||||
os.symlink(skip_pdf, output_pdf)
|
||||
return
|
||||
|
||||
# For text only we must create a blank page with dimensions identical
|
||||
# to the skip page because this is equivalent to a page with no text
|
||||
|
||||
pdf_in = pypdf.PdfFileReader(skip_pdf)
|
||||
page0 = pdf_in.pages[0]
|
||||
|
||||
# Or normally, just write a 0 byte file to the output to indicate a skip
|
||||
with open(output_pdf, 'wb') as out:
|
||||
pdf_out = pypdf.PdfFileWriter()
|
||||
w, h = page0.mediaBox.getWidth(), page0.mediaBox.getHeight()
|
||||
pdf_out.addBlankPage(w, h)
|
||||
pdf_out.write(out)
|
||||
out.write(b'')
|
||||
|
||||
|
||||
def generate_pdf(*, input_image, skip_pdf, output_pdf, output_text,
|
||||
def generate_pdf(*, input_image, skip_pdf=None, output_pdf, output_text,
|
||||
language: list, engine_mode, text_only: bool,
|
||||
tessconfig: list, timeout: float, pagesegmode: int, log):
|
||||
tessconfig: list, timeout: float, pagesegmode: int,
|
||||
user_words, user_patterns, log):
|
||||
'''Use Tesseract to render a PDF.
|
||||
|
||||
input_image -- image to analyze
|
||||
@@ -305,13 +319,20 @@ def generate_pdf(*, input_image, skip_pdf, output_pdf, output_text,
|
||||
if pagesegmode is not None:
|
||||
args_tesseract.extend([psm(), str(pagesegmode)])
|
||||
|
||||
if text_only:
|
||||
if text_only and has_textonly_pdf():
|
||||
args_tesseract.extend(['-c', 'textonly_pdf=1'])
|
||||
|
||||
if user_words:
|
||||
args_tesseract.extend(['--user-words', user_words])
|
||||
|
||||
if user_patterns:
|
||||
args_tesseract.extend(['--user-patterns', user_patterns])
|
||||
|
||||
prefix = os.path.splitext(output_pdf)[0] # Tesseract appends suffixes
|
||||
|
||||
# Reminder: test suite tesseract spoofers will break after any changes
|
||||
# Reminder: test suite tesseract spoofers might break after any changes
|
||||
# to the number of order parameters here
|
||||
|
||||
args_tesseract.extend([
|
||||
input_image,
|
||||
prefix,
|
||||
@@ -322,8 +343,8 @@ def generate_pdf(*, input_image, skip_pdf, output_pdf, output_text,
|
||||
try:
|
||||
log.debug(args_tesseract)
|
||||
stdout = check_output(
|
||||
args_tesseract, close_fds=True, stderr=STDOUT,
|
||||
universal_newlines=True, timeout=timeout)
|
||||
args_tesseract, stderr=STDOUT,
|
||||
timeout=timeout)
|
||||
if os.path.exists(prefix + '.txt'):
|
||||
shutil.move(prefix + '.txt', output_text)
|
||||
except TimeoutExpired:
|
||||
@@ -331,10 +352,7 @@ def generate_pdf(*, input_image, skip_pdf, output_pdf, output_text,
|
||||
use_skip_page(text_only, skip_pdf, output_pdf, output_text)
|
||||
except CalledProcessError as e:
|
||||
tesseract_log_output(log, e.output, input_image)
|
||||
if 'read_params_file: parameter not found' in e.output:
|
||||
raise TesseractConfigError() from e
|
||||
|
||||
if 'Image too large' in e.output:
|
||||
if b'Image too large' in e.output:
|
||||
use_skip_page(text_only, skip_pdf, output_pdf, output_text)
|
||||
return
|
||||
raise e from e
|
||||
@@ -1,27 +1,30 @@
|
||||
#!/usr/bin/env python3
|
||||
# © 2015 James R. Barlow: github.com/jbarlow83
|
||||
#
|
||||
# This file is part of OCRmyPDF.
|
||||
#
|
||||
# OCRmyPDF is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# OCRmyPDF is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with OCRmyPDF. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# unpaper documentation:
|
||||
# https://github.com/Flameeyes/unpaper/blob/master/doc/basic-concepts.md
|
||||
|
||||
from subprocess import CalledProcessError, STDOUT, check_output, check_call
|
||||
from subprocess import CalledProcessError, STDOUT, check_output
|
||||
from tempfile import NamedTemporaryFile
|
||||
import sys
|
||||
import os
|
||||
from functools import lru_cache
|
||||
from ..exceptions import MissingDependencyError
|
||||
from . import get_program
|
||||
|
||||
|
||||
@lru_cache(maxsize=1)
|
||||
def version():
|
||||
args_unpaper = [
|
||||
get_program('unpaper'),
|
||||
'--version'
|
||||
]
|
||||
version = check_output(
|
||||
args_unpaper, close_fds=True, universal_newlines=True,
|
||||
stderr=STDOUT, timeout=5)
|
||||
return version.strip()
|
||||
from . import get_version
|
||||
|
||||
|
||||
try:
|
||||
@@ -31,9 +34,14 @@ except ImportError:
|
||||
raise
|
||||
|
||||
|
||||
@lru_cache(maxsize=1)
|
||||
def version():
|
||||
return get_version('unpaper')
|
||||
|
||||
|
||||
def run(input_file, output_file, dpi, log, mode_args):
|
||||
args_unpaper = [
|
||||
get_program('unpaper'),
|
||||
'unpaper',
|
||||
'-v',
|
||||
'--dpi', str(dpi)
|
||||
] + mode_args
|
||||
@@ -49,15 +57,15 @@ def run(input_file, output_file, dpi, log, mode_args):
|
||||
else:
|
||||
im = im.convert(mode='RGB')
|
||||
except IOError as e:
|
||||
log.error(
|
||||
"Could not convert image with type " + im.mode)
|
||||
log.error("Could not convert image with type " + im.mode)
|
||||
im.close()
|
||||
raise MissingDependencyError() from e
|
||||
|
||||
try:
|
||||
suffix = SUFFIXES[im.mode]
|
||||
except KeyError:
|
||||
log.error(
|
||||
"Failed to convert image to a supported format.")
|
||||
log.error("Failed to convert image to a supported format.")
|
||||
im.close()
|
||||
raise MissingDependencyError() from e
|
||||
|
||||
with NamedTemporaryFile(suffix=suffix) as input_pnm, \
|
||||
@@ -82,20 +90,9 @@ def run(input_file, output_file, dpi, log, mode_args):
|
||||
Image.open(output_pnm.name).save(output_file, dpi=(dpi, dpi))
|
||||
|
||||
|
||||
def deskew(input_file, output_file, dpi, log):
|
||||
run(input_file, output_file, dpi, log, [
|
||||
'--mask-scan-size', '100', # don't blank out narrow columns
|
||||
'--no-border-align', # don't align visible content to borders
|
||||
'--no-mask-center', # don't center visible content within page
|
||||
'--no-grayfilter', # don't remove light gray areas
|
||||
'--no-blackfilter', # don't remove solid black areas
|
||||
'--no-noisefilter', # don't remove salt and pepper noise
|
||||
'--no-blurfilter' # don't remove blurry objects/debris
|
||||
])
|
||||
|
||||
|
||||
def clean(input_file, output_file, dpi, log):
|
||||
run(input_file, output_file, dpi, log, [
|
||||
'--layout', 'none',
|
||||
'--mask-scan-size', '100', # don't blank out narrow columns
|
||||
'--no-border-align', # don't align visible content to borders
|
||||
'--no-mask-center', # don't center visible content within page
|
||||
@@ -0,0 +1,170 @@
|
||||
# © 2016 James R. Barlow: github.com/jbarlow83
|
||||
#
|
||||
# This file is part of OCRmyPDF.
|
||||
#
|
||||
# OCRmyPDF is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# OCRmyPDF is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with OCRmyPDF. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from functools import partial
|
||||
from collections.abc import Iterable
|
||||
from contextlib import suppress
|
||||
from pathlib import Path
|
||||
import sys
|
||||
import os
|
||||
import multiprocessing
|
||||
import warnings
|
||||
|
||||
|
||||
def re_symlink(input_file, soft_link_name, log=None):
|
||||
"""
|
||||
Helper function: relinks soft symbolic link if necessary
|
||||
"""
|
||||
input_file = fspath(input_file) # For Py3.5
|
||||
soft_link_name = fspath(soft_link_name)
|
||||
if log is None:
|
||||
prdebug = partial(print, file=sys.stderr)
|
||||
else:
|
||||
prdebug = log.debug
|
||||
|
||||
# Guard against soft linking to oneself
|
||||
if input_file == soft_link_name:
|
||||
prdebug("Warning: No symbolic link made. You are using " +
|
||||
"the original data directory as the working directory.")
|
||||
return
|
||||
|
||||
# Soft link already exists: delete for relink?
|
||||
if os.path.lexists(soft_link_name):
|
||||
# do not delete or overwrite real (non-soft link) file
|
||||
if not os.path.islink(soft_link_name):
|
||||
raise FileExistsError(
|
||||
"%s exists and is not a link" % soft_link_name)
|
||||
try:
|
||||
os.unlink(soft_link_name)
|
||||
except OSError:
|
||||
prdebug("Can't unlink %s" % (soft_link_name))
|
||||
|
||||
if not os.path.exists(input_file):
|
||||
raise FileNotFoundError(
|
||||
"trying to create a broken symlink to %s" % input_file)
|
||||
|
||||
prdebug("os.symlink(%s, %s)" % (input_file, soft_link_name))
|
||||
|
||||
# Create symbolic link using absolute path
|
||||
os.symlink(
|
||||
os.path.abspath(input_file),
|
||||
soft_link_name
|
||||
)
|
||||
|
||||
|
||||
def is_iterable_notstr(thing):
|
||||
return isinstance(thing, Iterable) and not isinstance(thing, str)
|
||||
|
||||
|
||||
def page_number(input_file):
|
||||
"""Get one-based page number implied by filename (000002.pdf -> 2)"""
|
||||
return int(os.path.basename(fspath(input_file))[0:6])
|
||||
|
||||
|
||||
def available_cpu_count():
|
||||
try:
|
||||
return multiprocessing.cpu_count()
|
||||
except NotImplementedError:
|
||||
pass
|
||||
|
||||
try:
|
||||
import psutil
|
||||
return psutil.cpu_count()
|
||||
except (ImportError, AttributeError):
|
||||
pass
|
||||
|
||||
warnings.warn(
|
||||
"Could not get CPU count. Assuming one (1) CPU."
|
||||
"Use -j N to set manually.")
|
||||
return 1
|
||||
|
||||
|
||||
def is_file_writable(test_file):
|
||||
"""Intentionally racy test if target is writable.
|
||||
|
||||
We intend to write to the output file if and only if we succeed and
|
||||
can replace it atomically. Before doing the OCR work, make sure
|
||||
the location is writable.
|
||||
"""
|
||||
p = Path(test_file)
|
||||
|
||||
if p.is_symlink():
|
||||
# Python 3.5 does not accept parameters for Path.resolve() and behaves
|
||||
# as if strict=True (throws an exception on failure). Python 3.6
|
||||
# defaults to strict=False. This implements strict=False like behavior
|
||||
# for Python 3.5.
|
||||
if sys.version_info[0:2] <= (3, 5):
|
||||
p = Path(os.path.realpath(fspath(p)))
|
||||
else:
|
||||
p = p.resolve(strict=False)
|
||||
|
||||
# p.is_file() throws an exception in some cases
|
||||
if p.exists() and p.is_file():
|
||||
return os.access(
|
||||
fspath(p), os.W_OK,
|
||||
effective_ids=(os.access in os.supports_effective_ids))
|
||||
else:
|
||||
try:
|
||||
fp = p.open('wb')
|
||||
except OSError:
|
||||
return False
|
||||
else:
|
||||
fp.close()
|
||||
with suppress(OSError):
|
||||
p.unlink()
|
||||
return True
|
||||
|
||||
|
||||
if sys.version_info[0:2] <= (3, 5):
|
||||
def fspath(path):
|
||||
"""https://www.python.org/dev/peps/pep-0519/#os"""
|
||||
import pathlib
|
||||
if isinstance(path, (str, bytes)):
|
||||
return path
|
||||
|
||||
# Work from the object's type to match method resolution of other magic
|
||||
# methods.
|
||||
path_type = type(path)
|
||||
try:
|
||||
path = path_type.__fspath__(path)
|
||||
except AttributeError:
|
||||
# Added for Python 3.5 support.
|
||||
if isinstance(path, pathlib.Path):
|
||||
return str(path)
|
||||
elif hasattr(path_type, '__fspath__'):
|
||||
raise
|
||||
else:
|
||||
if isinstance(path, (str, bytes)):
|
||||
return path
|
||||
else:
|
||||
raise TypeError("expected __fspath__() to return str or bytes, "
|
||||
"not " + type(path).__name__)
|
||||
|
||||
raise TypeError(
|
||||
"expected str, bytes, pathlib.Path or os.PathLike object, not "
|
||||
+ path_type.__name__)
|
||||
|
||||
else:
|
||||
fspath = os.fspath
|
||||
|
||||
|
||||
def flatten_groups(groups):
|
||||
for obj in groups:
|
||||
if is_iterable_notstr(obj):
|
||||
yield from obj
|
||||
else:
|
||||
yield obj
|
||||
Executable
+349
@@ -0,0 +1,349 @@
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# Copyright (c) 2010, Jonathan Brinley
|
||||
# Original version from: https://github.com/jbrinley/HocrConverter
|
||||
#
|
||||
# Copyright (c) 2013-14, Julien Pfefferkorn
|
||||
# Modifications
|
||||
#
|
||||
# Copyright (c) 2015-16, James R. Barlow
|
||||
# Set text to transparent
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a
|
||||
# copy of this software and associated documentation files (the
|
||||
# "Software"), to deal in the Software without restriction, including
|
||||
# without limitation the rights to use, copy, modify, merge, publish,
|
||||
# distribute, sublicense, and/or sell copies of the Software, and to
|
||||
# permit persons to whom the Software is furnished to do so, subject to
|
||||
# the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included
|
||||
# in all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
from reportlab.pdfgen.canvas import Canvas
|
||||
from reportlab.lib.units import inch
|
||||
from xml.etree import ElementTree
|
||||
from collections import namedtuple
|
||||
from math import atan, sin, cos
|
||||
import re
|
||||
import argparse
|
||||
|
||||
|
||||
Rect = namedtuple('Rect', ['x1', 'y1', 'x2', 'y2'])
|
||||
|
||||
|
||||
class HocrTransformError(Exception):
|
||||
pass
|
||||
|
||||
|
||||
class HocrTransform():
|
||||
|
||||
"""
|
||||
A class for converting documents from the hOCR format.
|
||||
For details of the hOCR format, see:
|
||||
http://kba.cloud/hocr-spec/
|
||||
"""
|
||||
|
||||
box_pattern = re.compile(r'bbox((\s+\d+){4})')
|
||||
baseline_pattern = re.compile(r'''
|
||||
baseline \s+
|
||||
([\-\+]?\d*\.?\d*) \s+ # +/- decimal float
|
||||
([\-\+]?\d+) # +/- int''', re.VERBOSE)
|
||||
ligatures = str.maketrans({
|
||||
'ff': 'ff',
|
||||
'ffi': 'ffi',
|
||||
'ffl': 'ffl',
|
||||
'fi': 'fi',
|
||||
'fl': 'fl',
|
||||
})
|
||||
|
||||
def __init__(self, hocrFileName, dpi):
|
||||
self.dpi = dpi
|
||||
self.hocr = ElementTree.parse(hocrFileName)
|
||||
|
||||
# if the hOCR file has a namespace, ElementTree requires its use to
|
||||
# find elements
|
||||
matches = re.match(r'({.*})html', self.hocr.getroot().tag)
|
||||
self.xmlns = ''
|
||||
if matches:
|
||||
self.xmlns = matches.group(1)
|
||||
|
||||
# get dimension in pt (not pixel!!!!) of the OCRed image
|
||||
self.width, self.height = None, None
|
||||
for div in self.hocr.findall(
|
||||
".//%sdiv[@class='ocr_page']" % (self.xmlns)):
|
||||
coords = self.element_coordinates(div)
|
||||
pt_coords = self.pt_from_pixel(coords)
|
||||
self.width = pt_coords.x2 - pt_coords.x1
|
||||
self.height = pt_coords.y2 - pt_coords.y1
|
||||
# there shouldn't be more than one, and if there is, we don't want
|
||||
# it
|
||||
break
|
||||
if self.width is None or self.height is None:
|
||||
raise HocrTransformError("hocr file is missing page dimensions")
|
||||
|
||||
def __str__(self):
|
||||
"""
|
||||
Return the textual content of the HTML body
|
||||
"""
|
||||
if self.hocr is None:
|
||||
return ''
|
||||
body = self.hocr.find(".//%sbody" % (self.xmlns))
|
||||
if body:
|
||||
return self._get_element_text(body)
|
||||
else:
|
||||
return ''
|
||||
|
||||
def _get_element_text(self, element):
|
||||
"""
|
||||
Return the textual content of the element and its children
|
||||
"""
|
||||
text = ''
|
||||
if element.text is not None:
|
||||
text += element.text
|
||||
for child in element.getchildren():
|
||||
text += self._get_element_text(child)
|
||||
if element.tail is not None:
|
||||
text += element.tail
|
||||
return text
|
||||
|
||||
@classmethod
|
||||
def element_coordinates(cls, element):
|
||||
"""
|
||||
Returns a tuple containing the coordinates of the bounding box around
|
||||
an element
|
||||
"""
|
||||
out = (0, 0, 0, 0)
|
||||
if 'title' in element.attrib:
|
||||
matches = cls.box_pattern.search(element.attrib['title'])
|
||||
if matches:
|
||||
coords = matches.group(1).split()
|
||||
out = Rect._make(int(coords[n]) for n in range(4))
|
||||
return out
|
||||
|
||||
@classmethod
|
||||
def baseline(cls, element):
|
||||
"""
|
||||
Returns a tuple containing the baseline slope and intercept.
|
||||
"""
|
||||
if 'title' in element.attrib:
|
||||
matches = cls.baseline_pattern.search(element.attrib['title'])
|
||||
if matches:
|
||||
return float(matches.group(1)), int(matches.group(2))
|
||||
return (0, 0)
|
||||
|
||||
def pt_from_pixel(self, pxl):
|
||||
"""
|
||||
Returns the quantity in PDF units (pt) given quantity in pixels
|
||||
"""
|
||||
return Rect._make(
|
||||
(c / self.dpi * inch) for c in pxl)
|
||||
|
||||
@classmethod
|
||||
def replace_unsupported_chars(cls, s):
|
||||
"""
|
||||
Given an input string, returns the corresponding string that:
|
||||
- is available in the helvetica facetype
|
||||
- does not contain any ligature (to allow easy search in the PDF file)
|
||||
"""
|
||||
return s.translate(cls.ligatures)
|
||||
|
||||
def to_pdf(self, outFileName, imageFileName=None, showBoundingboxes=False,
|
||||
fontname="Helvetica", invisibleText=False, interwordSpaces=False):
|
||||
"""
|
||||
Creates a PDF file with an image superimposed on top of the text.
|
||||
Text is positioned according to the bounding box of the lines in
|
||||
the hOCR file.
|
||||
The image need not be identical to the image used to create the hOCR
|
||||
file.
|
||||
It can have a lower resolution, different color mode, etc.
|
||||
"""
|
||||
# create the PDF file
|
||||
# page size in points (1/72 in.)
|
||||
pdf = Canvas(
|
||||
outFileName, pagesize=(self.width, self.height), pageCompression=1)
|
||||
|
||||
# draw bounding box for each paragraph
|
||||
# light blue for bounding box of paragraph
|
||||
pdf.setStrokeColorRGB(0, 1, 1)
|
||||
# light blue for bounding box of paragraph
|
||||
pdf.setFillColorRGB(0, 1, 1)
|
||||
pdf.setLineWidth(0) # no line for bounding box
|
||||
for elem in self.hocr.findall(
|
||||
".//%sp[@class='%s']" % (self.xmlns, "ocr_par")):
|
||||
|
||||
elemtxt = self._get_element_text(elem).rstrip()
|
||||
if len(elemtxt) == 0:
|
||||
continue
|
||||
|
||||
pxl_coords = self.element_coordinates(elem)
|
||||
pt = self.pt_from_pixel(pxl_coords)
|
||||
|
||||
# draw the bbox border
|
||||
if showBoundingboxes:
|
||||
pdf.rect(
|
||||
pt.x1, self.height - pt.y2, pt.x2 - pt.x1, pt.y2 - pt.y1,
|
||||
fill=1)
|
||||
|
||||
found_lines = False
|
||||
for line in self.hocr.findall(
|
||||
".//%sspan[@class='%s']" % (self.xmlns, "ocr_line")):
|
||||
found_lines = True
|
||||
self._do_line(pdf, line, "ocrx_word", fontname, invisibleText,
|
||||
interwordSpaces, showBoundingboxes)
|
||||
|
||||
if not found_lines:
|
||||
# Tesseract did not report any lines (just words)
|
||||
root = self.hocr.find(".//%sdiv[@class='%s']" % (self.xmlns, "ocr_page"))
|
||||
self._do_line(pdf, root, "ocrx_word", fontname, invisibleText,
|
||||
interwordSpaces, showBoundingboxes)
|
||||
# put the image on the page, scaled to fill the page
|
||||
if imageFileName is not None:
|
||||
pdf.drawImage(imageFileName, 0, 0,
|
||||
width=self.width, height=self.height)
|
||||
|
||||
# finish up the page and save it
|
||||
pdf.showPage()
|
||||
pdf.save()
|
||||
|
||||
|
||||
@classmethod
|
||||
def polyval(cls, poly, x):
|
||||
return x * poly[0] + poly[1]
|
||||
|
||||
|
||||
def _do_line(self, pdf, line, elemclass, fontname, invisibleText,
|
||||
interwordSpaces, showBoundingboxes):
|
||||
pxl_line_coords = self.element_coordinates(line)
|
||||
line_box = self.pt_from_pixel(pxl_line_coords)
|
||||
line_height = line_box.y2 - line_box.y1
|
||||
|
||||
slope, pxl_intercept = self.baseline(line)
|
||||
if abs(slope) < 0.005:
|
||||
slope = 0.0
|
||||
angle = atan(slope)
|
||||
cos_a, sin_a = cos(angle), sin(angle)
|
||||
|
||||
text = pdf.beginText()
|
||||
intercept = pxl_intercept / self.dpi * inch
|
||||
|
||||
# Don't allow the font to break out of the bounding box. Division by
|
||||
# cos_a accounts for extra clearance between the glyph's vertical axis
|
||||
# on a sloped baseline and the edge of the bounding box.
|
||||
fontsize = (line_height - abs(intercept)) / cos_a
|
||||
text.setFont(fontname, fontsize)
|
||||
if invisibleText:
|
||||
text.setTextRenderMode(3) # Invisible (indicates OCR text)
|
||||
|
||||
# Intercept is normally negative, so this places it above the bottom
|
||||
# of the line box
|
||||
baseline_y2 = self.height - (line_box.y2 + intercept)
|
||||
|
||||
if showBoundingboxes:
|
||||
# draw the baseline in magenta, dashed
|
||||
pdf.setDash()
|
||||
pdf.setStrokeColorRGB(0.95, 0.65, 0.95)
|
||||
pdf.setLineWidth(0.5)
|
||||
# negate slope because it is defined as a rise/run in pixel
|
||||
# coordinates and page coordinates have the y axis flipped
|
||||
pdf.line(line_box.x1,
|
||||
baseline_y2,
|
||||
line_box.x2,
|
||||
self.polyval((-slope, baseline_y2),
|
||||
line_box.x2 - line_box.x1))
|
||||
# light green for bounding box of word/line
|
||||
pdf.setDash(6, 3)
|
||||
pdf.setStrokeColorRGB(1, 0, 0)
|
||||
|
||||
text.setTextTransform(
|
||||
cos_a, -sin_a, sin_a, cos_a,
|
||||
line_box.x1, baseline_y2
|
||||
)
|
||||
pdf.setFillColorRGB(0, 0, 0) # text in black
|
||||
|
||||
elements = line.findall(
|
||||
".//%sspan[@class='%s']" % (self.xmlns, elemclass))
|
||||
for elem in elements:
|
||||
elemtxt = self._get_element_text(elem).strip()
|
||||
elemtxt = self.replace_unsupported_chars(elemtxt)
|
||||
if elemtxt == '':
|
||||
continue
|
||||
|
||||
pxl_coords = self.element_coordinates(elem)
|
||||
box = self.pt_from_pixel(pxl_coords)
|
||||
if interwordSpaces:
|
||||
# if `--interword-spaces` is true, append a space
|
||||
# to the end of each text element to allow simpler PDF viewers
|
||||
# such as PDF.js to better recognize words in search and copy
|
||||
# and paste. Do not remove space from last word in line, even
|
||||
# though it would look better, because it will interfere with
|
||||
# naive text extraction. \n does not work either.
|
||||
elemtxt += ' '
|
||||
box = Rect._make((
|
||||
box.x1,
|
||||
line_box.y1,
|
||||
box.x2 + pdf.stringWidth(' ', fontname, line_height),
|
||||
line_box.y2))
|
||||
box_width = box.x2 - box.x1
|
||||
font_width = pdf.stringWidth(elemtxt, fontname, fontsize)
|
||||
|
||||
# draw the bbox border
|
||||
if showBoundingboxes:
|
||||
pdf.rect(
|
||||
box.x1,
|
||||
self.height - line_box.y2,
|
||||
box_width,
|
||||
line_height,
|
||||
fill=0)
|
||||
|
||||
# Adjust relative position of cursor
|
||||
# This is equivalent to:
|
||||
# text.setTextOrigin(pt.x1, self.height - line_box.y2)
|
||||
# but the former generates a full text reposition matrix (Tm) in the
|
||||
# content stream while this issues a "offset" (Td) command.
|
||||
# .moveCursor() is relative to start of the text line, where the
|
||||
# "text line" means whatever reportlab defines it as. Do not use
|
||||
# use .getCursor(), since moveCursor() rather unintuitively plans
|
||||
# its moves relative to .getStartOfLine().
|
||||
# For skewed lines, in the text transform we set up a rotated
|
||||
# coordinate system, so we don't have to account for the
|
||||
# incremental offset. Surprisingly most PDF viewers can handle this.
|
||||
cursor = text.getStartOfLine()
|
||||
dx = box.x1 - cursor[0]
|
||||
dy = baseline_y2 - cursor[1]
|
||||
text.moveCursor(dx, dy)
|
||||
|
||||
# If reportlab tells us this word is 0 units wide, our best seems
|
||||
# to be to suppress this text
|
||||
if font_width > 0:
|
||||
text.setHorizScale(100 * box_width / font_width)
|
||||
text.textOut(elemtxt)
|
||||
pdf.drawText(text)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser(description='Convert hocr file to PDF')
|
||||
parser.add_argument('-b', '--boundingboxes', action="store_true",
|
||||
default=False, help='Show bounding boxes borders')
|
||||
parser.add_argument('-r', '--resolution', type=int,
|
||||
default=300,
|
||||
help='Resolution of the image that was OCRed')
|
||||
parser.add_argument('-i', '--image', default=None,
|
||||
help='Path to the image to be placed above the text')
|
||||
parser.add_argument('--interword-spaces', action='store_true',
|
||||
default=False, help='Add spaces between words')
|
||||
parser.add_argument('hocrfile', help='Path to the hocr file to be parsed')
|
||||
parser.add_argument(
|
||||
'outputfile', help='Path to the PDF file to be generated')
|
||||
args = parser.parse_args()
|
||||
|
||||
hocr = HocrTransform(args.hocrfile, args.resolution)
|
||||
hocr.to_pdf(args.outputfile, args.image, args.boundingboxes, interwordSpaces=args.interword_spaces)
|
||||
@@ -3,17 +3,36 @@
|
||||
#
|
||||
# © 2013-16: jbarlow83 from Github (https://github.com/jbarlow83)
|
||||
#
|
||||
# This file is part of OCRmyPDF.
|
||||
#
|
||||
# OCRmyPDF is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# OCRmyPDF is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with OCRmyPDF. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# Python FFI wrapper for Leptonica library
|
||||
|
||||
import argparse
|
||||
import sys
|
||||
import os
|
||||
import logging
|
||||
import warnings
|
||||
from tempfile import TemporaryFile
|
||||
from ctypes.util import find_library
|
||||
from .lib._leptonica import ffi
|
||||
from functools import lru_cache
|
||||
from enum import Enum
|
||||
|
||||
from .lib._leptonica import ffi
|
||||
from .helpers import fspath
|
||||
|
||||
# pylint: disable=protected-access
|
||||
|
||||
lept = ffi.dlopen(find_library('lept'))
|
||||
|
||||
@@ -21,24 +40,29 @@ logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def stderr(*objs):
|
||||
"""Python 2/3 compatible print to stderr.
|
||||
"""
|
||||
"""Shorthand print to stderr."""
|
||||
print("leptonica.py:", *objs, file=sys.stderr)
|
||||
|
||||
|
||||
class LeptonicaErrorTrap(object):
|
||||
"""Context manager to trap errors reported by Leptonica.
|
||||
class _LeptonicaErrorTrap:
|
||||
"""
|
||||
Context manager to trap errors reported by Leptonica.
|
||||
|
||||
Leptonica's error return codes are unreliable to the point of being
|
||||
almost useless. It does, however, write errors to stderr provided that is
|
||||
not disabled at its compile time. Fortunately this is done using error
|
||||
macros so it is very self-consistent.
|
||||
Leptonica's error return codes don't provide much informatino about what
|
||||
went wrong. Leptonica does, however, write more detailed errors to stderr
|
||||
(provided this is not disabled at compile time). The Leptonica source
|
||||
code is very consistent in its use of macros to generate errors.
|
||||
|
||||
This context manager redirects stderr to a temporary file which is then
|
||||
read and parsed for error messages. As a side benefit, debug messages
|
||||
from Leptonica are also suppressed.
|
||||
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
self.tmpfile = None
|
||||
self.copy_of_stderr = -1
|
||||
|
||||
def __enter__(self):
|
||||
from io import UnsupportedOperation
|
||||
self.tmpfile = TemporaryFile()
|
||||
@@ -92,15 +116,9 @@ class LeptonicaIOError(LeptonicaError):
|
||||
pass
|
||||
|
||||
|
||||
class RemoveColormap(Enum):
|
||||
to_binary = 0
|
||||
to_grayscale = 1
|
||||
to_full_color = 2
|
||||
based_on_src = 3
|
||||
|
||||
|
||||
class Pix:
|
||||
"""Wrapper around leptonica's PIX object.
|
||||
"""
|
||||
Wrapper around leptonica's PIX object.
|
||||
|
||||
Leptonica uses referencing counting on PIX objects. Also, many Leptonica
|
||||
functions return the original object with an increased reference count
|
||||
@@ -116,7 +134,7 @@ class Pix:
|
||||
This class treats Pix objects as immutable. All methods return new
|
||||
modified objects. This allows convenient chaining:
|
||||
|
||||
>>> Pix.read('filename.jpg').scale((0.5, 0.5)).deskew().show()
|
||||
>>> Pix.open('filename.jpg').scale((0.5, 0.5)).deskew().show()
|
||||
|
||||
"""
|
||||
|
||||
@@ -125,9 +143,10 @@ class Pix:
|
||||
|
||||
def __repr__(self):
|
||||
if self._pix:
|
||||
s = "<leptonica.Pix image size={0}x{1} depth={2} at 0x{3:x}>"
|
||||
s = "<leptonica.Pix image size={0}x{1} depth={2}{4} at 0x{3:x}>"
|
||||
return s.format(self._pix.w, self._pix.h, self._pix.d,
|
||||
int(ffi.cast("intptr_t", self._pix)))
|
||||
int(ffi.cast('intptr_t', self._pix)),
|
||||
'(colormapped)' if self._pix.colormap else '')
|
||||
else:
|
||||
return "<leptonica.Pix image NULL>"
|
||||
|
||||
@@ -208,26 +227,32 @@ class Pix:
|
||||
return 'P'
|
||||
|
||||
@classmethod
|
||||
def read(cls, filename):
|
||||
def read(cls, path):
|
||||
warnings.warn('Use Pix.open() instead', DeprecationWarning)
|
||||
return cls.open(path)
|
||||
|
||||
@classmethod
|
||||
def open(cls, path):
|
||||
"""Load an image file into a PIX object.
|
||||
|
||||
Leptonica can load TIFF, PNM (PBM, PGM, PPM), PNG, and JPEG. If
|
||||
loading fails then the object will wrap a C null pointer.
|
||||
"""
|
||||
with LeptonicaErrorTrap():
|
||||
return cls(lept.pixRead(
|
||||
filename.encode(sys.getfilesystemencoding())))
|
||||
filename = fspath(path)
|
||||
with _LeptonicaErrorTrap():
|
||||
return cls(lept.pixRead(os.fsencode(filename)))
|
||||
|
||||
def write_implied_format(
|
||||
self, filename, jpeg_quality=0, jpeg_progressive=0):
|
||||
self, path, jpeg_quality=0, jpeg_progressive=0):
|
||||
"""Write pix to the filename, with the extension indicating format.
|
||||
|
||||
jpeg_quality -- quality (iff JPEG; 1 - 100, 0 for default)
|
||||
jpeg_progressive -- (iff JPEG; 0 for baseline seq., 1 for progressive)
|
||||
"""
|
||||
with LeptonicaErrorTrap():
|
||||
filename = fspath(path)
|
||||
with _LeptonicaErrorTrap():
|
||||
lept.pixWriteImpliedFormat(
|
||||
filename.encode(sys.getfilesystemencoding()),
|
||||
os.fsencode(filename),
|
||||
self._pix, jpeg_quality, jpeg_progressive)
|
||||
|
||||
def topil(self):
|
||||
@@ -272,21 +297,21 @@ class Pix:
|
||||
reduction_factor -- amount to downsample (0 for default) when searching
|
||||
for skew angle
|
||||
"""
|
||||
with LeptonicaErrorTrap():
|
||||
with _LeptonicaErrorTrap():
|
||||
return Pix(lept.pixDeskew(self._pix, reduction_factor))
|
||||
|
||||
def scale(self, scale_xy):
|
||||
"Returns the pix object rescaled according to the proportions given."
|
||||
with LeptonicaErrorTrap():
|
||||
with _LeptonicaErrorTrap():
|
||||
return Pix(lept.pixScale(self._pix, scale_xy[0], scale_xy[1]))
|
||||
|
||||
def rotate180(self):
|
||||
with LeptonicaErrorTrap():
|
||||
with _LeptonicaErrorTrap():
|
||||
return Pix(lept.pixRotate180(ffi.NULL, self._pix))
|
||||
|
||||
def rotate_orth(self, quads):
|
||||
"Orthographic rotation, quads: 0-3, number of clockwise rotations"
|
||||
with LeptonicaErrorTrap():
|
||||
with _LeptonicaErrorTrap():
|
||||
return Pix(lept.pixRotateOrth(self._pix, quads))
|
||||
|
||||
def find_skew(self):
|
||||
@@ -294,7 +319,7 @@ class Pix:
|
||||
|
||||
Returns (None, None) if no angle is available.
|
||||
"""
|
||||
with LeptonicaErrorTrap():
|
||||
with _LeptonicaErrorTrap():
|
||||
angle = ffi.new('float *', 0.0)
|
||||
confidence = ffi.new('float *', 0.0)
|
||||
result = lept.pixFindSkew(self._pix, angle, confidence)
|
||||
@@ -304,24 +329,26 @@ class Pix:
|
||||
return (None, None)
|
||||
|
||||
def convert_rgb_to_luminance(self):
|
||||
with LeptonicaErrorTrap():
|
||||
with _LeptonicaErrorTrap():
|
||||
gray_pix = lept.pixConvertRGBToLuminance(self._pix)
|
||||
if gray_pix:
|
||||
return Pix(gray_pix)
|
||||
return None
|
||||
|
||||
def remove_colormap(self, removal_type):
|
||||
"""Remove a palette
|
||||
"""Remove a palette (colormap); if no colormap, returns a copy of this
|
||||
image
|
||||
|
||||
removal_type - any of lept.REMOVE_CMAP_*
|
||||
|
||||
removal_type - RemovalColormap()
|
||||
"""
|
||||
|
||||
with LeptonicaErrorTrap():
|
||||
return Pix(lept.pixRemoveColormap(self._pix, removal_type))
|
||||
with _LeptonicaErrorTrap():
|
||||
return Pix(lept.pixRemoveColormapGeneral(
|
||||
self._pix, removal_type, lept.L_COPY))
|
||||
|
||||
def otsu_adaptive_threshold(
|
||||
self, tile_size=(300, 300), kernel_size=(4, 4), scorefract=0.1):
|
||||
with LeptonicaErrorTrap():
|
||||
with _LeptonicaErrorTrap():
|
||||
sx, sy = tile_size
|
||||
smoothx, smoothy = kernel_size
|
||||
p_pix = ffi.new('PIX **')
|
||||
@@ -341,7 +368,7 @@ class Pix:
|
||||
def otsu_threshold_on_background_norm(
|
||||
self, mask=None, tile_size=(10, 15), thresh=100, mincount=50,
|
||||
bgval=255, kernel_size=(2, 2), scorefract=0.1):
|
||||
with LeptonicaErrorTrap():
|
||||
with _LeptonicaErrorTrap():
|
||||
sx, sy = tile_size
|
||||
smoothx, smoothy = kernel_size
|
||||
if mask is None:
|
||||
@@ -365,7 +392,7 @@ class Pix:
|
||||
def crop_to_foreground(
|
||||
self, threshold=128, mindist=70, erasedist=30, pagenum=0,
|
||||
showmorph=0, display=0, pdfdir=ffi.NULL):
|
||||
with LeptonicaErrorTrap():
|
||||
with _LeptonicaErrorTrap():
|
||||
cropbox = Box(lept.pixFindPageForeground(
|
||||
self._pix,
|
||||
threshold,
|
||||
@@ -387,7 +414,7 @@ class Pix:
|
||||
|
||||
def clean_background_to_white(
|
||||
self, mask=None, grayscale=None, gamma=1.0, black=0, white=255):
|
||||
with LeptonicaErrorTrap():
|
||||
with _LeptonicaErrorTrap():
|
||||
return Pix(lept.pixCleanBackgroundToWhite(
|
||||
self._pix,
|
||||
mask or ffi.NULL,
|
||||
@@ -397,7 +424,7 @@ class Pix:
|
||||
white))
|
||||
|
||||
def gamma_trc(self, gamma=1.0, minval=0, maxval=255):
|
||||
with LeptonicaErrorTrap():
|
||||
with _LeptonicaErrorTrap():
|
||||
return Pix(lept.pixGammaTRC(
|
||||
ffi.NULL,
|
||||
self._pix,
|
||||
@@ -409,9 +436,11 @@ class Pix:
|
||||
def background_norm(
|
||||
self, mask=None, grayscale=None, tile_size=(10, 15), fg_threshold=60,
|
||||
min_count=40, bg_val=200, smooth_kernel=(2, 1)):
|
||||
with LeptonicaErrorTrap():
|
||||
# Background norm doesn't work on color mapped Pix, so remove colormap
|
||||
target_pix = self.remove_colormap(lept.REMOVE_CMAP_BASED_ON_SRC)
|
||||
with _LeptonicaErrorTrap():
|
||||
return Pix(lept.pixBackgroundNorm(
|
||||
self._pix,
|
||||
target_pix._pix,
|
||||
mask or ffi.NULL,
|
||||
grayscale or ffi.NULL,
|
||||
tile_size[0],
|
||||
@@ -421,7 +450,7 @@ class Pix:
|
||||
bg_val,
|
||||
smooth_kernel[0],
|
||||
smooth_kernel[1]
|
||||
))
|
||||
))
|
||||
|
||||
@staticmethod
|
||||
@lru_cache(maxsize=1)
|
||||
@@ -433,8 +462,8 @@ class Pix:
|
||||
if get_leptonica_version() < 'leptonica-1.72':
|
||||
# Older versions of Leptonica (pre-1.72) have a buggy
|
||||
# implementation of pixCorrelationBinary that overflows on larger
|
||||
# images. Ubuntu trusty has 1.70. Ubuntu PPA
|
||||
# ppa:rebuntu16/avidemux+unofficial has "leptonlib" 1.73.
|
||||
# images. Ubuntu 14.04/trusty has 1.70. Ubuntu PPA
|
||||
# ppa:alex-p/tesseract-ocr has leptonlib 1.75.
|
||||
pix1_count = ffi.new('l_int32 *')
|
||||
pix2_count = ffi.new('l_int32 *')
|
||||
pixn_count = ffi.new('l_int32 *')
|
||||
@@ -460,6 +489,18 @@ class Pix:
|
||||
raise LeptonicaError("Correlation failed")
|
||||
return correlation[0]
|
||||
|
||||
def generate_pdf_ci_data(self, type_, quality):
|
||||
"Convert to PDF data, with transcoding"
|
||||
p_compdata = ffi.new('L_COMP_DATA **')
|
||||
result = lept.pixGenerateCIData(self._pix, type_, quality, 0,
|
||||
p_compdata)
|
||||
if result != 0:
|
||||
raise LeptonicaError("Generate PDF data failed")
|
||||
return CompressedData(p_compdata[0])
|
||||
|
||||
def invert(self):
|
||||
return Pix(lept.pixInvert(ffi.NULL, self._pix))
|
||||
|
||||
@staticmethod
|
||||
def _pix_destroy(pix):
|
||||
p_pix = ffi.new('PIX **', pix)
|
||||
@@ -467,6 +508,46 @@ class Pix:
|
||||
# print('pix destroy ' + repr(pix))
|
||||
|
||||
|
||||
class CompressedData:
|
||||
def __init__(self, compdata):
|
||||
self._compdata = ffi.gc(compdata, CompressedData._destroy)
|
||||
|
||||
@classmethod
|
||||
def open(cls, path, jpeg_quality=75):
|
||||
"Open compressed data, without transcoding"
|
||||
filename = fspath(path)
|
||||
|
||||
p_compdata = ffi.new('L_COMP_DATA **')
|
||||
result = lept.l_generateCIDataForPdf(
|
||||
os.fsencode(filename), ffi.NULL, jpeg_quality, p_compdata)
|
||||
if result != 0:
|
||||
raise LeptonicaError("CompressedData.open")
|
||||
return CompressedData(p_compdata[0])
|
||||
|
||||
def __len__(self):
|
||||
return self._compdata.nbytescomp
|
||||
|
||||
def read(self):
|
||||
buf = ffi.buffer(self._compdata.datacomp, self._compdata.nbytescomp)
|
||||
return bytes(buf)
|
||||
|
||||
def __getattr__(self, name):
|
||||
if hasattr(self._compdata, name):
|
||||
return getattr(self._compdata, name)
|
||||
raise AttributeError(name)
|
||||
|
||||
def get_palette_pdf_string(self):
|
||||
"Returns palette pre-formatted for use in PDF"
|
||||
buflen = len('< ') + len(' rrggbb') * self._compdata.ncolors + len('>')
|
||||
buf = ffi.buffer(self._compdata.cmapdatahex, buflen)
|
||||
return bytes(buf)
|
||||
|
||||
@staticmethod
|
||||
def _destroy(compdata):
|
||||
pp = ffi.new('L_COMP_DATA **', compdata)
|
||||
lept.l_CIDataDestroy(pp)
|
||||
|
||||
|
||||
class Box:
|
||||
"""Wrapper around Leptonica's BOX objects.
|
||||
|
||||
@@ -517,7 +598,7 @@ def get_leptonica_version():
|
||||
|
||||
def deskew(infile, outfile, dpi):
|
||||
try:
|
||||
pix_source = Pix.read(infile)
|
||||
pix_source = Pix.open(infile)
|
||||
except LeptonicaIOError:
|
||||
raise LeptonicaIOError("Failed to open file: %s" % infile)
|
||||
|
||||
@@ -536,7 +617,7 @@ def deskew(infile, outfile, dpi):
|
||||
def remove_background(infile, outfile, tile_size=(40, 60), gamma=1.0,
|
||||
black_threshold=70, white_threshold=190):
|
||||
try:
|
||||
pix = Pix.read(infile)
|
||||
pix = Pix.open(infile)
|
||||
except LeptonicaIOError:
|
||||
raise LeptonicaIOError("Failed to open file: %s" % infile)
|
||||
|
||||
@@ -564,35 +645,4 @@ if __name__ == '__main__':
|
||||
parser_deskew.set_defaults(func=deskew)
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
if get_leptonica_version() != u'leptonica-1.69':
|
||||
print("Unexpected leptonica version: %s" % getLeptonicaVersion())
|
||||
|
||||
args.func(args)
|
||||
|
||||
|
||||
def test_skew_angle():
|
||||
from PIL import Image, ImageDraw
|
||||
from tempfile import NamedTemporaryFile
|
||||
|
||||
im = Image.new(mode='1', size=(1000, 1000), color=1)
|
||||
|
||||
draw = ImageDraw.Draw(im)
|
||||
for n in range(20):
|
||||
draw.line([(50, 25 + 50*n), (950, 25 + 50*n)], width=1)
|
||||
del draw
|
||||
|
||||
test_angles = [0.1 * ang for ang in range(1, 10)] + \
|
||||
[float(ang) for ang in range(1, 7)]
|
||||
test_angles += [-ang for ang in test_angles]
|
||||
test_angles = sorted(test_angles)
|
||||
|
||||
for rotate_angle in test_angles:
|
||||
rotated_im = im.rotate(rotate_angle)
|
||||
with NamedTemporaryFile(prefix='lept-skew', suffix='.png', delete=True) as tmpfile:
|
||||
rotated_im.save(tmpfile)
|
||||
pix = pixRead(tmpfile.name)
|
||||
angle, confidence = pixFindSkew(pix)
|
||||
print('{0} {1} {2}'.format(rotate_angle, angle, confidence), file=sys.stderr)
|
||||
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
# © 2017 James R. Barlow: github.com/jbarlow83
|
||||
#
|
||||
# This file is part of OCRmyPDF.
|
||||
#
|
||||
# OCRmyPDF is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# OCRmyPDF is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with OCRmyPDF. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
"""Bindings to external libraries"""
|
||||
@@ -0,0 +1,11 @@
|
||||
# auto-generated file
|
||||
import _cffi_backend
|
||||
|
||||
ffi = _cffi_backend.FFI('ocrmypdf.lib._leptonica',
|
||||
_version = 0x2601,
|
||||
_types = b'\x00\x00\x0F\x0D\x00\x00\xCD\x03\x00\x00\x07\x01\x00\x00\x07\x01\x00\x00\x07\x01\x00\x00\x07\x01\x00\x00\x07\x01\x00\x00\x07\x01\x00\x00\xD0\x03\x00\x00\x00\x0F\x00\x00\x01\x0D\x00\x00\x01\x11\x00\x00\x00\x0F\x00\x00\x01\x0D\x00\x00\x01\x11\x00\x00\xCA\x03\x00\x00\x0F\x03\x00\x00\x00\x0F\x00\x00\x01\x0D\x00\x00\x01\x11\x00\x00\x01\x11\x00\x00\x00\x0F\x00\x00\x01\x0D\x00\x00\x01\x11\x00\x00\x01\x11\x00\x00\x01\x11\x00\x00\x00\x0F\x00\x00\x01\x0D\x00\x00\x01\x11\x00\x00\x01\x11\x00\x00\x01\x11\x00\x00\x0D\x01\x00\x00\x07\x01\x00\x00\x07\x01\x00\x00\x00\x0F\x00\x00\x01\x0D\x00\x00\x01\x11\x00\x00\x01\x11\x00\x00\x01\x11\x00\x00\x07\x01\x00\x00\x07\x01\x00\x00\x07\x01\x00\x00\x07\x01\x00\x00\x07\x01\x00\x00\x07\x01\x00\x00\x07\x01\x00\x00\x00\x0F\x00\x00\x01\x0D\x00\x00\x01\x11\x00\x00\x01\x11\x00\x00\x0D\x01\x00\x00\x07\x01\x00\x00\x07\x01\x00\x00\x00\x0F\x00\x00\x01\x0D\x00\x00\x01\x11\x00\x00\x01\x11\x00\x00\x07\x01\x00\x00\x07\x01\x00\x00\x07\x01\x00\x00\x07\x01\x00\x00\x00\x0F\x00\x00\x01\x0D\x00\x00\x01\x11\x00\x00\x01\x11\x00\x00\x07\x01\x00\x00\x07\x01\x00\x00\x07\x01\x00\x00\x07\x01\x00\x00\x07\x01\x00\x00\x07\x01\x00\x00\x07\x01\x00\x00\x0D\x01\x00\x00\x02\x03\x00\x00\x00\x0F\x00\x00\x01\x0D\x00\x00\x01\x11\x00\x00\x0D\x01\x00\x00\x0D\x01\x00\x00\x00\x0F\x00\x00\x01\x0D\x00\x00\x01\x11\x00\x00\x07\x01\x00\x00\x00\x0F\x00\x00\x01\x0D\x00\x00\x01\x11\x00\x00\x07\x01\x00\x00\x07\x01\x00\x00\x00\x0F\x00\x00\x01\x0D\x00\x00\x01\x11\x00\x00\x07\x01\x00\x00\x07\x01\x00\x00\x07\x01\x00\x00\x07\x01\x00\x00\x00\x0F\x00\x00\x01\x0D\x00\x00\x08\x11\x00\x00\x00\x0F\x00\x00\x01\x0D\x00\x00\xDC\x03\x00\x00\x1C\x01\x00\x00\x00\x0F\x00\x00\xCF\x0D\x00\x00\x00\x0F\x00\x00\x49\x0D\x00\x00\x00\x0F\x00\x00\x02\x0D\x00\x00\x01\x11\x00\x00\x01\x11\x00\x00\x1F\x03\x00\x00\x00\x0F\x00\x00\x02\x0D\x00\x00\x01\x11\x00\x00\x01\x11\x00\x00\x07\x01\x00\x00\x07\x01\x00\x00\x07\x01\x00\x00\x07\x01\x00\x00\x6E\x11\x00\x00\x6E\x11\x00\x00\x6E\x11\x00\x00\x00\x0F\x00\x00\x02\x0D\x00\x00\x01\x11\x00\x00\x6E\x11\x00\x00\x6E\x11\x00\x00\x00\x0F\x00\x00\x02\x0D\x00\x00\x01\x11\x00\x00\x49\x11\x00\x00\x49\x11\x00\x00\x00\x0F\x00\x00\x02\x0D\x00\x00\x01\x11\x00\x00\x07\x01\x00\x00\x07\x01\x00\x00\x0D\x01\x00\x00\x07\x01\x00\x00\x49\x11\x00\x00\x00\x0F\x00\x00\x02\x0D\x00\x00\x01\x11\x00\x00\x07\x01\x00\x00\x07\x01\x00\x00\x07\x01\x00\x00\xCB\x03\x00\x00\x00\x0F\x00\x00\x02\x0D\x00\x00\x01\x11\x00\x00\x07\x01\x00\x00\x07\x01\x00\x00\x07\x01\x00\x00\x07\x01\x00\x00\x6E\x11\x00\x00\x6E\x11\x00\x00\x00\x0F\x00\x00\x02\x0D\x00\x00\x01\x11\x00\x00\x07\x01\x00\x00\x07\x01\x00\x00\x07\x01\x00\x00\x07\x01\x00\x00\x0D\x01\x00\x00\x01\x03\x00\x00\xA4\x11\x00\x00\x00\x0F\x00\x00\x02\x0D\x00\x00\x01\x11\x00\x00\xDB\x03\x00\x00\x65\x03\x00\x00\x00\x0F\x00\x00\x02\x0D\x00\x00\x08\x11\x00\x00\x01\x11\x00\x00\x07\x01\x00\x00\x92\x11\x00\x00\x00\x0F\x00\x00\x02\x0D\x00\x00\x08\x11\x00\x00\x01\x11\x00\x00\x07\x01\x00\x00\x07\x01\x00\x00\x00\x0F\x00\x00\x02\x0D\x00\x00\xD9\x03\x00\x00\xAA\x11\x00\x00\x01\x11\x00\x00\x0D\x01\x00\x00\x00\x0F\x00\x00\xDF\x0D\x00\x00\x10\x11\x00\x00\x00\x0F\x00\x00\xDF\x0D\x00\x00\x92\x11\x00\x00\x00\x0F\x00\x00\xDF\x0D\x00\x00\xA4\x11\x00\x00\x00\x0F\x00\x00\xDF\x0D\x00\x00\xDF\x03\x00\x00\x00\x0F\x00\x00\x00\x09\x00\x00\xCC\x03\x00\x00\x01\x09\x00\x00\x02\x09\x00\x00\x03\x09\x00\x00\xD0\x03\x00\x00\x02\x01\x00\x00\x0E\x01\x00\x00\x00\x0B\x00\x00\x01\x0B\x00\x00\x02\x0B\x00\x00\x0B\x01\x00\x00\x05\x01\x00\x00\x03\x01\x00\x00\xCE\x03\x00\x00\xDA\x03\x00\x00\x04\x01\x00\x00\xDC\x03\x00\x00\x08\x01\x00\x00\x0C\x01\x00\x00\x06\x01\x00\x00\x00\x01',
|
||||
_globals = (b'\xFF\xFF\xFF\x0BL_CLONE',2,b'\xFF\xFF\xFF\x0BL_COPY',1,b'\xFF\xFF\xFF\x0BL_COPY_CLONE',3,b'\xFF\xFF\xFF\x0BL_DEFAULT_ENCODE',0,b'\xFF\xFF\xFF\x0BL_FLATE_ENCODE',3,b'\xFF\xFF\xFF\x0BL_G4_ENCODE',2,b'\xFF\xFF\xFF\x0BL_INSERT',0,b'\xFF\xFF\xFF\x0BL_JP2K_ENCODE',4,b'\xFF\xFF\xFF\x0BL_JPEG_ENCODE',1,b'\xFF\xFF\xFF\x0BL_NOCOPY',0,b'\xFF\xFF\xFF\x0BREMOVE_CMAP_BASED_ON_SRC',4,b'\xFF\xFF\xFF\x0BREMOVE_CMAP_TO_BINARY',0,b'\xFF\xFF\xFF\x0BREMOVE_CMAP_TO_FULL_COLOR',2,b'\xFF\xFF\xFF\x0BREMOVE_CMAP_TO_GRAYSCALE',1,b'\xFF\xFF\xFF\x0BREMOVE_CMAP_WITH_ALPHA',3,b'\x00\x00\xBE\x23boxDestroy',0,b'\x00\x00\x67\x23getLeptonicaVersion',0,b'\x00\x00\xC1\x23l_CIDataDestroy',0,b'\x00\x00\xAC\x23l_generateCIDataForPdf',0,b'\x00\x00\xC7\x23lept_free',0,b'\x00\x00\x69\x23makePixelSumTab8',0,b'\x00\x00\x16\x23pixAnd',0,b'\x00\x00\x23\x23pixBackgroundNorm',0,b'\x00\x00\x1B\x23pixCleanBackgroundToWhite',0,b'\x00\x00\x0D\x23pixClipRectangle',0,b'\x00\x00\x94\x23pixColorFraction',0,b'\x00\x00\x59\x23pixColorMagnitude',0,b'\x00\x00\x0A\x23pixConvertRGBToLuminance',0,b'\x00\x00\x6B\x23pixCorrelationBinary',0,b'\x00\x00\x80\x23pixCountPixels',0,b'\x00\x00\x63\x23pixDeserializeFromMemory',0,b'\x00\x00\x50\x23pixDeskew',0,b'\x00\x00\xC4\x23pixDestroy',0,b'\x00\x00\x0A\x23pixEndianByteSwapNew',0,b'\x00\x00\x00\x23pixFindPageForeground',0,b'\x00\x00\x7B\x23pixFindSkew',0,b'\x00\x00\x2F\x23pixGammaTRC',0,b'\x00\x00\x8D\x23pixGenerateCIData',0,b'\x00\x00\x70\x23pixGetAverageMaskedRGB',0,b'\x00\x00\x36\x23pixGlobalNormRGB',0,b'\x00\x00\x12\x23pixInvert',0,b'\x00\x00\x54\x23pixMaskOverColorPixels',0,b'\x00\x00\x85\x23pixNumSignificantGrayColors',0,b'\x00\x00\x9D\x23pixOtsuAdaptiveThreshold',0,b'\x00\x00\x3E\x23pixOtsuThreshOnBackgroundNorm',0,b'\x00\x00\x60\x23pixRead',0,b'\x00\x00\x50\x23pixRemoveColormap',0,b'\x00\x00\x54\x23pixRemoveColormapGeneral',0,b'\x00\x00\x12\x23pixRotate180',0,b'\x00\x00\x50\x23pixRotateOrth',0,b'\x00\x00\x4B\x23pixScale',0,b'\x00\x00\xA7\x23pixSerializeToMemory',0,b'\x00\x00\xB2\x23pixWriteImpliedFormat',0,b'\x00\x00\xB8\x23pixWriteMemPng',0),
|
||||
_struct_unions = ((b'\x00\x00\x00\xCA\x00\x00\x00\x02Box',b'\x00\x00\x02\x11x',b'\x00\x00\x02\x11y',b'\x00\x00\x02\x11w',b'\x00\x00\x02\x11h',b'\x00\x00\xDC\x11refcount'),(b'\x00\x00\x00\xCC\x00\x00\x00\x02L_Compressed_Data',b'\x00\x00\x02\x11type',b'\x00\x00\xD9\x11datacomp',b'\x00\x00\x65\x11nbytescomp',b'\x00\x00\xCF\x11data85',b'\x00\x00\x65\x11nbytes85',b'\x00\x00\xCF\x11cmapdata85',b'\x00\x00\xCF\x11cmapdatahex',b'\x00\x00\x02\x11ncolors',b'\x00\x00\x02\x11w',b'\x00\x00\x02\x11h',b'\x00\x00\x02\x11bps',b'\x00\x00\x02\x11spp',b'\x00\x00\x02\x11minisblack',b'\x00\x00\x02\x11predictor',b'\x00\x00\x65\x11nbytes',b'\x00\x00\x02\x11res'),(b'\x00\x00\x00\xCD\x00\x00\x00\x02Pix',b'\x00\x00\xDC\x11w',b'\x00\x00\xDC\x11h',b'\x00\x00\xDC\x11d',b'\x00\x00\xDC\x11spp',b'\x00\x00\xDC\x11wpl',b'\x00\x00\xDC\x11refcount',b'\x00\x00\x02\x11xres',b'\x00\x00\x02\x11yres',b'\x00\x00\x02\x11informat',b'\x00\x00\x02\x11special',b'\x00\x00\xCF\x11text',b'\x00\x00\xD8\x11colormap',b'\x00\x00\xDB\x11data'),(b'\x00\x00\x00\xCE\x00\x00\x00\x02PixColormap',b'\x00\x00\xC8\x11array',b'\x00\x00\x02\x11depth',b'\x00\x00\x02\x11nalloc',b'\x00\x00\x02\x11n')),
|
||||
_enums = (b'\x00\x00\x00\xD2\x00\x00\x00\x16$1\x00L_DEFAULT_ENCODE,L_JPEG_ENCODE,L_G4_ENCODE,L_FLATE_ENCODE,L_JP2K_ENCODE',b'\x00\x00\x00\xD3\x00\x00\x00\x16$2\x00REMOVE_CMAP_TO_BINARY,REMOVE_CMAP_TO_GRAYSCALE,REMOVE_CMAP_TO_FULL_COLOR,REMOVE_CMAP_WITH_ALPHA,REMOVE_CMAP_BASED_ON_SRC',b'\x00\x00\x00\xD4\x00\x00\x00\x16$3\x00L_NOCOPY,L_INSERT,L_COPY,L_CLONE,L_COPY_CLONE'),
|
||||
_typenames = (b'\x00\x00\x00\xCABOX',b'\x00\x00\x00\xCCL_COMP_DATA',b'\x00\x00\x00\xCDPIX',b'\x00\x00\x00\xCEPIXCMAP',b'\x00\x00\x00\x1Fl_float32',b'\x00\x00\x00\xD1l_float64',b'\x00\x00\x00\xD6l_int16',b'\x00\x00\x00\x02l_int32',b'\x00\x00\x00\xD5l_int64',b'\x00\x00\x00\xD7l_int8',b'\x00\x00\x00\xDEl_uint16',b'\x00\x00\x00\xDCl_uint32',b'\x00\x00\x00\xDDl_uint64',b'\x00\x00\x00\xDAl_uint8'),
|
||||
)
|
||||
@@ -1,4 +1,20 @@
|
||||
#!/usr/bin/env python3
|
||||
# © 2017 James R. Barlow: github.com/jbarlow83
|
||||
#
|
||||
# This file is part of OCRmyPDF.
|
||||
#
|
||||
# OCRmyPDF is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# OCRmyPDF is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with OCRmyPDF. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from cffi import FFI
|
||||
|
||||
@@ -56,6 +72,56 @@ struct Box
|
||||
};
|
||||
typedef struct Box BOX;
|
||||
|
||||
|
||||
/*! Pdf formatted encoding types */
|
||||
enum {
|
||||
L_DEFAULT_ENCODE = 0, /*!< use default encoding based on image */
|
||||
L_JPEG_ENCODE = 1, /*!< use dct encoding: 8 and 32 bpp, no cmap */
|
||||
L_G4_ENCODE = 2, /*!< use ccitt g4 fax encoding: 1 bpp */
|
||||
L_FLATE_ENCODE = 3, /*!< use flate encoding: any depth, cmap ok */
|
||||
L_JP2K_ENCODE = 4 /*!< use jp2k encoding: 8 and 32 bpp, no cmap */
|
||||
};
|
||||
|
||||
/*! Compressed image data */
|
||||
struct L_Compressed_Data
|
||||
{
|
||||
l_int32 type; /*!< encoding type: L_JPEG_ENCODE, etc */
|
||||
l_uint8 *datacomp; /*!< gzipped raster data */
|
||||
size_t nbytescomp; /*!< number of compressed bytes */
|
||||
char *data85; /*!< ascii85-encoded gzipped raster data */
|
||||
size_t nbytes85; /*!< number of ascii85 encoded bytes */
|
||||
char *cmapdata85; /*!< ascii85-encoded uncompressed cmap */
|
||||
char *cmapdatahex; /*!< hex pdf array for the cmap */
|
||||
l_int32 ncolors; /*!< number of colors in cmap */
|
||||
l_int32 w; /*!< image width */
|
||||
l_int32 h; /*!< image height */
|
||||
l_int32 bps; /*!< bits/sample; typ. 1, 2, 4 or 8 */
|
||||
l_int32 spp; /*!< samples/pixel; typ. 1 or 3 */
|
||||
l_int32 minisblack; /*!< tiff g4 photometry */
|
||||
l_int32 predictor; /*!< flate data has PNG predictors */
|
||||
size_t nbytes; /*!< number of uncompressed raster bytes */
|
||||
l_int32 res; /*!< resolution (ppi) */
|
||||
};
|
||||
typedef struct L_Compressed_Data L_COMP_DATA;
|
||||
|
||||
enum {
|
||||
REMOVE_CMAP_TO_BINARY = 0, /*!< remove colormap for conv to 1 bpp */
|
||||
REMOVE_CMAP_TO_GRAYSCALE = 1, /*!< remove colormap for conv to 8 bpp */
|
||||
REMOVE_CMAP_TO_FULL_COLOR = 2, /*!< remove colormap for conv to 32 bpp */
|
||||
REMOVE_CMAP_WITH_ALPHA = 3, /*!< remove colormap and alpha */
|
||||
REMOVE_CMAP_BASED_ON_SRC = 4 /*!< remove depending on src format */
|
||||
};
|
||||
|
||||
/*! Access and storage flags */
|
||||
enum {
|
||||
L_NOCOPY = 0, /*!< do not copy the object; do not delete the ptr */
|
||||
L_INSERT = L_NOCOPY, /*!< stuff it in; do not copy or clone */
|
||||
L_COPY = 1, /*!< make/use a copy of the object */
|
||||
L_CLONE = 2, /*!< make/use clone (ref count) of the object */
|
||||
L_COPY_CLONE = 3 /*!< make a new array object (e.g., pixa) and fill */
|
||||
/*!< the array with clones (e.g., pix) */
|
||||
};
|
||||
|
||||
""")
|
||||
|
||||
ffibuilder.cdef("""
|
||||
@@ -183,10 +249,60 @@ pixColorMagnitude(PIX *pixs,
|
||||
l_int32 bwhite,
|
||||
l_int32 type);
|
||||
|
||||
void
|
||||
PIX *
|
||||
pixMaskOverColorPixels(PIX *pixs,
|
||||
l_int32 threshdiff,
|
||||
l_int32 mindist);
|
||||
|
||||
l_int32
|
||||
pixGetAverageMaskedRGB(PIX *pixs,
|
||||
PIX *pixm,
|
||||
l_int32 x,
|
||||
l_int32 y,
|
||||
l_int32 factor,
|
||||
l_int32 type,
|
||||
l_float32 *prval,
|
||||
l_float32 *pgval,
|
||||
l_float32 *pbval);
|
||||
|
||||
PIX *
|
||||
pixGlobalNormRGB(PIX * pixd,
|
||||
PIX * pixs,
|
||||
l_int32 rval,
|
||||
l_int32 gval,
|
||||
l_int32 bval,
|
||||
l_int32 mapval);
|
||||
|
||||
PIX *
|
||||
pixInvert(PIX * pixd,
|
||||
PIX * pixs);
|
||||
|
||||
PIX *
|
||||
pixRemoveColormapGeneral(PIX *pixs,
|
||||
l_int32 type,
|
||||
l_int32 ifnocmap);
|
||||
|
||||
l_int32
|
||||
pixGenerateCIData(PIX *pixs,
|
||||
l_int32 type,
|
||||
l_int32 quality,
|
||||
l_int32 ascii85,
|
||||
L_COMP_DATA **pcid);
|
||||
|
||||
l_int32
|
||||
l_generateCIDataForPdf(const char *fname,
|
||||
PIX *pix,
|
||||
l_int32 quality,
|
||||
L_COMP_DATA **pcid);
|
||||
|
||||
void
|
||||
boxDestroy(BOX **pbox);
|
||||
|
||||
void lept_free(void *ptr);
|
||||
void
|
||||
l_CIDataDestroy(L_COMP_DATA **pcid);
|
||||
|
||||
void
|
||||
lept_free(void *ptr);
|
||||
""")
|
||||
|
||||
|
||||
@@ -0,0 +1,485 @@
|
||||
# © 2018 James R. Barlow: github.com/jbarlow83
|
||||
#
|
||||
# This file is part of OCRmyPDF.
|
||||
#
|
||||
# OCRmyPDF is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# OCRmyPDF is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with OCRmyPDF. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from pathlib import Path
|
||||
import concurrent.futures
|
||||
from collections import defaultdict, namedtuple
|
||||
import logging
|
||||
import sys
|
||||
|
||||
from PIL import Image
|
||||
|
||||
import pikepdf
|
||||
|
||||
from ._jobcontext import JobContext
|
||||
from . import leptonica
|
||||
from .helpers import re_symlink, fspath
|
||||
from .exec import pngquant, jbig2enc
|
||||
|
||||
DEFAULT_JPEG_QUALITY = 75
|
||||
DEFAULT_PNG_QUALITY = 70
|
||||
|
||||
|
||||
def img_name(root, xref, ext):
|
||||
return fspath(root / '{:08d}{}'.format(xref, ext))
|
||||
|
||||
|
||||
def png_name(root, xref):
|
||||
return img_name(root, xref, '.png')
|
||||
|
||||
|
||||
def jpg_name(root, xref):
|
||||
return img_name(root, xref, '.jpg')
|
||||
|
||||
|
||||
def tif_name(root, xref):
|
||||
return img_name(root, xref, '.tif')
|
||||
|
||||
|
||||
def extract_image_filter(pike, root, log, image, xref):
|
||||
if image.Subtype != '/Image':
|
||||
return None
|
||||
if image.Length < 100:
|
||||
log.debug("Skipping small image, xref %s", xref)
|
||||
return None
|
||||
|
||||
pim = pikepdf.PdfImage(image)
|
||||
|
||||
if len(pim.filter_decodeparms) > 1:
|
||||
log.debug("Skipping multiply filtered, xref %s", xref)
|
||||
return None
|
||||
filtdp = pim.filter_decodeparms[0]
|
||||
|
||||
if pim.bits_per_component > 8:
|
||||
return None # Don't mess with wide gamut images
|
||||
|
||||
if filtdp[0] == '/JPXDecode':
|
||||
return None # Don't do JPEG2000
|
||||
|
||||
return pim, filtdp
|
||||
|
||||
|
||||
def extract_image_jbig2(*, pike, root, log, image, xref, options):
|
||||
result = extract_image_filter(pike, root, log, image, xref)
|
||||
if result is None:
|
||||
return None
|
||||
pim, filtdp = result
|
||||
|
||||
if pim.bits_per_component == 1 \
|
||||
and filtdp != '/JBIG2Decode' \
|
||||
and jbig2enc.available():
|
||||
try:
|
||||
imgname = Path(root / '{:08d}'.format(xref))
|
||||
with imgname.open('wb') as f:
|
||||
ext = pim.extract_to(stream=f)
|
||||
imgname.rename(imgname.with_suffix(ext))
|
||||
except pikepdf.UnsupportedImageTypeError:
|
||||
return None
|
||||
return xref, ext
|
||||
return None
|
||||
|
||||
|
||||
def extract_image_generic(*, pike, root, log, image, xref, options):
|
||||
result = extract_image_filter(pike, root, log, image, xref)
|
||||
if result is None:
|
||||
return None
|
||||
pim, filtdp = result
|
||||
|
||||
if filtdp[0] == '/DCTDecode' \
|
||||
and options.optimize >= 2:
|
||||
# This is a simple heuristic derived from some training data, that has
|
||||
# about a 70% chance of guessing whether the JPEG is high quality,
|
||||
# and possibly recompressible, or not. The number itself doesn't mean
|
||||
# anything.
|
||||
# bytes_per_pixel = int(raw_jpeg.Length) / (w * h)
|
||||
# jpeg_quality_estimate = 117.0 * (bytes_per_pixel ** 0.213)
|
||||
# if jpeg_quality_estimate < 65:
|
||||
# return None
|
||||
|
||||
# We could get the ICC profile here, but there's no need to look at it
|
||||
# for quality transcoding
|
||||
# if icc:
|
||||
# stream = BytesIO(raw_jpeg.read_raw_bytes())
|
||||
# iccbytes = icc.read_bytes()
|
||||
# with Image.open(stream) as im:
|
||||
# im.save(jpg_name(root, xref), icc_profile=iccbytes)
|
||||
try:
|
||||
imgname = Path(root / '{:08d}'.format(xref))
|
||||
with imgname.open('wb') as f:
|
||||
ext = pim.extract_to(stream=f)
|
||||
imgname.rename(imgname.with_suffix(ext))
|
||||
except pikepdf.UnsupportedImageTypeError:
|
||||
return None
|
||||
return xref, ext
|
||||
elif pim.indexed \
|
||||
and pim.colorspace in pim.SIMPLE_COLORSPACES \
|
||||
and options.optimize >= 3:
|
||||
# Try to improve on indexed images - these are far from low hanging
|
||||
# fruit in most cases
|
||||
pim.as_pil_image().save(png_name(root, xref))
|
||||
return xref, '.png'
|
||||
elif not pim.indexed and pim.colorspace in pim.SIMPLE_COLORSPACES:
|
||||
# An optimization opportunity here, not currently taken, is directly
|
||||
# generating a PNG from compressed data
|
||||
pim.as_pil_image().save(png_name(root, xref))
|
||||
return xref, '.png'
|
||||
else:
|
||||
return None
|
||||
|
||||
return True
|
||||
|
||||
|
||||
def extract_images(pike, root, log, options, extract_fn):
|
||||
"""Extract image using extract_fn
|
||||
|
||||
extract_fn decides where the image is interesting in this case
|
||||
"""
|
||||
|
||||
include_xrefs = set()
|
||||
exclude_xrefs = set()
|
||||
errors = 0
|
||||
for pageno, page in enumerate(pike.pages):
|
||||
try:
|
||||
xobjs = page.Resources.XObject
|
||||
except AttributeError:
|
||||
continue
|
||||
for _imname, image in dict(xobjs).items():
|
||||
if image.objgen[1] != 0:
|
||||
continue # Ignore images in an incremental PDF
|
||||
xref = image.objgen[0]
|
||||
if hasattr(image, 'SMask'):
|
||||
# Ignore soft masks
|
||||
smask_xref = image.SMask.objgen[0]
|
||||
exclude_xrefs.add(smask_xref)
|
||||
include_xrefs.add(xref)
|
||||
|
||||
working_xrefs = include_xrefs - exclude_xrefs
|
||||
for xref in working_xrefs:
|
||||
image = pike.get_object((xref, 0))
|
||||
try:
|
||||
result = extract_fn(
|
||||
pike=pike, root=root, log=log, image=image,
|
||||
xref=xref, options=options
|
||||
)
|
||||
except Exception as e:
|
||||
log.debug("Image xref %s", xref)
|
||||
log.debug(repr(e))
|
||||
errors += 1
|
||||
else:
|
||||
if result:
|
||||
_, ext = result
|
||||
yield pageno, xref, ext
|
||||
|
||||
|
||||
def extract_images_generic(pike, root, log, options):
|
||||
"""Extract any >=2bpp image we think we can improve"""
|
||||
|
||||
jpegs = []
|
||||
pngs = []
|
||||
for _, xref, ext in extract_images(
|
||||
pike, root, log, options, extract_image_generic):
|
||||
log.debug('xref = %s ext = %s', xref, ext)
|
||||
if ext == '.png':
|
||||
pngs.append(xref)
|
||||
elif ext == '.jpg':
|
||||
jpegs.append(xref)
|
||||
log.debug(
|
||||
"Optimizable images: "
|
||||
"JPEGs: %s PNGs: %s", len(jpegs), len(pngs)
|
||||
)
|
||||
return jpegs, pngs
|
||||
|
||||
|
||||
def extract_images_jbig2(pike, root, log, options):
|
||||
"""Extract any bitonal image that we think we can improve as JBIG2"""
|
||||
|
||||
jbig2_groups = defaultdict(list)
|
||||
for pageno, xref, ext in extract_images(
|
||||
pike, root, log, options, extract_image_jbig2):
|
||||
group = pageno // options.jbig2_page_group_size
|
||||
jbig2_groups[group].append((xref, ext))
|
||||
|
||||
# Elide empty groups
|
||||
jbig2_groups = {group: xrefs for group, xrefs in jbig2_groups.items()
|
||||
if len(xrefs) > 0}
|
||||
log.debug(
|
||||
"Optimizable images: "
|
||||
"JBIG2 groups: %s", (len(jbig2_groups),)
|
||||
)
|
||||
return jbig2_groups
|
||||
|
||||
|
||||
def _produce_jbig2_images(jbig2_groups, root, log, options):
|
||||
"""Produce JBIG2 images from their groups"""
|
||||
|
||||
def jbig2_group_futures(executor, root, groups):
|
||||
for group, xref_exts in groups.items():
|
||||
prefix = 'group{:08d}'.format(group)
|
||||
future = executor.submit(
|
||||
jbig2enc.convert_group,
|
||||
cwd=fspath(root),
|
||||
infiles=(img_name(root, xref, ext) for xref, ext in xref_exts),
|
||||
out_prefix=prefix
|
||||
)
|
||||
yield future
|
||||
|
||||
def jbig2_single_futures(executor, root, groups):
|
||||
for group, xref_exts in groups.items():
|
||||
prefix = 'group{:08d}'.format(group)
|
||||
# Second loop is to ensure multiple images per page are unpacked
|
||||
for n, xref_ext in enumerate(xref_exts):
|
||||
xref, ext = xref_ext
|
||||
future = executor.submit(
|
||||
jbig2enc.convert_single,
|
||||
cwd=fspath(root),
|
||||
infile=img_name(root, xref, ext),
|
||||
outfile=root / ('{}.{:04d}'.format(prefix, n))
|
||||
)
|
||||
yield future
|
||||
|
||||
if options.jbig2_page_group_size > 1:
|
||||
jbig2_futures = jbig2_group_futures
|
||||
else:
|
||||
jbig2_futures = jbig2_single_futures
|
||||
|
||||
with concurrent.futures.ThreadPoolExecutor(
|
||||
max_workers=options.jobs) as executor:
|
||||
futures = jbig2_futures(executor, root, jbig2_groups)
|
||||
for future in concurrent.futures.as_completed(futures):
|
||||
proc = future.result()
|
||||
log.debug(proc.stderr.decode())
|
||||
|
||||
|
||||
def convert_to_jbig2(pike, jbig2_groups, root, log, options):
|
||||
"""Convert images to JBIG2 and insert into PDF.
|
||||
|
||||
When the JBIG2 page group size is > 1 we do several JBIG2 images at once
|
||||
and build a symbol dictionary that will span several pages. Each JBIG2
|
||||
image must reference to its symbol dictionary. If too many pages shared the
|
||||
same dictionary JBIG2 encoding becomes more expensive and less efficient.
|
||||
The default value of 10 was determined through testing. Currently this
|
||||
must be lossy encoding since jbig2enc does not support refinement coding.
|
||||
|
||||
When the JBIG2 symbolic coder is not used, each JBIG2 stands on its own
|
||||
and needs no dictionary. Currently this is must be lossless JBIG2.
|
||||
"""
|
||||
|
||||
_produce_jbig2_images(jbig2_groups, root, log, options)
|
||||
|
||||
for group, xref_exts in jbig2_groups.items():
|
||||
prefix = 'group{:08d}'.format(group)
|
||||
jbig2_symfile = root / (prefix + '.sym')
|
||||
if jbig2_symfile.exists():
|
||||
jbig2_globals_data = jbig2_symfile.read_bytes()
|
||||
jbig2_globals = pikepdf.Stream(pike, jbig2_globals_data)
|
||||
jbig2_globals_dict = pikepdf.Dictionary({
|
||||
'/JBIG2Globals': jbig2_globals
|
||||
})
|
||||
elif options.jbig2_page_group_size == 1:
|
||||
jbig2_globals_dict = None
|
||||
else:
|
||||
raise FileNotFoundError(jbig2_symfile)
|
||||
|
||||
for n, xref_ext in enumerate(xref_exts):
|
||||
xref, _ = xref_ext
|
||||
jbig2_im_file = root / (prefix + '.{:04d}'.format(n))
|
||||
jbig2_im_data = jbig2_im_file.read_bytes()
|
||||
im_obj = pike.get_object(xref, 0)
|
||||
im_obj.write(
|
||||
jbig2_im_data, pikepdf.Name('/JBIG2Decode'),
|
||||
jbig2_globals_dict
|
||||
)
|
||||
|
||||
|
||||
def transcode_jpegs(pike, jpegs, root, log, options):
|
||||
for xref in jpegs:
|
||||
in_jpg = Path(jpg_name(root, xref))
|
||||
opt_jpg = in_jpg.with_suffix('.opt.jpg')
|
||||
|
||||
# This produces a debug warning from PIL
|
||||
# DEBUG:PIL.Image:Error closing: 'NoneType' object has no attribute
|
||||
# 'close'. Seems to be mostly harmless
|
||||
# https://github.com/python-pillow/Pillow/issues/1144
|
||||
with Image.open(fspath(in_jpg)) as im:
|
||||
im.save(fspath(opt_jpg),
|
||||
optimize=True,
|
||||
quality=options.jpeg_quality)
|
||||
# pylint: disable=no-member
|
||||
if opt_jpg.stat().st_size > in_jpg.stat().st_size:
|
||||
log.debug("xref %s, jpeg, made larger - skip", xref)
|
||||
continue
|
||||
|
||||
compdata = leptonica.CompressedData.open(opt_jpg)
|
||||
im_obj = pike.get_object(xref, 0)
|
||||
im_obj.write(
|
||||
compdata.read(), filter=pikepdf.Name('/DCTDecode')
|
||||
)
|
||||
|
||||
|
||||
def transcode_pngs(pike, pngs, root, log, options):
|
||||
if options.optimize >= 2:
|
||||
png_quality = (
|
||||
max(10, options.png_quality - 10),
|
||||
min(100, options.png_quality + 10)
|
||||
)
|
||||
with concurrent.futures.ThreadPoolExecutor(
|
||||
max_workers=options.jobs) as executor:
|
||||
for xref in pngs:
|
||||
executor.submit(
|
||||
pngquant.quantize,
|
||||
png_name(root, xref), png_name(root, xref),
|
||||
png_quality[0], png_quality[1])
|
||||
|
||||
for xref in pngs:
|
||||
im_obj = pike.get_object(xref, 0)
|
||||
|
||||
# Open, transcode (!), package for PDF
|
||||
try:
|
||||
pix = leptonica.Pix.open(png_name(root, xref))
|
||||
if pix.depth == 1:
|
||||
pix = pix.invert() # PDF assumes 1 is black for monochrome
|
||||
compdata = pix.generate_pdf_ci_data(
|
||||
leptonica.lept.L_FLATE_ENCODE, 0
|
||||
)
|
||||
except leptonica.LeptonicaError as e:
|
||||
log.error(e)
|
||||
continue
|
||||
|
||||
# This is what we should be doing: open the compressed data without
|
||||
# transcoding. However this shifts each pixel row by one for some
|
||||
# reason.
|
||||
#compdata = leptonica.CompressedData.open(png_name(root, xref))
|
||||
if len(compdata) > int(im_obj.stream_dict.Length):
|
||||
continue # If we produced a larger image, don't use
|
||||
|
||||
predictor = None
|
||||
if compdata.predictor > 0:
|
||||
predictor = pikepdf.Dictionary({'/Predictor': compdata.predictor})
|
||||
|
||||
im_obj.BitsPerComponent = compdata.bps
|
||||
im_obj.Width = compdata.w
|
||||
im_obj.Height = compdata.h
|
||||
|
||||
if compdata.ncolors > 0:
|
||||
palette_pdf_string = compdata.get_palette_pdf_string()
|
||||
palette_data = pikepdf.Object.parse(palette_pdf_string)
|
||||
palette_stream = pikepdf.Stream(pike, bytes(palette_data))
|
||||
palette = [pikepdf.Name('/Indexed'), pikepdf.Name('/DeviceRGB'),
|
||||
compdata.ncolors - 1, palette_stream]
|
||||
cs = palette
|
||||
else:
|
||||
if compdata.spp == 1:
|
||||
cs = pikepdf.Name('/DeviceGray')
|
||||
elif compdata.spp == 3:
|
||||
cs = pikepdf.Name('/DeviceRGB')
|
||||
elif compdata.spp == 4:
|
||||
cs = pikepdf.Name('/DeviceCMYK')
|
||||
im_obj.ColorSpace = cs
|
||||
im_obj.write(
|
||||
compdata.read(),
|
||||
filter=pikepdf.Name('/FlateDecode'), decode_parms=predictor
|
||||
)
|
||||
|
||||
|
||||
def optimize(
|
||||
input_file,
|
||||
output_file,
|
||||
log,
|
||||
context):
|
||||
|
||||
options = context.get_options()
|
||||
if options.optimize == 0:
|
||||
re_symlink(input_file, output_file, log)
|
||||
return
|
||||
|
||||
if options.jpeg_quality == 0:
|
||||
options.jpeg_quality = \
|
||||
DEFAULT_JPEG_QUALITY if options.optimize < 3 else 40
|
||||
if options.png_quality == 0:
|
||||
options.png_quality = \
|
||||
DEFAULT_PNG_QUALITY if options.optimize < 3 else 30
|
||||
if options.jbig2_page_group_size == 0:
|
||||
options.jbig2_page_group_size = \
|
||||
10 if options.jbig2_lossy else 1
|
||||
|
||||
pike = pikepdf.Pdf.open(input_file)
|
||||
|
||||
root = Path(output_file).parent / 'images'
|
||||
root.mkdir(exist_ok=True) # pylint: disable=no-member
|
||||
|
||||
jpegs, pngs = extract_images_generic(pike, root, log, options)
|
||||
transcode_jpegs(pike, jpegs, root, log, options)
|
||||
transcode_pngs(pike, pngs, root, log, options)
|
||||
|
||||
jbig2_groups = extract_images_jbig2(pike, root, log, options)
|
||||
convert_to_jbig2(pike, jbig2_groups, root, log, options)
|
||||
|
||||
target_file = Path(output_file).with_suffix('.opt.pdf')
|
||||
pike.save(target_file, preserve_pdfa=True,
|
||||
object_stream_mode=pikepdf.ObjectStreamMode.generate)
|
||||
|
||||
input_size = Path(input_file).stat().st_size
|
||||
output_size = Path(target_file).stat().st_size
|
||||
ratio = input_size / output_size
|
||||
savings = 1 - output_size / input_size
|
||||
log.info("Optimize ratio: {:.2f} savings: {:.1f}%".format(
|
||||
ratio, 100 * savings))
|
||||
|
||||
if savings < 0:
|
||||
log.info("Optimize did not improve the file - discarded")
|
||||
re_symlink(input_file, output_file, log)
|
||||
else:
|
||||
re_symlink(target_file, output_file, log)
|
||||
|
||||
|
||||
def main(infile, outfile, level, jobs=1):
|
||||
from tempfile import TemporaryDirectory
|
||||
from shutil import copy
|
||||
|
||||
class OptimizeOptions:
|
||||
"""Emulate ocrmypdf's options"""
|
||||
|
||||
def __init__(
|
||||
self, jobs, optimize, jpeg_quality, png_quality, jb2lossy):
|
||||
self.jobs = jobs
|
||||
self.optimize = optimize
|
||||
self.jpeg_quality = jpeg_quality
|
||||
self.png_quality = png_quality
|
||||
self.jbig2_page_group_size = 0
|
||||
self.jbig2_lossy = jb2lossy
|
||||
|
||||
logging.basicConfig(level=logging.DEBUG)
|
||||
log = logging.getLogger()
|
||||
|
||||
ctx = JobContext()
|
||||
options = OptimizeOptions(
|
||||
jobs=jobs,
|
||||
optimize=int(level),
|
||||
jpeg_quality=0, # Use default
|
||||
png_quality=0,
|
||||
jb2lossy=False
|
||||
)
|
||||
ctx.set_options(options)
|
||||
|
||||
with TemporaryDirectory() as td:
|
||||
tmpout = Path(td) / 'out.pdf'
|
||||
optimize(infile, tmpout, log, ctx)
|
||||
copy(fspath(tmpout), fspath(outfile))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main(sys.argv[1], sys.argv[2], sys.argv[3])
|
||||
@@ -0,0 +1,335 @@
|
||||
# © 2015 James R. Barlow: github.com/jbarlow83
|
||||
#
|
||||
# This file is part of OCRmyPDF.
|
||||
#
|
||||
# OCRmyPDF is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# OCRmyPDF is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with OCRmyPDF. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
"""
|
||||
Generate a PDFMARK file for Ghostscript >= 9.14, for PDF/A conversion
|
||||
|
||||
pdfmark is an extension to the Postscript language that describes some PDF
|
||||
features like bookmarks and annotations. It was originally specified Adobe
|
||||
Distiller, for Postscript to PDF conversion:
|
||||
https://www.adobe.com/content/dam/acom/en/devnet/acrobat/pdfs/pdfmark_reference.pdf
|
||||
|
||||
Ghostscript uses pdfmark for PDF to PDF/A conversion as well. To use Ghostscript
|
||||
to create a PDF/A, we need to create a pdfmark file with the necessary metadata.
|
||||
|
||||
This takes care of the many version-specific bugs and pecularities in
|
||||
Ghostscript's handling of pdfmark.
|
||||
|
||||
"""
|
||||
|
||||
from binascii import hexlify
|
||||
from datetime import datetime
|
||||
from pathlib import Path
|
||||
from shutil import copyfile
|
||||
from string import Template
|
||||
import pkg_resources
|
||||
import os
|
||||
|
||||
from libxmp.utils import file_to_dict
|
||||
from libxmp import consts
|
||||
|
||||
from ocrmypdf.helpers import fspath
|
||||
|
||||
ICC_PROFILE_RELPATH = 'data/sRGB.icc'
|
||||
|
||||
SRGB_ICC_PROFILE = pkg_resources.resource_filename(
|
||||
'ocrmypdf', ICC_PROFILE_RELPATH)
|
||||
|
||||
|
||||
# This is a template written in PostScript which is needed to create PDF/A
|
||||
# files, from the Ghostscript documentation. Lines beginning with % are
|
||||
# comments. Python substitution variables have a '$' prefix.
|
||||
pdfa_def_template = u"""%!
|
||||
% Define entries in the document Info dictionary :
|
||||
/ICCProfile $icc_profile
|
||||
def
|
||||
|
||||
[$docinfo
|
||||
/DOCINFO pdfmark
|
||||
|
||||
% Define an ICC profile :
|
||||
|
||||
[/_objdef {icc_PDFA} /type /stream /OBJ pdfmark
|
||||
[{icc_PDFA}
|
||||
<<
|
||||
/N currentpagedevice /ProcessColorModel known {
|
||||
currentpagedevice /ProcessColorModel get dup /DeviceGray eq
|
||||
{pop 1} {
|
||||
/DeviceRGB eq
|
||||
{3}{4} ifelse
|
||||
} ifelse
|
||||
} {
|
||||
(ERROR, unable to determine ProcessColorModel) == flush
|
||||
} ifelse
|
||||
>> /PUT pdfmark
|
||||
[{icc_PDFA} ICCProfile (r) file /PUT pdfmark
|
||||
|
||||
% Define the output intent dictionary :
|
||||
|
||||
[/_objdef {OutputIntent_PDFA} /type /dict /OBJ pdfmark
|
||||
[{OutputIntent_PDFA} <<
|
||||
/Type /OutputIntent % Must be so (the standard requires).
|
||||
/S /GTS_PDFA1 % Must be so (the standard requires).
|
||||
/DestOutputProfile {icc_PDFA} % Must be so (see above).
|
||||
/OutputConditionIdentifier ($icc_identifier)
|
||||
>> /PUT pdfmark
|
||||
[{Catalog} <</OutputIntents [ {OutputIntent_PDFA} ]>> /PUT pdfmark
|
||||
"""
|
||||
|
||||
|
||||
def encode_text_string(s: str) -> str:
|
||||
"""
|
||||
Encode text string to hex string for use in a PDF
|
||||
|
||||
From PDF 32000-1:2008 a string object may be included in hexademical form
|
||||
if it is enclosed in angle brackets. For general Unicode the string should
|
||||
be UTF-16 (big endian) with byte order marks. Many strings including all
|
||||
ASCII strings could be encoded as PdfDocEncoding literals provided
|
||||
that certain Postscript sequences are escaped. But it's far simpler to
|
||||
encode everything as UTF-16.
|
||||
"""
|
||||
|
||||
# Sometimes lazy C programmers leave their NULs at the end of strings they
|
||||
# insert into PDFs
|
||||
# tests/resources/aspect.pdf is one example (created by ImageMagick)
|
||||
s = s.replace('\x00', '')
|
||||
|
||||
if s == '':
|
||||
return ''
|
||||
|
||||
utf16_bytes = s.encode('utf-16be')
|
||||
ascii_hex_bytes = hexlify(b'\xfe\xff' + utf16_bytes)
|
||||
ascii_hex_str = ascii_hex_bytes.decode('ascii').lower()
|
||||
return ascii_hex_str
|
||||
|
||||
|
||||
def _encode_ascii(s: str) -> str:
|
||||
"""
|
||||
Aggressively strip non-ASCII and PDF escape sequences
|
||||
|
||||
Ghostscript 9.24+ lost support for UTF-16BE in pdfmark files for reasons
|
||||
given in GhostPDL commit e997c683. Our temporary workaround is use ASCII
|
||||
and drop all non-ASCII characters. A slightly improved alternative would
|
||||
be to implement PdfDocEncoding in pikepdf and encode to that, or handle
|
||||
metadata there.
|
||||
"""
|
||||
trans = str.maketrans({
|
||||
'(': '',
|
||||
')': '',
|
||||
'\\': '',
|
||||
'\0': ''
|
||||
})
|
||||
return s.translate(trans).encode('ascii', errors='replace').decode()
|
||||
|
||||
|
||||
def encode_pdf_date(d: datetime) -> str:
|
||||
"""
|
||||
Encode Python datetime object as PDF date string
|
||||
|
||||
From Adobe pdfmark manual:
|
||||
(D:YYYYMMDDHHmmSSOHH'mm')
|
||||
D: is an optional prefix. YYYY is the year. All fields after the year are
|
||||
optional. MM is the month (01-12), DD is the day (01-31), HH is the
|
||||
hour (00-23), mm are the minutes (00-59), and SS are the seconds
|
||||
(00-59). The remainder of the string defines the relation of local
|
||||
time to GMT. O is either + for a positive difference (local time is
|
||||
later than GMT) or - (minus) for a negative difference. HH' is the
|
||||
absolute value of the offset from GMT in hours, and mm' is the
|
||||
absolute value of the offset in minutes. If no GMT information is
|
||||
specified, the relation between the specified time and GMT is
|
||||
considered unknown. Regardless of whether or not GMT
|
||||
information is specified, the remainder of the string should specify
|
||||
the local time.
|
||||
"""
|
||||
|
||||
pdfmark_date_fmt = r'%Y%m%d%H%M%S'
|
||||
s = d.strftime(pdfmark_date_fmt)
|
||||
|
||||
tz = d.strftime('%z')
|
||||
if tz == 'Z' or tz == '':
|
||||
# Ghostscript <= 9.23 handles missing timezones incorrectly, so if
|
||||
# timezone is missing, move it into GMT.
|
||||
# https://bugs.ghostscript.com/show_bug.cgi?id=699182
|
||||
s += "+00'00'"
|
||||
else:
|
||||
sign, tz_hours, tz_mins = tz[0], tz[1:3], tz[3:5]
|
||||
s += "{}{}'{}'".format(sign, tz_hours, tz_mins)
|
||||
return s
|
||||
|
||||
|
||||
def decode_pdf_date(s: str) -> datetime:
|
||||
"""
|
||||
Decode a pdfmark date to a Python datetime object
|
||||
|
||||
A pdfmark date is a string in a paritcular format. See the pdfmark
|
||||
Reference for the specification.
|
||||
|
||||
"""
|
||||
if s.startswith('D:'):
|
||||
s = s[2:]
|
||||
|
||||
# Literal Z00'00', is incorrect but found in the wild,
|
||||
# probably made by OS X Quartz -- standardize
|
||||
if s.endswith("Z00'00'"):
|
||||
s = s.replace("Z00'00'", '+0000')
|
||||
elif s.endswith('Z'):
|
||||
s = s.replace('Z', '+0000')
|
||||
|
||||
s = s.replace("'", "") # Remove apos from PDF time strings
|
||||
|
||||
return datetime.strptime(s, r'%Y%m%d%H%M%S%z')
|
||||
|
||||
|
||||
def _get_pdfmark_dates(pdfmark):
|
||||
"""
|
||||
Encode dates in the expected format for pdfmark Postscript
|
||||
|
||||
The best way to deal with amissing date entry is set it to null, because if
|
||||
the key is omitted Ghostscript will set it to now - we do not want to erase
|
||||
the fact that the value was unknown. Setting to an empty string breaks
|
||||
Ghostscript 9.22 as reported here:
|
||||
https://bugs.ghostscript.com/show_bug.cgi?id=699182
|
||||
"""
|
||||
|
||||
for key in ('/CreationDate', '/ModDate'):
|
||||
if key not in pdfmark:
|
||||
continue
|
||||
if pdfmark[key].strip() == '':
|
||||
yield ' {} null'.format(key)
|
||||
continue
|
||||
date_str = pdfmark[key]
|
||||
if date_str.startswith('D:'):
|
||||
date_str = date_str[2:]
|
||||
try:
|
||||
yield ' {} (D:{})'.format(
|
||||
key,
|
||||
encode_pdf_date(decode_pdf_date(date_str)))
|
||||
except ValueError:
|
||||
yield ' {} null'.format(key)
|
||||
|
||||
|
||||
def _get_pdfa_def(icc_profile, icc_identifier, pdfmark, ascii_docinfo=False):
|
||||
"""
|
||||
Create a Postscript pdfmark file for Ghostscript.
|
||||
|
||||
pdfmark contains the various objects as strings; these must be encoded in
|
||||
ASCII, and dates have a special format.
|
||||
|
||||
:param icc_profile: filename of the ICC profile to include in pdfmark
|
||||
:param icc_identifier: ICC identifier such as 'sRGB'
|
||||
:param pdfmark: a dictionary containing keys to include the pdfmark
|
||||
:param ascii_docinfo: if True, the docinfo block must be encoded in pure
|
||||
ASCII and may not contain UTF-16BE-BOM-hex encoded strings, as
|
||||
required for Ghostscript 9.24+
|
||||
|
||||
:returns: a string containing the entire pdfmark
|
||||
|
||||
"""
|
||||
|
||||
# Ghostscript <= 9.21 has a bug where null entries in DOCINFO might produce
|
||||
# ERROR: VMerror (-25) on closing pdfwrite device.
|
||||
# https://bugs.ghostscript.com/show_bug.cgi?id=697684
|
||||
# Work around this by only adding keys that have a nontrivial value
|
||||
docinfo_keys = ('/Title', '/Author', '/Subject', '/Creator', '/Keywords')
|
||||
|
||||
def docinfo_gen():
|
||||
if not ascii_docinfo:
|
||||
docinfo_line_template = ' {key} <{value}>'
|
||||
encode = encode_text_string
|
||||
else:
|
||||
docinfo_line_template = ' {key} ({value})'
|
||||
encode = _encode_ascii
|
||||
yield from _get_pdfmark_dates(pdfmark)
|
||||
for key in docinfo_keys:
|
||||
if key in pdfmark and pdfmark[key].strip() != '':
|
||||
line = docinfo_line_template.format(
|
||||
key=key, value=encode(pdfmark[key]))
|
||||
yield line
|
||||
docinfo = '\n'.join(docinfo_gen())
|
||||
|
||||
t = Template(pdfa_def_template)
|
||||
result = t.substitute(icc_profile=icc_profile,
|
||||
icc_identifier=icc_identifier,
|
||||
docinfo=docinfo)
|
||||
return result
|
||||
|
||||
|
||||
def generate_pdfa_ps(target_filename, pdfmark, icc='sRGB', ascii_docinfo=False):
|
||||
if icc == 'sRGB':
|
||||
icc_profile = SRGB_ICC_PROFILE
|
||||
else:
|
||||
raise NotImplementedError("Only supporting sRGB")
|
||||
|
||||
# pdfmark must contain the full path to the ICC profile, and pdfmark must
|
||||
# also encoded in ASCII. ocrmypdf can be installed anywhere, including to
|
||||
# paths that have a non-ASCII character in the filename. Ghostscript
|
||||
# accepts hex-encoded strings and converts them to byte strings, so
|
||||
# we encode the path with fsencode() and use the hex representation.
|
||||
# UTF-16 not accepted here. (Even though ASCII encodable is the usual case,
|
||||
# do this always to avoid making it a rare conditional.)
|
||||
bytes_icc_profile = os.fsencode(icc_profile)
|
||||
hex_icc_profile = hexlify(bytes_icc_profile)
|
||||
icc_profile = '<' + hex_icc_profile.decode('ascii') + '>'
|
||||
|
||||
ps = _get_pdfa_def(icc_profile, icc, pdfmark, ascii_docinfo=ascii_docinfo)
|
||||
|
||||
# We should have encoded everything to pure ASCII by this point, and
|
||||
# to be safe, only allow ASCII in PostScript
|
||||
Path(target_filename).write_text(ps, encoding='ascii')
|
||||
|
||||
|
||||
def file_claims_pdfa(filename):
|
||||
"""Determines if the file claims to be PDF/A compliant
|
||||
|
||||
Checking if a file is a truly compliant PDF/A is a massive undertaking
|
||||
that no open source tool does properly. Some commercial tools are
|
||||
generally reliable (Acrobat).
|
||||
|
||||
This checks if the XMP metadata contains a PDF/A marker.
|
||||
"""
|
||||
|
||||
xmp = file_to_dict(filename)
|
||||
if not xmp:
|
||||
return {'pass': False, 'output': 'pdf',
|
||||
'conformance': 'No XMP metadata'}
|
||||
|
||||
if not consts.XMP_NS_PDFA_ID in xmp:
|
||||
return {'pass': False, 'output': 'pdf',
|
||||
'conformance': 'No PDF/A metadata in XMP'}
|
||||
|
||||
pdfa_node = xmp[consts.XMP_NS_PDFA_ID]
|
||||
def read_node(node, key):
|
||||
return next(
|
||||
(v for k, v, meta in node if k == key), ''
|
||||
)
|
||||
|
||||
part = read_node(pdfa_node, 'pdfaid:part')
|
||||
conformance = read_node(pdfa_node, 'pdfaid:conformance')
|
||||
|
||||
part_conformance = part + conformance
|
||||
valid_part_conforms = {'1A', '1B', '2A', '2B', '2U', '3A', '3B', '3U'}
|
||||
|
||||
conformance = 'PDF/A-{}'.format(
|
||||
part_conformance)
|
||||
|
||||
pdfa_dict = {}
|
||||
if part_conformance in valid_part_conforms:
|
||||
pdfa_dict['pass'] = True
|
||||
pdfa_dict['output'] = 'pdfa'
|
||||
pdfa_dict['conformance'] = conformance
|
||||
|
||||
return pdfa_dict
|
||||
@@ -1,21 +1,35 @@
|
||||
#!/usr/bin/env python3
|
||||
# © 2015 James R. Barlow: github.com/jbarlow83
|
||||
#
|
||||
# This file is part of OCRmyPDF.
|
||||
#
|
||||
# OCRmyPDF is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# OCRmyPDF is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with OCRmyPDF. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from subprocess import Popen, PIPE
|
||||
from decimal import Decimal
|
||||
from math import hypot, isclose
|
||||
import re
|
||||
import sys
|
||||
import PyPDF2 as pypdf
|
||||
from collections import namedtuple
|
||||
from collections.abc import MutableMapping, Mapping
|
||||
import warnings
|
||||
from pathlib import Path
|
||||
from decimal import Decimal
|
||||
from enum import Enum
|
||||
from .helpers import universal_open
|
||||
from math import hypot, isclose
|
||||
from pathlib import Path
|
||||
from unittest.mock import Mock
|
||||
import re
|
||||
import xml.etree.ElementTree as ET
|
||||
|
||||
from .exec import ghostscript
|
||||
from .helpers import fspath
|
||||
|
||||
matrix_mult = pypdf.pdf.utils.matrixMultiply
|
||||
from pikepdf import PdfMatrix
|
||||
import pikepdf
|
||||
|
||||
Colorspace = Enum('Colorspace',
|
||||
'gray rgb cmyk lab icc index sep devn pattern jpeg2000')
|
||||
@@ -24,6 +38,16 @@ Encoding = Enum('Encoding',
|
||||
'ccitt jpeg jpeg2000 jbig2 asciihex ascii85 lzw flate ' + \
|
||||
'runlength')
|
||||
|
||||
# Forgive me for I have sinned
|
||||
# I am using regular expressions to parse XML. However the XML in this case,
|
||||
# generated by Ghostscript, is self-consistent enough to be parseable.
|
||||
regex_remove_char_tags = re.compile(br"""
|
||||
<char\b
|
||||
(?: [^>] # anything single character but >
|
||||
| \">\" # special case: trap ">"
|
||||
)*
|
||||
/> # terminate with '/>'
|
||||
""", re.VERBOSE)
|
||||
|
||||
FRIENDLY_COLORSPACE = {
|
||||
'/DeviceGray': Colorspace.gray,
|
||||
@@ -68,28 +92,6 @@ FRIENDLY_COMP = {
|
||||
|
||||
UNIT_SQUARE = (1.0, 0.0, 0.0, 1.0, 0.0, 0.0)
|
||||
|
||||
|
||||
def _matrix_from_shorthand(shorthand):
|
||||
"""Convert from PDF matrix shorthand to full matrix
|
||||
|
||||
PDF 1.7 spec defines a shorthand for describing the entries of a matrix
|
||||
since the last column is always (0, 0, 1).
|
||||
"""
|
||||
|
||||
a, b, c, d, e, f = map(float, shorthand)
|
||||
return ((a, b, 0),
|
||||
(c, d, 0),
|
||||
(e, f, 1))
|
||||
|
||||
|
||||
def _shorthand_from_matrix(matrix):
|
||||
"""Convert from transformation matrix to PDF shorthand."""
|
||||
a, b = matrix[0][0], matrix[0][1]
|
||||
c, d = matrix[1][0], matrix[1][1]
|
||||
e, f = matrix[2][0], matrix[2][1]
|
||||
return tuple(map(float, (a, b, c, d, e, f)))
|
||||
|
||||
|
||||
def _is_unit_square(shorthand):
|
||||
values = map(float, shorthand)
|
||||
pairwise = zip(values, UNIT_SQUARE)
|
||||
@@ -99,23 +101,20 @@ XobjectSettings = namedtuple('XobjectSettings',
|
||||
['name', 'shorthand', 'stack_depth'])
|
||||
|
||||
InlineSettings = namedtuple('InlineSettings',
|
||||
['settings', 'shorthand', 'stack_depth'])
|
||||
['iimage', 'shorthand', 'stack_depth'])
|
||||
|
||||
ContentsInfo = namedtuple('ContentsInfo',
|
||||
['xobject_settings', 'inline_images', 'found_text'])
|
||||
|
||||
ContentsInfo = namedtuple('ContentsInfo', ['xobject_settings', 'inline_images'])
|
||||
|
||||
|
||||
def _normalize_stack(operations):
|
||||
"""Fix runs of qQ's in the stack
|
||||
|
||||
For some reason PyPDF2 converts runs of qqq, QQ, QQQq, etc. into single
|
||||
operations. Break this silliness up and issue each stack operation
|
||||
individually so we don't lose count.
|
||||
|
||||
"""
|
||||
"""Convert runs of qQ's in the stack into single operations"""
|
||||
for operands, command in operations:
|
||||
if re.match(br'Q*q+$', command): # Zero or more Q, one or more q
|
||||
for char in command: # Split into individual bytes
|
||||
yield ([], bytes([char])) # Yield individual bytes
|
||||
command = str(command)
|
||||
if re.match(r'Q*q+$', command): # Zero or more Q, one or more q
|
||||
for char in command: # Split into individual
|
||||
yield ([], char) # Yield individual
|
||||
else:
|
||||
yield (operands, command)
|
||||
|
||||
@@ -139,48 +138,53 @@ def _interpret_contents(contentstream, initial_shorthand=UNIT_SQUARE):
|
||||
|
||||
PDF units suit our needs so we initialize ctm to the identity matrix.
|
||||
|
||||
PyPDF2 replaces inline images with a fake "INLINE IMAGE" operator.
|
||||
|
||||
"""
|
||||
|
||||
operations = contentstream.operations
|
||||
stack = []
|
||||
ctm = _matrix_from_shorthand(initial_shorthand)
|
||||
ctm = PdfMatrix(initial_shorthand)
|
||||
xobject_settings = []
|
||||
inline_images = []
|
||||
found_text = False
|
||||
text_operators = set(['Tj', 'TJ', '"', "'"])
|
||||
operator_whitelist = """q Q Do cm TJ Tj " ' BI ID EI"""
|
||||
|
||||
for n, op in enumerate(_normalize_stack(operations)):
|
||||
for n, op in enumerate(_normalize_stack(
|
||||
pikepdf.parse_content_stream(contentstream, operator_whitelist))):
|
||||
operands, command = op
|
||||
if command == b'q':
|
||||
|
||||
if command == 'q':
|
||||
stack.append(ctm)
|
||||
if len(stack) > 32:
|
||||
raise RuntimeError(
|
||||
"PDF graphics stack overflow, command %i" % n)
|
||||
elif command == b'Q':
|
||||
elif command == 'Q':
|
||||
try:
|
||||
ctm = stack.pop()
|
||||
except IndexError:
|
||||
raise RuntimeError(
|
||||
"PDF graphics stack underflow, command %i" % n)
|
||||
elif command == b'cm':
|
||||
ctm = matrix_mult(
|
||||
_matrix_from_shorthand(operands), ctm)
|
||||
elif command == b'Do':
|
||||
elif command == 'cm':
|
||||
ctm = PdfMatrix(operands) @ ctm
|
||||
elif command == 'Do':
|
||||
image_name = operands[0]
|
||||
settings = XobjectSettings(
|
||||
name=image_name, shorthand=_shorthand_from_matrix(ctm),
|
||||
name=image_name, shorthand=ctm.shorthand,
|
||||
stack_depth=len(stack))
|
||||
xobject_settings.append(settings)
|
||||
elif command == b'INLINE IMAGE':
|
||||
settings = operands['settings']
|
||||
elif command == 'INLINE IMAGE':
|
||||
iimage = operands[0]
|
||||
inline = InlineSettings(
|
||||
settings=settings, shorthand=_shorthand_from_matrix(ctm),
|
||||
iimage=iimage, shorthand=ctm.shorthand,
|
||||
stack_depth=len(stack))
|
||||
inline_images.append(inline)
|
||||
elif command in text_operators:
|
||||
found_text = True
|
||||
|
||||
|
||||
return ContentsInfo(
|
||||
xobject_settings=xobject_settings,
|
||||
inline_images=inline_images)
|
||||
inline_images=inline_images,
|
||||
found_text=found_text)
|
||||
|
||||
|
||||
def _get_dpi(ctm_shorthand, image_size):
|
||||
@@ -253,70 +257,47 @@ class ImageInfo:
|
||||
def __init__(self, *, name='', pdfimage=None, inline=None,
|
||||
shorthand=None):
|
||||
|
||||
self._name = name
|
||||
self._name = str(name)
|
||||
self._shorthand = shorthand
|
||||
if inline:
|
||||
# Fixme does not work for inline images with non abbreviated
|
||||
# fields
|
||||
|
||||
if inline is not None:
|
||||
self._origin = 'inline'
|
||||
self._width = inline.settings['/W']
|
||||
self._height = inline.settings['/H']
|
||||
self._bpc = inline.settings.get('/BPC', 8)
|
||||
try:
|
||||
self._color = FRIENDLY_COLORSPACE[inline.settings['/CS']]
|
||||
except Exception:
|
||||
self._color = '-'
|
||||
self._comp = FRIENDLY_COMP.get(self._color, '?')
|
||||
if '/F' in inline.settings:
|
||||
filter_ = inline.settings['/F']
|
||||
if isinstance(filter_, pypdf.generic.ArrayObject):
|
||||
filter_ = filter_[0]
|
||||
self._enc = FRIENDLY_ENCODING.get(filter_, 'image')
|
||||
else:
|
||||
self._enc = 'image'
|
||||
elif pdfimage:
|
||||
pim = inline.iimage
|
||||
elif pdfimage is not None:
|
||||
self._origin = 'xobject'
|
||||
self._width = pdfimage['/Width']
|
||||
self._height = pdfimage['/Height']
|
||||
if '/BitsPerComponent' in pdfimage:
|
||||
self._bpc = pdfimage['/BitsPerComponent']
|
||||
else:
|
||||
self._bpc = 8
|
||||
pim = pikepdf.PdfImage(pdfimage)
|
||||
self._width = pim.width
|
||||
self._height = pim.height
|
||||
|
||||
# Fixme: this is incorrectly treats explicit masks as stencil masks,
|
||||
# but good enough for now. Explicit masks have /ImageMask true but are
|
||||
# never called for in content stream, instead are drawn as a /Mask on
|
||||
# other images. For our purposes finding out the details of /Mask
|
||||
# will seldom matter.
|
||||
if '/ImageMask' in pdfimage:
|
||||
self._type = 'stencil' if pdfimage['/ImageMask'].value \
|
||||
else 'image'
|
||||
else:
|
||||
self._type = 'image'
|
||||
if '/Filter' in pdfimage:
|
||||
filter_ = pdfimage['/Filter']
|
||||
if isinstance(filter_, pypdf.generic.ArrayObject):
|
||||
filter_ = filter_[0]
|
||||
self._enc = FRIENDLY_ENCODING.get(filter_, 'image')
|
||||
else:
|
||||
self._enc = 'image'
|
||||
if '/ColorSpace' in pdfimage:
|
||||
cs = pdfimage['/ColorSpace']
|
||||
if isinstance(cs, pypdf.generic.ArrayObject):
|
||||
cs = cs[0]
|
||||
self._color = FRIENDLY_COLORSPACE.get(cs, '-')
|
||||
else:
|
||||
self._color = FRIENDLY_COLORSPACE[Colorspace.jpeg2000] \
|
||||
if self._enc == Encoding.jpeg2000 else '?'
|
||||
# If /ImageMask is true, then this image is a stencil mask
|
||||
# (Images that draw with this stencil mask will have a reference to
|
||||
# it in their /Mask, but we don't actually need that information)
|
||||
if pim.image_mask:
|
||||
self._type = 'stencil'
|
||||
else:
|
||||
self._type = 'image'
|
||||
|
||||
self._comp = FRIENDLY_COMP.get(self._color, '?')
|
||||
self._bpc = int(pim.bits_per_component)
|
||||
try:
|
||||
self._enc = FRIENDLY_ENCODING.get(pim.filters[0], 'image')
|
||||
except IndexError:
|
||||
self._enc = '?'
|
||||
|
||||
# Bit of a hack... infer grayscale if component count is uncertain
|
||||
# but encoding must be monochrome. This happens if a monochrome image
|
||||
# has an ICC profile attached. Better solution would be to examine
|
||||
# the ICC profile.
|
||||
if self._comp == '?' and self._enc in (Encoding.ccitt, 'jbig2'):
|
||||
self._comp = FRIENDLY_COMP[Colorspace.gray]
|
||||
try:
|
||||
self._color = FRIENDLY_COLORSPACE.get(pim.colorspace, '?')
|
||||
except NotImplementedError:
|
||||
self._color = '?'
|
||||
if self._enc == Encoding.jpeg2000:
|
||||
self._color = Colorspace.jpeg2000
|
||||
|
||||
self._comp = FRIENDLY_COMP.get(self._color, '?')
|
||||
|
||||
# Bit of a hack... infer grayscale if component count is uncertain
|
||||
# but encoding must be monochrome. This happens if a monochrome image
|
||||
# has an ICC profile attached. Better solution would be to examine
|
||||
# the ICC profile.
|
||||
if self._comp == '?' and self._enc in (Encoding.ccitt, 'jbig2'):
|
||||
self._comp = FRIENDLY_COMP[Colorspace.gray]
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
@@ -358,20 +339,6 @@ class ImageInfo:
|
||||
def yres(self):
|
||||
return _get_dpi(self._shorthand, (self._width, self._height))[1]
|
||||
|
||||
def __getitem__(self, item):
|
||||
warnings.warn("ImageInfo.__getitem__", DeprecationWarning)
|
||||
if item in ('name', 'width', 'height', 'bpc', 'color', 'comp', 'enc'):
|
||||
return getattr(self, item)
|
||||
elif item == 'dpi_w':
|
||||
return Decimal(self.xres).quantize(self.DPI_PREC)
|
||||
elif item == 'dpi_h':
|
||||
return Decimal(self.yres).quantize(self.DPI_PREC)
|
||||
elif item == 'dpi':
|
||||
return Decimal(self.xres * self.yres).sqrt().quantize(
|
||||
self.DPI_PREC)
|
||||
else:
|
||||
raise KeyError(item)
|
||||
|
||||
def __repr__(self):
|
||||
class_locals = {attr: getattr(self, attr, None) for attr in dir(self)
|
||||
if not attr.startswith('_')}
|
||||
@@ -406,8 +373,9 @@ def _image_xobjects(container):
|
||||
resources = container['/Resources']
|
||||
if '/XObject' not in resources:
|
||||
return
|
||||
for xobj in resources['/XObject']:
|
||||
candidate = resources['/XObject'][xobj]
|
||||
xobjs = resources['/XObject'].as_dict()
|
||||
for xobj in xobjs:
|
||||
candidate = xobjs[xobj]
|
||||
if candidate['/Subtype'] == '/Image':
|
||||
pdfimage = candidate
|
||||
yield (pdfimage, xobj)
|
||||
@@ -454,8 +422,9 @@ def _find_form_xobject_images(pdf, container, contentsinfo):
|
||||
resources = container['/Resources']
|
||||
if '/XObject' not in resources:
|
||||
return
|
||||
for xobj in resources['/XObject']:
|
||||
candidate = resources['/XObject'][xobj]
|
||||
xobjs = resources['/XObject'].as_dict()
|
||||
for xobj in xobjs:
|
||||
candidate = xobjs[xobj]
|
||||
if candidate['/Subtype'] != '/Form':
|
||||
continue
|
||||
|
||||
@@ -493,81 +462,117 @@ def _find_images(*, pdf, container, shorthand=None):
|
||||
"""
|
||||
|
||||
if container.get('/Type') == '/Page' and '/Contents' in container:
|
||||
# For a /Page the content stream is attached to the page's /Contents
|
||||
page = container
|
||||
contentstream = pypdf.pdf.ContentStream(page.getContents(), pdf)
|
||||
initial_shorthand = shorthand or UNIT_SQUARE
|
||||
elif container.get('/Type') == '/XObject' and \
|
||||
container['/Subtype'] == '/Form':
|
||||
# For a Form XObject that content stream is attached to the XObject
|
||||
contentstream = pypdf.pdf.ContentStream(container, pdf)
|
||||
|
||||
# Set the CTM to the state it was when the "Do" operator was
|
||||
# encountered that is drawing this instance of the Form XObject
|
||||
ctm = _matrix_from_shorthand(shorthand or UNIT_SQUARE)
|
||||
ctm = PdfMatrix(shorthand) if shorthand else PdfMatrix.identity()
|
||||
|
||||
# A Form XObject may provide its own matrix to map form space into
|
||||
# user space. Get this if one exists
|
||||
form_matrix = _matrix_from_shorthand(
|
||||
container.get('/Matrix', UNIT_SQUARE))
|
||||
form_shorthand = container.get('/Matrix', PdfMatrix.identity())
|
||||
form_matrix = PdfMatrix(form_shorthand)
|
||||
|
||||
# Concatenate form matrix with CTM to ensure CTM is correct for
|
||||
# drawing this instance of the XObject
|
||||
ctm = matrix_mult(form_matrix, ctm)
|
||||
initial_shorthand = _shorthand_from_matrix(ctm)
|
||||
ctm = form_matrix @ ctm
|
||||
initial_shorthand = ctm.shorthand
|
||||
else:
|
||||
return
|
||||
|
||||
contentsinfo = _interpret_contents(contentstream, initial_shorthand)
|
||||
contentsinfo = _interpret_contents(container, initial_shorthand)
|
||||
|
||||
yield from _find_inline_images(contentsinfo)
|
||||
yield from _find_regular_images(container, contentsinfo)
|
||||
yield from _find_form_xobject_images(pdf, container, contentsinfo)
|
||||
|
||||
|
||||
def _page_has_text(pdf, page):
|
||||
if not '/Contents' in page:
|
||||
return False
|
||||
def _page_get_textblocks(infile, pageno, xmltext):
|
||||
"""Smarter text detection"""
|
||||
|
||||
# Simple test
|
||||
text = page.extractText()
|
||||
if text.strip() != '':
|
||||
return True
|
||||
root = xmltext
|
||||
if not hasattr(xmltext, 'findall'):
|
||||
return []
|
||||
|
||||
# More nuanced test to deal with quirks of Tesseract PDF generation
|
||||
# Check if there's a Glyphless font
|
||||
try:
|
||||
font = page['/Resources']['/Font']
|
||||
except KeyError:
|
||||
pass
|
||||
else:
|
||||
font_objects = list(font.keys())
|
||||
for font_object in font_objects:
|
||||
basefont = font[font_object]['/BaseFont']
|
||||
if basefont.endswith('GlyphLessFont'):
|
||||
return True
|
||||
def blocks():
|
||||
for span in root.findall('.//span'):
|
||||
bbox_str = span.attrib['bbox']
|
||||
font_size = span.attrib['size']
|
||||
pts = [int(pt) for pt in bbox_str.split()]
|
||||
pts[1] = pts[1] - int(float(font_size) + 0.5)
|
||||
bbox = tuple(pts)
|
||||
yield bbox
|
||||
|
||||
return False
|
||||
def joined_blocks():
|
||||
prev = None
|
||||
for bbox in blocks():
|
||||
if prev is None:
|
||||
prev = bbox
|
||||
if bbox[1] == prev[1] and bbox[3] == prev[3]:
|
||||
gap = prev[2] - bbox[0]
|
||||
height = bbox[3] - bbox[1]
|
||||
if gap < height:
|
||||
# Join boxes
|
||||
prev = (prev[0], prev[1], bbox[2], bbox[3])
|
||||
continue
|
||||
# yield previously joined bboxes and start anew
|
||||
yield prev
|
||||
prev = bbox
|
||||
if prev is not None:
|
||||
yield prev
|
||||
|
||||
return [block for block in joined_blocks()]
|
||||
|
||||
|
||||
def _pdf_get_pageinfo(pdf, pageno: int):
|
||||
def _page_has_text(text_blocks, page_width, page_height):
|
||||
"""Smarter text detection that ignores text in margins"""
|
||||
|
||||
pw, ph = float(page_width), float(page_height)
|
||||
|
||||
margin_ratio = 0.125
|
||||
interior_bbox = (
|
||||
margin_ratio * pw, margin_ratio * ph,
|
||||
(1 - margin_ratio) * pw, (1 - margin_ratio) * ph
|
||||
)
|
||||
|
||||
def rects_intersect(a, b):
|
||||
"""
|
||||
Where (a,b) are 4-tuple rects (left-0, top-1, right-2, bottom-3)
|
||||
https://stackoverflow.com/questions/306316/determine-if-two-rectangles-overlap-each-other
|
||||
Negative signs to account for our coordinates being in the fourth quadrant
|
||||
and the formula assuming the first
|
||||
"""
|
||||
return a[0] < b[2] and a[2] > b[0] and -a[1] > -b[3] and -a[3] < -b[1]
|
||||
|
||||
has_text = False
|
||||
for bbox in text_blocks:
|
||||
if rects_intersect(bbox, interior_bbox):
|
||||
has_text = True
|
||||
break
|
||||
return has_text
|
||||
|
||||
|
||||
def _pdf_get_pageinfo(pdf, pageno: int, infile, xmltext):
|
||||
pageinfo = {}
|
||||
pageinfo['pageno'] = pageno
|
||||
pageinfo['images'] = []
|
||||
|
||||
if isinstance(pdf, Path):
|
||||
pdf = pypdf.PdfFileReader(str(pdf))
|
||||
elif isinstance(pdf, str):
|
||||
pdf = pypdf.PdfFileReader(pdf)
|
||||
|
||||
page = pdf.pages[pageno]
|
||||
|
||||
pageinfo['has_text'] = _page_has_text(pdf, page)
|
||||
pageinfo['textinfo'] = _page_get_textblocks(
|
||||
fspath(infile), pageno, xmltext=xmltext)
|
||||
|
||||
width_pt = page.mediaBox.getWidth()
|
||||
height_pt = page.mediaBox.getHeight()
|
||||
mediabox = [Decimal(d) for d in page.MediaBox.as_list()]
|
||||
width_pt = mediabox[2] - mediabox[0]
|
||||
height_pt = mediabox[3] - mediabox[1]
|
||||
|
||||
pageinfo['has_text'] = _page_has_text(
|
||||
pageinfo['textinfo'], width_pt, height_pt)
|
||||
|
||||
userunit = page.get('/UserUnit', Decimal(1.0))
|
||||
if not isinstance(userunit, Decimal):
|
||||
userunit = Decimal(userunit)
|
||||
pageinfo['userunit'] = userunit
|
||||
pageinfo['width_inches'] = width_pt * userunit / Decimal(72.0)
|
||||
pageinfo['height_inches'] = height_pt * userunit / Decimal(72.0)
|
||||
@@ -582,8 +587,8 @@ def _pdf_get_pageinfo(pdf, pageno: int):
|
||||
_find_images(pdf=pdf, container=page,
|
||||
shorthand=userunit_shorthand)]
|
||||
if pageinfo['images']:
|
||||
xres = max(image['dpi_w'] for image in pageinfo['images'])
|
||||
yres = max(image['dpi_h'] for image in pageinfo['images'])
|
||||
xres = Decimal(max(image.xres for image in pageinfo['images']))
|
||||
yres = Decimal(max(image.yres for image in pageinfo['images']))
|
||||
pageinfo['xres'], pageinfo['yres'] = xres, yres
|
||||
pageinfo['width_pixels'] = \
|
||||
int(round(xres * pageinfo['width_inches']))
|
||||
@@ -593,16 +598,47 @@ def _pdf_get_pageinfo(pdf, pageno: int):
|
||||
return pageinfo
|
||||
|
||||
|
||||
def _pdf_get_all_pageinfo(infile):
|
||||
with universal_open(infile, 'rb') as f:
|
||||
pdf = pypdf.PdfFileReader(f)
|
||||
return [PageInfo(pdf, n) for n in range(pdf.numPages)]
|
||||
def _pdf_get_all_pageinfo(infile, log=None):
|
||||
if not log:
|
||||
log = Mock()
|
||||
|
||||
pdf = pikepdf.open(infile)
|
||||
|
||||
existing_text = ghostscript.extract_text(infile, pageno=None)
|
||||
existing_text = regex_remove_char_tags.sub(b' ', existing_text)
|
||||
|
||||
try:
|
||||
root = ET.fromstringlist([
|
||||
b'<document>\n', existing_text, b'</document>\n'
|
||||
])
|
||||
page_xml = root.findall('page')
|
||||
except ET.ParseError as e:
|
||||
log.error(
|
||||
"An error occurred while attempting to retrieve existing text in "
|
||||
"the input file. Will attempt to continue assuming that there is "
|
||||
"no existing text in the file. The error was:")
|
||||
log.error(e)
|
||||
page_xml = [None] * len(pdf.pages)
|
||||
|
||||
page_count_difference = len(pdf.pages) - len(page_xml)
|
||||
if page_count_difference != 0:
|
||||
log.error("The number of pages in the input file is inconsistent.")
|
||||
if page_count_difference > 0:
|
||||
page_xml.extend([None] * page_count_difference)
|
||||
|
||||
pages = []
|
||||
for n in range(len(pdf.pages)):
|
||||
page = PageInfo(pdf, n, infile, page_xml[n])
|
||||
pages.append(page)
|
||||
|
||||
return pages, pdf
|
||||
|
||||
|
||||
class PageInfo:
|
||||
def __init__(self, pdf, pageno):
|
||||
def __init__(self, pdf, pageno, infile, xmltext):
|
||||
self._pageno = pageno
|
||||
self._pageinfo = _pdf_get_pageinfo(pdf, pageno)
|
||||
self._infile = infile
|
||||
self._pageinfo = _pdf_get_pageinfo(pdf, pageno, infile, xmltext)
|
||||
|
||||
@property
|
||||
def pageno(self):
|
||||
@@ -643,6 +679,9 @@ class PageInfo:
|
||||
def images(self):
|
||||
return self._pageinfo['images']
|
||||
|
||||
def get_textareas(self):
|
||||
yield from self._pageinfo['textinfo']
|
||||
|
||||
@property
|
||||
def xres(self):
|
||||
return self._pageinfo.get('xres', None)
|
||||
@@ -662,10 +701,6 @@ class PageInfo:
|
||||
else:
|
||||
return '1.5'
|
||||
|
||||
@property
|
||||
def images(self):
|
||||
return self._pageinfo['images']
|
||||
|
||||
def __repr__(self):
|
||||
return (
|
||||
'<PageInfo '
|
||||
@@ -678,11 +713,12 @@ class PageInfo:
|
||||
|
||||
class PdfInfo:
|
||||
"""Get summary information about a PDF
|
||||
|
||||
|
||||
"""
|
||||
def __init__(self, infile):
|
||||
def __init__(self, infile, log=None):
|
||||
self._infile = infile
|
||||
self._pages = _pdf_get_all_pageinfo(infile)
|
||||
self._pages, pdf = _pdf_get_all_pageinfo(infile, log=log)
|
||||
self._needs_rendering = pdf.root.get('/NeedsRendering', False)
|
||||
|
||||
@property
|
||||
def pages(self):
|
||||
@@ -697,6 +733,16 @@ class PdfInfo:
|
||||
def has_userunit(self):
|
||||
return any(page.userunit != 1.0 for page in self.pages)
|
||||
|
||||
@property
|
||||
def filename(self):
|
||||
if not isinstance(self._infile, (str, Path)):
|
||||
raise NotImplementedError("can't get filename from stream")
|
||||
return self._infile
|
||||
|
||||
@property
|
||||
def needs_rendering(self):
|
||||
return self._needs_rendering
|
||||
|
||||
def __getitem__(self, item):
|
||||
return self._pages[item]
|
||||
|
||||
@@ -706,15 +752,6 @@ class PdfInfo:
|
||||
def __repr__(self):
|
||||
return "<PdfInfo('...'), page count={}>".format(len(self))
|
||||
|
||||
# def __getstate__(self):
|
||||
# state = {'_infile': self._infile}
|
||||
# return state
|
||||
#
|
||||
# def __setstate__(self, state):
|
||||
# self._infile = state['_infile']
|
||||
# self._pages = _pdf_get_all_pageinfo(self._infile)
|
||||
|
||||
|
||||
def main():
|
||||
import argparse
|
||||
parser = argparse.ArgumentParser()
|
||||
@@ -1,4 +1,8 @@
|
||||
pytest >= 3.0
|
||||
pytest >= 3.2
|
||||
pytest-helpers-namespace
|
||||
pytest-xdist
|
||||
pytest-cov
|
||||
pytest-cov
|
||||
python-xmp-toolkit # requires apt-get install libexempi3
|
||||
# or brew install exempi
|
||||
PyPDF2 >= 1.26.0
|
||||
#PyMuPDF == 1.13.4 # optional
|
||||
|
||||
Binary file not shown.
+1
@@ -0,0 +1 @@
|
||||
Tesseract Open Source OCR Engine v3.05.01 with Leptonica
|
||||
@@ -0,0 +1,25 @@
|
||||
é la Waterman
|
||||
|
||||
h ens linzen
|
||||
|
||||
3 liter water
|
||||
|
||||
3 mien
|
||||
|
||||
bloem} hater
|
||||
|
||||
2 kopjes melk
|
||||
|
||||
laurier, kruidnagel, kerrie, gout
|
||||
|
||||
Be linzen wassen en in¢l liter kokend wa-
|
||||
ter 1 dag laten weken. 2 liter water bi'
|
||||
de linzen voegen, gender hat water wagrin
|
||||
ze geweekt zijn af te gieten. De helft Van
|
||||
de mien bakken met laurier en kruiénagal.
|
||||
Alla mien, kerrie en zout bij de linzen
|
||||
voegen. A1135 aan de Rook brengem. Van de
|
||||
bloem mat boter-en melk een papje maken en
|
||||
verder afmaken met de soap. A13 de linzen
|
||||
gaar zijn is de seep klaar.
|
||||
|
||||
Binary file not shown.
+3
@@ -0,0 +1,3 @@
|
||||
Tesseract Open Source OCR Engine v3.05.01 with Leptonica
|
||||
Too few characters. Skipping this page
|
||||
OSD: Weak margin (0.00) for 24 blob text block, but using orientation anyway: 0
|
||||
@@ -0,0 +1,4 @@
|
||||
|
||||
|
||||
This shnuld be a perfect circle-
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head>
|
||||
<title></title>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
|
||||
<meta name='ocr-system' content='tesseract 3.05.01' />
|
||||
<meta name='ocr-capabilities' content='ocr_page ocr_carea ocr_par ocr_line ocrx_word'/>
|
||||
</head>
|
||||
<body>
|
||||
<div class='ocr_page' id='page_1' title='image "/var/folders/37/78_114p552q16vv6vmgm5kr00000gn/T/com.github.ocrmypdf.7vjmeixk/000001.ocr.png"; bbox 0 0 1000 800; ppageno 0'>
|
||||
<div class='ocr_carea' id='block_1_1' title="bbox 296 96 704 504">
|
||||
<p class='ocr_par' id='par_1_1' lang='eng' title="bbox 296 96 704 504">
|
||||
<span class='ocr_line' id='line_1_1' title="bbox 296 96 704 504; baseline 0 296; x_size 169.33333; x_descenders 42.333332; x_ascenders 42.333336"><span class='ocrx_word' id='word_1_1' title='bbox 296 96 704 504; x_wconf 95'><strong> </strong></span>
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
<div class='ocr_carea' id='block_1_2' title="bbox 150 592 841 622">
|
||||
<p class='ocr_par' id='par_1_2' lang='eng' title="bbox 150 592 841 622">
|
||||
<span class='ocr_line' id='line_1_2' title="bbox 150 592 841 622; baseline 0 -6; x_size 30; x_descenders 6; x_ascenders 8"><span class='ocrx_word' id='word_1_2' title='bbox 150 592 230 616; x_wconf 85'><strong>This</strong></span> <span class='ocrx_word' id='word_1_3' title='bbox 260 592 384 616; x_wconf 81'>shnuld</span> <span class='ocrx_word' id='word_1_4' title='bbox 413 592 449 616; x_wconf 81'><strong>be</strong></span> <span class='ocrx_word' id='word_1_5' title='bbox 479 600 493 616; x_wconf 85'><em>a</em></span> <span class='ocrx_word' id='word_1_6' title='bbox 523 592 668 622; x_wconf 76'>perfect</span> <span class='ocrx_word' id='word_1_7' title='bbox 698 592 841 616; x_wconf 76'><strong>circle-</strong></span>
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,3 @@
|
||||
Tesseract Open Source OCR Engine v3.05.01 with Leptonica
|
||||
Too few characters. Skipping this page
|
||||
OSD: Weak margin (0.00) for 24 blob text block, but using orientation anyway: 0
|
||||
@@ -0,0 +1,4 @@
|
||||
|
||||
|
||||
This shnuld be a perfect circle-
|
||||
|
||||
BIN
Binary file not shown.
+1
@@ -0,0 +1 @@
|
||||
Tesseract Open Source OCR Engine v3.05.01 with Leptonica
|
||||
+123
@@ -0,0 +1,123 @@
|
||||
The LinnSequencer
|
||||
32 Track MIDI Sequence Recorder
|
||||
|
||||
The LinnSequencer is a state—of—the-art composition and performance tool for the professional musician. It is
|
||||
|
||||
extremely powerful, yet amazingly simple to learn and use. It’s many remarkable features include:
|
||||
|
||||
0 Operation is similar to multi—track tape recorder with PLAY, STOP, RECORD, FAST
|
||||
FORWARD, REWIND, and LOCATE controls.
|
||||
|
||||
0 Each of the 100 sequences contains 32 simultaneous, polyphonic tracks. Each track may
|
||||
be assigned to one of 16 MIDI channels. Simultaneously plays up to 16 polyphonic
|
||||
|
||||
synthesizers !
|
||||
|
||||
0 Ultra—fast 3 1/2 ” disk drive stores complex songs in seconds and holds over 110,000 notes
|
||||
|
||||
per disk!
|
||||
|
||||
0 One or all tracks may be TRANSPOSED at the touch of a key.
|
||||
0 Exclusive real—time ERASE function makes editing FAST.
|
||||
0 Exclusive REPEAT function automatically repeats any held notes at a pre-selected
|
||||
|
||||
rhythmic value.
|
||||
|
||||
0 TIMING CORRECTION works during playback and operates without ‘chopping’ notes.
|
||||
|
||||
0 Optional SMPTE time code synchronization.
|
||||
|
||||
0 Optional remote control.
|
||||
|
||||
Recording 3 Sequence
|
||||
|
||||
To record a sequence, simply press RECORD and PLAY,
|
||||
then play your MIDI keyboard in time to the Sequencer’s
|
||||
click track. When the sequence loops back around to bar 1,
|
||||
you’ll hear what you played—only all timing errors will be
|
||||
|
||||
corrected! (Timing correction may be adjusted or defeated).
|
||||
|
||||
Any additional notes played will be added into the track
|
||||
—existing notes are not erased while recording!
|
||||
|
||||
FAST FORWARD, REWIND, and LOCATE controls
|
||||
may be used at any time to quickly access any location in
|
||||
your sequence for spot—recording. To overdub a new part,
|
||||
select a different track and start recording~while you
|
||||
record, the first‘track will play in perfect sync (unless you
|
||||
MUTE it, or SOLO another track). In this way, up to 32
|
||||
tracks may be overdubbed! All MIDI effects are recorded
|
||||
including pitch bend, modulation, velocity, aftertouch,
|
||||
sustain pedal, and program changes!
|
||||
|
||||
Editing
|
||||
|
||||
To erase a wrong note, simply hold ERASE and press
|
||||
the note to be erased just before it plays in the sequence—
|
||||
when played back, it will be gone. Notes may also be
|
||||
|
||||
added, erased, or changed using the SINGLE STEP func-
|
||||
tion. To overdub notes at specific points within a sequence,
|
||||
|
||||
Additional Features
|
||||
|
||||
simply use LOCATE, FAST FORWARD, or REWIND to
|
||||
find the desired bar number, then start recording.
|
||||
|
||||
The INSERT/COPY function allows you to move bars
|
||||
from one location to another—in the same sequence or a
|
||||
different one. For example, you might insert a copy of the
|
||||
first verse between the second chorus and the bridge.
|
||||
DELETE BARS operates the same way to remove
|
||||
unwanted sections.
|
||||
|
||||
Creating a Song
|
||||
|
||||
One way to create a song is to record each track all the
|
||||
way through (up to 999 bars). Another way is to record
|
||||
each basic section (verse, chorus, etc.) in individual
|
||||
sequences, then use the CREATE SONG function to “chain”
|
||||
them together. CREATE SONG will then automatically
|
||||
copy all the parts into a new sequence. If desired, you can
|
||||
even set the last few bars to repeat infinitely, for a fadeout.
|
||||
|
||||
Composition Without Compromise
|
||||
|
||||
The technology you use should never be so complex that
|
||||
it interferes with the creative process. That’s precisely why
|
||||
the LinnSequencer is designed to let you compose, record
|
||||
and edit while devoting your undivided attention to your
|
||||
music. See your Linn dealer today for a demonstration!
|
||||
|
||||
0 Simple, easy to learn operation—the 32 character LCD display clearly guides you through all operations. If needed, the
|
||||
|
||||
HELP button displays additional explanations.
|
||||
|
||||
0 Non-destructive recording—existing notes are not erased while recording.
|
||||
0 Two FOOTSWITCH INPUTS may be assigned to remotely control many of the commonly used functions, including
|
||||
|
||||
ERASE, REPEAT, PLAY/STOP, or LOCATE.
|
||||
|
||||
0 Two TRIGGER OUTPUTS may be programmed to output pulses at any selected note value.
|
||||
|
||||
0 Will sync to standard LinnDrum or Linn 9000 sync tone.
|
||||
|
||||
' Utilizes ultra high—speed, 8 MHz 80186 16 bit computer internally for FAST operation.
|
||||
0 TEMPO may be specified in BEATS-PER—MINUTE or FRAMES-PER—BEAT at 24, 25, or 30 frames per second,
|
||||
|
||||
(even drop frame!)
|
||||
|
||||
0 TEMPO may be entered numerically, adjustable in tenths of a Beat-Per-Minute increments, or by tapping quarter notes
|
||||
|
||||
on the TAP TEMPO button.
|
||||
|
||||
0 TEMPO CHANGES may be programmed into a sequence, with smooth transitions if desired.
|
||||
° Any TIME SIGNATURE may be used, and may be changed within a song.
|
||||
|
||||
E1111
|
||||
Linn Electronics, Inc.
|
||||
|
||||
18720 Oxnard Street, Tarzana, CA 91356
|
||||
(818) 7088131 T ELEX #298949 LINN UR
|
||||
|
||||
@@ -0,0 +1,335 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head>
|
||||
<title></title>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
|
||||
<meta name='ocr-system' content='tesseract 3.05.01' />
|
||||
<meta name='ocr-capabilities' content='ocr_page ocr_carea ocr_par ocr_line ocrx_word'/>
|
||||
</head>
|
||||
<body>
|
||||
<div class='ocr_page' id='page_1' title='image "/var/folders/37/78_114p552q16vv6vmgm5kr00000gn/T/com.github.ocrmypdf.wahjk6fa/000001.ocr.png"; bbox 0 0 2550 3300; ppageno 0'>
|
||||
<div class='ocr_carea' id='block_1_1' title="bbox 582 131 1968 303">
|
||||
<p class='ocr_par' id='par_1_1' lang='eng' title="bbox 582 131 1968 303">
|
||||
<span class='ocr_line' id='line_1_1' title="bbox 882 131 1657 217; baseline 0.001 -17; x_size 85; x_descenders 16; x_ascenders 19"><span class='ocrx_word' id='word_1_1' title='bbox 882 132 1036 202; x_wconf 86'>The</span> <span class='ocrx_word' id='word_1_2' title='bbox 1061 131 1657 217; x_wconf 84'>LinnSequencer</span>
|
||||
</span>
|
||||
<span class='ocr_line' id='line_1_2' title="bbox 582 215 1968 303; baseline 0 -17; x_size 87; x_descenders 16; x_ascenders 21"><span class='ocrx_word' id='word_1_3' title='bbox 582 215 674 286; x_wconf 90'>32</span> <span class='ocrx_word' id='word_1_4' title='bbox 697 218 923 288; x_wconf 84'>Track</span> <span class='ocrx_word' id='word_1_5' title='bbox 948 218 1181 287; x_wconf 94'><strong>MIDI</strong></span> <span class='ocrx_word' id='word_1_6' title='bbox 1208 217 1575 303; x_wconf 89'>Sequence</span> <span class='ocrx_word' id='word_1_7' title='bbox 1600 218 1968 288; x_wconf 83'>Recorder</span>
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
<div class='ocr_carea' id='block_1_2' title="bbox 347 380 2188 574">
|
||||
<p class='ocr_par' id='par_1_2' lang='eng' title="bbox 347 380 2188 423">
|
||||
<span class='ocr_line' id='line_1_3' title="bbox 347 380 2188 423; baseline -0.001 -12; x_size 38; x_descenders 8; x_ascenders 10"><span class='ocrx_word' id='word_1_8' title='bbox 347 380 412 410; x_wconf 86'>The</span> <span class='ocrx_word' id='word_1_9' title='bbox 424 380 676 417; x_wconf 85'>LinnSequencer</span> <span class='ocrx_word' id='word_1_10' title='bbox 688 380 712 411; x_wconf 87'>is</span> <span class='ocrx_word' id='word_1_11' title='bbox 724 390 743 411; x_wconf 90'>a</span> <span class='ocrx_word' id='word_1_12' title='bbox 754 381 1005 423; x_wconf 79'>state—of—the-art</span> <span class='ocrx_word' id='word_1_13' title='bbox 1017 380 1226 418; x_wconf 86'>composition</span> <span class='ocrx_word' id='word_1_14' title='bbox 1238 381 1299 411; x_wconf 88'>and</span> <span class='ocrx_word' id='word_1_15' title='bbox 1311 380 1525 418; x_wconf 85'>performance</span> <span class='ocrx_word' id='word_1_16' title='bbox 1536 380 1602 411; x_wconf 85'>tool</span> <span class='ocrx_word' id='word_1_17' title='bbox 1615 380 1663 411; x_wconf 82'>for</span> <span class='ocrx_word' id='word_1_18' title='bbox 1674 381 1725 410; x_wconf 94'>the</span> <span class='ocrx_word' id='word_1_19' title='bbox 1737 380 1940 417; x_wconf 85'>professional</span> <span class='ocrx_word' id='word_1_20' title='bbox 1952 380 2112 411; x_wconf 87'>musician.</span> <span class='ocrx_word' id='word_1_21' title='bbox 2127 381 2152 410; x_wconf 90'>It</span> <span class='ocrx_word' id='word_1_22' title='bbox 2164 380 2188 410; x_wconf 90'>is</span>
|
||||
</span>
|
||||
</p>
|
||||
|
||||
<p class='ocr_par' id='par_1_3' lang='eng' title="bbox 347 430 1988 468">
|
||||
<span class='ocr_line' id='line_1_4' title="bbox 347 430 1988 468; baseline 0 -8; x_size 37; x_descenders 7; x_ascenders 9"><span class='ocrx_word' id='word_1_23' title='bbox 347 430 507 467; x_wconf 86'>extremely</span> <span class='ocrx_word' id='word_1_24' title='bbox 518 430 677 467; x_wconf 84'>powerful,</span> <span class='ocrx_word' id='word_1_25' title='bbox 691 435 739 467; x_wconf 91'>yet</span> <span class='ocrx_word' id='word_1_26' title='bbox 752 430 924 468; x_wconf 87'>amazingly</span> <span class='ocrx_word' id='word_1_27' title='bbox 936 430 1044 468; x_wconf 85'>simple</span> <span class='ocrx_word' id='word_1_28' title='bbox 1055 435 1087 461; x_wconf 87'>to</span> <span class='ocrx_word' id='word_1_29' title='bbox 1099 431 1183 461; x_wconf 88'>learn</span> <span class='ocrx_word' id='word_1_30' title='bbox 1195 431 1257 461; x_wconf 90'>and</span> <span class='ocrx_word' id='word_1_31' title='bbox 1269 440 1329 461; x_wconf 89'>use.</span> <span class='ocrx_word' id='word_1_32' title='bbox 1344 431 1393 461; x_wconf 87'>It’s</span> <span class='ocrx_word' id='word_1_33' title='bbox 1406 440 1499 467; x_wconf 91'>many</span> <span class='ocrx_word' id='word_1_34' title='bbox 1510 430 1701 461; x_wconf 88'>remarkable</span> <span class='ocrx_word' id='word_1_35' title='bbox 1714 430 1843 460; x_wconf 85'>features</span> <span class='ocrx_word' id='word_1_36' title='bbox 1856 430 1988 461; x_wconf 87'>include:</span>
|
||||
</span>
|
||||
</p>
|
||||
|
||||
<p class='ocr_par' id='par_1_4' lang='eng' title="bbox 350 482 2093 574">
|
||||
<span class='ocr_line' id='line_1_5' title="bbox 350 482 2093 527; baseline 0 -9; x_size 43; x_descenders 7; x_ascenders 11"><span class='ocrx_word' id='word_1_37' title='bbox 350 490 368 508; x_wconf 68'><strong>0</strong></span> <span class='ocrx_word' id='word_1_38' title='bbox 383 482 585 526; x_wconf 88'>Operation</span> <span class='ocrx_word' id='word_1_39' title='bbox 598 482 627 518; x_wconf 89'>is</span> <span class='ocrx_word' id='word_1_40' title='bbox 641 482 776 518; x_wconf 88'>similar</span> <span class='ocrx_word' id='word_1_41' title='bbox 789 488 829 518; x_wconf 88'>to</span> <span class='ocrx_word' id='word_1_42' title='bbox 843 482 1062 519; x_wconf 86'>multi—track</span> <span class='ocrx_word' id='word_1_43' title='bbox 1076 488 1160 527; x_wconf 92'>tape</span> <span class='ocrx_word' id='word_1_44' title='bbox 1173 483 1336 519; x_wconf 88'>recorder</span> <span class='ocrx_word' id='word_1_45' title='bbox 1350 482 1436 518; x_wconf 87'>with</span> <span class='ocrx_word' id='word_1_46' title='bbox 1451 483 1580 525; x_wconf 90'>PLAY,</span> <span class='ocrx_word' id='word_1_47' title='bbox 1598 483 1724 525; x_wconf 90'>STOP,</span> <span class='ocrx_word' id='word_1_48' title='bbox 1741 483 1957 525; x_wconf 89'>RECORD,</span> <span class='ocrx_word' id='word_1_49' title='bbox 1974 483 2093 518; x_wconf 88'>FAST</span>
|
||||
</span>
|
||||
<span class='ocr_line' id='line_1_6' title="bbox 383 532 1345 574; baseline 0.001 -7; x_size 43; x_descenders 7; x_ascenders 11"><span class='ocrx_word' id='word_1_50' title='bbox 383 532 635 574; x_wconf 88'>FORWARD,</span> <span class='ocrx_word' id='word_1_51' title='bbox 652 532 865 574; x_wconf 89'>REWIND,</span> <span class='ocrx_word' id='word_1_52' title='bbox 882 532 956 568; x_wconf 91'>and</span> <span class='ocrx_word' id='word_1_53' title='bbox 971 532 1163 568; x_wconf 90'>LOCATE</span> <span class='ocrx_word' id='word_1_54' title='bbox 1177 532 1345 568; x_wconf 87'>controls.</span>
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
<div class='ocr_carea' id='block_1_3' title="bbox 349 589 2136 685">
|
||||
<p class='ocr_par' id='par_1_5' lang='eng' title="bbox 349 589 2136 685">
|
||||
<span class='ocr_line' id='line_1_7' title="bbox 349 589 2136 634; baseline 0.001 -9; x_size 44; x_descenders 8; x_ascenders 11"><span class='ocrx_word' id='word_1_55' title='bbox 349 597 368 615; x_wconf 67'><strong>0</strong></span> <span class='ocrx_word' id='word_1_56' title='bbox 383 590 482 625; x_wconf 90'>Each</span> <span class='ocrx_word' id='word_1_57' title='bbox 496 589 539 625; x_wconf 87'>of</span> <span class='ocrx_word' id='word_1_58' title='bbox 549 590 611 626; x_wconf 92'>the</span> <span class='ocrx_word' id='word_1_59' title='bbox 625 590 686 625; x_wconf 91'>100</span> <span class='ocrx_word' id='word_1_60' title='bbox 700 601 895 634; x_wconf 89'>sequences</span> <span class='ocrx_word' id='word_1_61' title='bbox 909 590 1075 626; x_wconf 88'>contains</span> <span class='ocrx_word' id='word_1_62' title='bbox 1090 591 1135 626; x_wconf 89'>32</span> <span class='ocrx_word' id='word_1_63' title='bbox 1149 590 1418 633; x_wconf 87'>simultaneous,</span> <span class='ocrx_word' id='word_1_64' title='bbox 1435 590 1661 634; x_wconf 89'>polyphonic</span> <span class='ocrx_word' id='word_1_65' title='bbox 1674 590 1802 626; x_wconf 85'>tracks.</span> <span class='ocrx_word' id='word_1_66' title='bbox 1819 590 1921 626; x_wconf 89'>Each</span> <span class='ocrx_word' id='word_1_67' title='bbox 1934 590 2035 626; x_wconf 88'>track</span> <span class='ocrx_word' id='word_1_68' title='bbox 2050 600 2136 634; x_wconf 89'>may</span>
|
||||
</span>
|
||||
<span class='ocr_line' id='line_1_8' title="bbox 383 639 2022 685; baseline 0.001 -10; x_size 44; x_descenders 8; x_ascenders 11"><span class='ocrx_word' id='word_1_69' title='bbox 383 639 428 675; x_wconf 95'>be</span> <span class='ocrx_word' id='word_1_70' title='bbox 442 639 607 684; x_wconf 88'>assigned</span> <span class='ocrx_word' id='word_1_71' title='bbox 621 645 659 676; x_wconf 92'>to</span> <span class='ocrx_word' id='word_1_72' title='bbox 674 650 745 676; x_wconf 91'>one</span> <span class='ocrx_word' id='word_1_73' title='bbox 759 640 801 676; x_wconf 84'>of</span> <span class='ocrx_word' id='word_1_74' title='bbox 813 641 851 676; x_wconf 92'>16</span> <span class='ocrx_word' id='word_1_75' title='bbox 864 641 980 675; x_wconf 90'>MIDI</span> <span class='ocrx_word' id='word_1_76' title='bbox 996 640 1176 676; x_wconf 88'>channels.</span> <span class='ocrx_word' id='word_1_77' title='bbox 1194 640 1498 684; x_wconf 90'>Simultaneously</span> <span class='ocrx_word' id='word_1_78' title='bbox 1510 640 1609 685; x_wconf 90'>plays</span> <span class='ocrx_word' id='word_1_79' title='bbox 1624 651 1674 684; x_wconf 91'>up</span> <span class='ocrx_word' id='word_1_80' title='bbox 1688 645 1727 676; x_wconf 90'>to</span> <span class='ocrx_word' id='word_1_81' title='bbox 1742 641 1780 676; x_wconf 94'>16</span> <span class='ocrx_word' id='word_1_82' title='bbox 1794 640 2022 684; x_wconf 87'>polyphonic</span>
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
<div class='ocr_carea' id='block_1_4' title="bbox 384 689 632 734">
|
||||
<p class='ocr_par' id='par_1_6' lang='eng' title="bbox 384 689 632 734">
|
||||
<span class='ocr_line' id='line_1_9' title="bbox 384 689 632 734; baseline 0.004 -9; x_size 46; x_descenders 9; x_ascenders 12"><span class='ocrx_word' id='word_1_83' title='bbox 384 689 618 734; x_wconf 84'>synthesizers</span> <span class='ocrx_word' id='word_1_84' title='bbox 625 690 632 726; x_wconf 85'><strong>!</strong></span>
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
<div class='ocr_carea' id='block_1_5' title="bbox 349 748 2117 793">
|
||||
<p class='ocr_par' id='par_1_7' lang='eng' title="bbox 349 748 2117 793">
|
||||
<span class='ocr_line' id='line_1_10' title="bbox 349 748 2117 793; baseline 0 -9; x_size 45; x_descenders 9; x_ascenders 11"><span class='ocrx_word' id='word_1_85' title='bbox 349 755 367 774; x_wconf 66'><strong>0</strong></span> <span class='ocrx_word' id='word_1_86' title='bbox 383 748 573 784; x_wconf 87'>Ultra—fast</span> <span class='ocrx_word' id='word_1_87' title='bbox 588 749 606 784; x_wconf 90'>3</span> <span class='ocrx_word' id='word_1_88' title='bbox 616 749 652 784; x_wconf 86'>1/2</span> <span class='ocrx_word' id='word_1_89' title='bbox 663 749 677 764; x_wconf 87'><em>”</em></span> <span class='ocrx_word' id='word_1_90' title='bbox 694 748 775 784; x_wconf 91'>disk</span> <span class='ocrx_word' id='word_1_91' title='bbox 790 748 887 784; x_wconf 89'>drive</span> <span class='ocrx_word' id='word_1_92' title='bbox 901 754 1012 785; x_wconf 85'>stores</span> <span class='ocrx_word' id='word_1_93' title='bbox 1027 748 1194 793; x_wconf 87'>complex</span> <span class='ocrx_word' id='word_1_94' title='bbox 1208 760 1316 793; x_wconf 87'>songs</span> <span class='ocrx_word' id='word_1_95' title='bbox 1330 748 1368 784; x_wconf 87'>in</span> <span class='ocrx_word' id='word_1_96' title='bbox 1382 748 1535 785; x_wconf 87'>seconds</span> <span class='ocrx_word' id='word_1_97' title='bbox 1550 748 1624 784; x_wconf 89'>and</span> <span class='ocrx_word' id='word_1_98' title='bbox 1638 748 1746 784; x_wconf 87'>holds</span> <span class='ocrx_word' id='word_1_99' title='bbox 1761 759 1844 784; x_wconf 85'>over</span> <span class='ocrx_word' id='word_1_100' title='bbox 1859 749 2000 791; x_wconf 88'>110,000</span> <span class='ocrx_word' id='word_1_101' title='bbox 2013 753 2117 784; x_wconf 89'>notes</span>
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
<div class='ocr_carea' id='block_1_6' title="bbox 383 797 554 842">
|
||||
<p class='ocr_par' id='par_1_8' lang='eng' title="bbox 383 797 554 842">
|
||||
<span class='ocr_line' id='line_1_11' title="bbox 383 797 554 842; baseline 0 -8; x_size 45; x_descenders 8; x_ascenders 12"><span class='ocrx_word' id='word_1_102' title='bbox 383 808 446 842; x_wconf 82'>per</span> <span class='ocrx_word' id='word_1_103' title='bbox 459 797 554 834; x_wconf 86'>disk!</span>
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
<div class='ocr_carea' id='block_1_7' title="bbox 349 855 2030 1016">
|
||||
<p class='ocr_par' id='par_1_9' lang='eng' title="bbox 349 855 2030 1016">
|
||||
<span class='ocr_line' id='line_1_12' title="bbox 350 855 1638 900; baseline 0.001 -9; x_size 45; x_descenders 9; x_ascenders 11"><span class='ocrx_word' id='word_1_104' title='bbox 350 863 367 881; x_wconf 71'><strong>0</strong></span> <span class='ocrx_word' id='word_1_105' title='bbox 383 856 464 891; x_wconf 90'>One</span> <span class='ocrx_word' id='word_1_106' title='bbox 478 866 520 891; x_wconf 87'>or</span> <span class='ocrx_word' id='word_1_107' title='bbox 534 855 580 891; x_wconf 88'>all</span> <span class='ocrx_word' id='word_1_108' title='bbox 594 856 712 892; x_wconf 89'>tracks</span> <span class='ocrx_word' id='word_1_109' title='bbox 726 867 811 900; x_wconf 90'>may</span> <span class='ocrx_word' id='word_1_110' title='bbox 823 856 869 892; x_wconf 88'>be</span> <span class='ocrx_word' id='word_1_111' title='bbox 882 856 1212 892; x_wconf 90'>TRANSPOSED</span> <span class='ocrx_word' id='word_1_112' title='bbox 1227 861 1264 892; x_wconf 90'>at</span> <span class='ocrx_word' id='word_1_113' title='bbox 1277 856 1338 892; x_wconf 85'>the</span> <span class='ocrx_word' id='word_1_114' title='bbox 1351 856 1463 892; x_wconf 90'>touch</span> <span class='ocrx_word' id='word_1_115' title='bbox 1477 856 1520 892; x_wconf 89'>of</span> <span class='ocrx_word' id='word_1_116' title='bbox 1531 867 1554 892; x_wconf 90'>a</span> <span class='ocrx_word' id='word_1_117' title='bbox 1568 856 1638 900; x_wconf 89'>key.</span>
|
||||
</span>
|
||||
<span class='ocr_line' id='line_1_13' title="bbox 350 913 1535 958; baseline 0.001 -9; x_size 44; x_descenders 8; x_ascenders 11"><span class='ocrx_word' id='word_1_118' title='bbox 350 921 367 939; x_wconf 70'><strong>0</strong></span> <span class='ocrx_word' id='word_1_119' title='bbox 383 913 568 950; x_wconf 84'>Exclusive</span> <span class='ocrx_word' id='word_1_120' title='bbox 581 913 756 950; x_wconf 87'>real—time</span> <span class='ocrx_word' id='word_1_121' title='bbox 769 914 929 950; x_wconf 91'>ERASE</span> <span class='ocrx_word' id='word_1_122' title='bbox 944 914 1114 950; x_wconf 87'>function</span> <span class='ocrx_word' id='word_1_123' title='bbox 1128 914 1251 950; x_wconf 88'>makes</span> <span class='ocrx_word' id='word_1_124' title='bbox 1266 914 1400 958; x_wconf 87'>editing</span> <span class='ocrx_word' id='word_1_125' title='bbox 1414 915 1535 950; x_wconf 91'>FAST.</span>
|
||||
</span>
|
||||
<span class='ocr_line' id='line_1_14' title="bbox 349 971 2030 1016; baseline 0.001 -10; x_size 44; x_descenders 8; x_ascenders 11"><span class='ocrx_word' id='word_1_126' title='bbox 349 979 367 997; x_wconf 67'><strong>0</strong></span> <span class='ocrx_word' id='word_1_127' title='bbox 382 971 568 1007; x_wconf 83'>Exclusive</span> <span class='ocrx_word' id='word_1_128' title='bbox 582 972 773 1007; x_wconf 87'>REPEAT</span> <span class='ocrx_word' id='word_1_129' title='bbox 787 972 958 1008; x_wconf 86'>function</span> <span class='ocrx_word' id='word_1_130' title='bbox 971 972 1245 1016; x_wconf 89'>automatically</span> <span class='ocrx_word' id='word_1_131' title='bbox 1258 977 1396 1016; x_wconf 90'>repeats</span> <span class='ocrx_word' id='word_1_132' title='bbox 1410 983 1481 1016; x_wconf 88'>any</span> <span class='ocrx_word' id='word_1_133' title='bbox 1493 972 1578 1008; x_wconf 91'>held</span> <span class='ocrx_word' id='word_1_134' title='bbox 1592 977 1694 1008; x_wconf 91'>notes</span> <span class='ocrx_word' id='word_1_135' title='bbox 1709 977 1746 1008; x_wconf 85'>at</span> <span class='ocrx_word' id='word_1_136' title='bbox 1760 982 1783 1008; x_wconf 89'>a</span> <span class='ocrx_word' id='word_1_137' title='bbox 1796 972 2030 1016; x_wconf 87'>pre-selected</span>
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
<div class='ocr_carea' id='block_1_8' title="bbox 382 1021 689 1065">
|
||||
<p class='ocr_par' id='par_1_10' lang='eng' title="bbox 382 1021 689 1065">
|
||||
<span class='ocr_line' id='line_1_15' title="bbox 382 1021 689 1065; baseline 0.003 -8; x_size 45; x_descenders 8; x_ascenders 12"><span class='ocrx_word' id='word_1_138' title='bbox 382 1021 564 1065; x_wconf 87'>rhythmic</span> <span class='ocrx_word' id='word_1_139' title='bbox 577 1021 689 1058; x_wconf 86'>value.</span>
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
<div class='ocr_carea' id='block_1_9' title="bbox 349 1080 2174 1125">
|
||||
<p class='ocr_par' id='par_1_11' lang='eng' title="bbox 349 1080 2174 1125">
|
||||
<span class='ocr_line' id='line_1_16' title="bbox 349 1080 2174 1125; baseline 0.001 -11; x_size 45; x_descenders 9; x_ascenders 11"><span class='ocrx_word' id='word_1_140' title='bbox 349 1087 367 1105; x_wconf 73'><strong>0</strong></span> <span class='ocrx_word' id='word_1_141' title='bbox 382 1080 567 1115; x_wconf 87'>TIMING</span> <span class='ocrx_word' id='word_1_142' title='bbox 582 1080 908 1116; x_wconf 90'>CORRECTION</span> <span class='ocrx_word' id='word_1_143' title='bbox 921 1080 1041 1116; x_wconf 90'>works</span> <span class='ocrx_word' id='word_1_144' title='bbox 1056 1080 1186 1124; x_wconf 86'>during</span> <span class='ocrx_word' id='word_1_145' title='bbox 1199 1080 1378 1124; x_wconf 89'>playback</span> <span class='ocrx_word' id='word_1_146' title='bbox 1392 1080 1466 1116; x_wconf 90'>and</span> <span class='ocrx_word' id='word_1_147' title='bbox 1480 1085 1644 1124; x_wconf 87'>operates</span> <span class='ocrx_word' id='word_1_148' title='bbox 1658 1080 1814 1116; x_wconf 91'>without</span> <span class='ocrx_word' id='word_1_149' title='bbox 1831 1080 2044 1125; x_wconf 87'>‘chopping’</span> <span class='ocrx_word' id='word_1_150' title='bbox 2061 1085 2174 1116; x_wconf 88'>notes.</span>
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
<div class='ocr_carea' id='block_1_10' title="bbox 349 1137 1287 1182">
|
||||
<p class='ocr_par' id='par_1_12' lang='eng' title="bbox 349 1137 1287 1182">
|
||||
<span class='ocr_line' id='line_1_17' title="bbox 349 1137 1287 1182; baseline 0.001 -9; x_size 45; x_descenders 9; x_ascenders 11"><span class='ocrx_word' id='word_1_151' title='bbox 349 1145 367 1163; x_wconf 73'><strong>0</strong></span> <span class='ocrx_word' id='word_1_152' title='bbox 382 1137 560 1182; x_wconf 85'>Optional</span> <span class='ocrx_word' id='word_1_153' title='bbox 575 1138 739 1174; x_wconf 89'>SMPTE</span> <span class='ocrx_word' id='word_1_154' title='bbox 752 1138 839 1174; x_wconf 89'>time</span> <span class='ocrx_word' id='word_1_155' title='bbox 853 1138 945 1174; x_wconf 89'>code</span> <span class='ocrx_word' id='word_1_156' title='bbox 959 1138 1287 1182; x_wconf 88'>synchronization.</span>
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
<div class='ocr_carea' id='block_1_11' title="bbox 349 1195 874 1240">
|
||||
<p class='ocr_par' id='par_1_13' lang='eng' title="bbox 349 1195 874 1240">
|
||||
<span class='ocr_line' id='line_1_18' title="bbox 349 1195 874 1240; baseline 0 -8; x_size 45; x_descenders 8; x_ascenders 12"><span class='ocrx_word' id='word_1_157' title='bbox 349 1203 367 1222; x_wconf 70'><strong>0</strong></span> <span class='ocrx_word' id='word_1_158' title='bbox 382 1195 560 1240; x_wconf 87'>Optional</span> <span class='ocrx_word' id='word_1_159' title='bbox 573 1201 709 1233; x_wconf 86'>remote</span> <span class='ocrx_word' id='word_1_160' title='bbox 723 1196 874 1233; x_wconf 87'>control.</span>
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
<div class='ocr_carea' id='block_1_12' title="bbox 346 1288 1239 1491">
|
||||
<p class='ocr_par' id='par_1_14' lang='eng' title="bbox 346 1288 749 1329">
|
||||
<span class='ocr_line' id='line_1_19' title="bbox 346 1288 749 1329; baseline 0.002 -9; x_size 42; x_descenders 9; x_ascenders 10"><span class='ocrx_word' id='word_1_161' title='bbox 346 1288 535 1329; x_wconf 82'>Recording</span> <span class='ocrx_word' id='word_1_162' title='bbox 547 1298 567 1321; x_wconf 73'>3</span> <span class='ocrx_word' id='word_1_163' title='bbox 579 1288 749 1328; x_wconf 86'>Sequence</span>
|
||||
</span>
|
||||
</p>
|
||||
|
||||
<p class='ocr_par' id='par_1_15' lang='eng' title="bbox 346 1339 1239 1491">
|
||||
<span class='ocr_line' id='line_1_20' title="bbox 383 1339 1239 1373; baseline 0 -7; x_size 33; x_descenders 7; x_ascenders 8"><span class='ocrx_word' id='word_1_164' title='bbox 383 1340 420 1366; x_wconf 87'>To</span> <span class='ocrx_word' id='word_1_165' title='bbox 430 1339 524 1366; x_wconf 85'>record</span> <span class='ocrx_word' id='word_1_166' title='bbox 535 1347 551 1366; x_wconf 87'>a</span> <span class='ocrx_word' id='word_1_167' title='bbox 562 1347 704 1373; x_wconf 80'>sequence,</span> <span class='ocrx_word' id='word_1_168' title='bbox 716 1340 815 1373; x_wconf 91'>simply</span> <span class='ocrx_word' id='word_1_169' title='bbox 825 1348 898 1373; x_wconf 88'>press</span> <span class='ocrx_word' id='word_1_170' title='bbox 910 1340 1065 1367; x_wconf 90'>RECORD</span> <span class='ocrx_word' id='word_1_171' title='bbox 1075 1340 1131 1367; x_wconf 87'>and</span> <span class='ocrx_word' id='word_1_172' title='bbox 1142 1341 1239 1372; x_wconf 87'>PLAY,</span>
|
||||
</span>
|
||||
<span class='ocr_line' id='line_1_21' title="bbox 346 1378 1205 1412; baseline 0.001 -7; x_size 34; x_descenders 7; x_ascenders 8"><span class='ocrx_word' id='word_1_173' title='bbox 346 1379 411 1406; x_wconf 91'>then</span> <span class='ocrx_word' id='word_1_174' title='bbox 422 1378 483 1412; x_wconf 89'>play</span> <span class='ocrx_word' id='word_1_175' title='bbox 493 1387 562 1412; x_wconf 87'>your</span> <span class='ocrx_word' id='word_1_176' title='bbox 572 1379 659 1405; x_wconf 89'>MIDI</span> <span class='ocrx_word' id='word_1_177' title='bbox 671 1379 810 1412; x_wconf 86'>keyboard</span> <span class='ocrx_word' id='word_1_178' title='bbox 821 1379 848 1406; x_wconf 90'>in</span> <span class='ocrx_word' id='word_1_179' title='bbox 858 1379 923 1406; x_wconf 90'>time</span> <span class='ocrx_word' id='word_1_180' title='bbox 934 1384 963 1406; x_wconf 90'>to</span> <span class='ocrx_word' id='word_1_181' title='bbox 974 1379 1019 1406; x_wconf 92'>the</span> <span class='ocrx_word' id='word_1_182' title='bbox 1030 1379 1205 1412; x_wconf 88'>Sequencer’s</span>
|
||||
</span>
|
||||
<span class='ocr_line' id='line_1_22' title="bbox 347 1417 1232 1452; baseline 0.002 -8; x_size 34; x_descenders 7; x_ascenders 8"><span class='ocrx_word' id='word_1_183' title='bbox 347 1417 414 1445; x_wconf 86'>click</span> <span class='ocrx_word' id='word_1_184' title='bbox 425 1418 506 1445; x_wconf 84'>track.</span> <span class='ocrx_word' id='word_1_185' title='bbox 519 1418 609 1445; x_wconf 85'>When</span> <span class='ocrx_word' id='word_1_186' title='bbox 620 1419 665 1445; x_wconf 89'>the</span> <span class='ocrx_word' id='word_1_187' title='bbox 676 1426 810 1452; x_wconf 86'>sequence</span> <span class='ocrx_word' id='word_1_188' title='bbox 821 1419 901 1452; x_wconf 88'>loops</span> <span class='ocrx_word' id='word_1_189' title='bbox 912 1419 983 1446; x_wconf 86'>back</span> <span class='ocrx_word' id='word_1_190' title='bbox 995 1419 1101 1446; x_wconf 90'>around</span> <span class='ocrx_word' id='word_1_191' title='bbox 1112 1423 1141 1446; x_wconf 91'>to</span> <span class='ocrx_word' id='word_1_192' title='bbox 1152 1419 1201 1446; x_wconf 87'>bar</span> <span class='ocrx_word' id='word_1_193' title='bbox 1213 1419 1232 1450; x_wconf 88'>1,</span>
|
||||
</span>
|
||||
<span class='ocr_line' id='line_1_23' title="bbox 346 1457 1223 1491; baseline 0.001 -7; x_size 34; x_descenders 7; x_ascenders 8"><span class='ocrx_word' id='word_1_194' title='bbox 346 1457 430 1490; x_wconf 84'>you’ll</span> <span class='ocrx_word' id='word_1_195' title='bbox 441 1457 506 1485; x_wconf 93'>hear</span> <span class='ocrx_word' id='word_1_196' title='bbox 517 1458 590 1485; x_wconf 79'>what</span> <span class='ocrx_word' id='word_1_197' title='bbox 600 1466 654 1491; x_wconf 88'>you</span> <span class='ocrx_word' id='word_1_198' title='bbox 666 1458 865 1491; x_wconf 77'>played—only</span> <span class='ocrx_word' id='word_1_199' title='bbox 876 1458 910 1485; x_wconf 90'>all</span> <span class='ocrx_word' id='word_1_200' title='bbox 921 1458 1018 1491; x_wconf 84'>timing</span> <span class='ocrx_word' id='word_1_201' title='bbox 1029 1466 1115 1485; x_wconf 84'>errors</span> <span class='ocrx_word' id='word_1_202' title='bbox 1126 1458 1179 1485; x_wconf 91'>will</span> <span class='ocrx_word' id='word_1_203' title='bbox 1189 1458 1223 1485; x_wconf 91'>be</span>
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
<div class='ocr_carea' id='block_1_13' title="bbox 346 1497 1245 1531">
|
||||
<p class='ocr_par' id='par_1_16' lang='eng' title="bbox 346 1497 1245 1531">
|
||||
<span class='ocr_line' id='line_1_24' title="bbox 346 1497 1245 1531; baseline 0.001 -7; x_size 35; x_descenders 7; x_ascenders 9"><span class='ocrx_word' id='word_1_204' title='bbox 346 1497 494 1524; x_wconf 86'>corrected!</span> <span class='ocrx_word' id='word_1_205' title='bbox 508 1497 628 1530; x_wconf 85'>(Timing</span> <span class='ocrx_word' id='word_1_206' title='bbox 638 1497 791 1525; x_wconf 82'>correction</span> <span class='ocrx_word' id='word_1_207' title='bbox 802 1506 864 1531; x_wconf 88'>may</span> <span class='ocrx_word' id='word_1_208' title='bbox 875 1498 909 1525; x_wconf 91'>be</span> <span class='ocrx_word' id='word_1_209' title='bbox 920 1497 1047 1531; x_wconf 81'>adjusted</span> <span class='ocrx_word' id='word_1_210' title='bbox 1058 1505 1089 1525; x_wconf 92'>or</span> <span class='ocrx_word' id='word_1_211' title='bbox 1099 1497 1245 1531; x_wconf 87'>defeated).</span>
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
<div class='ocr_carea' id='block_1_14' title="bbox 346 1536 1205 1965">
|
||||
<p class='ocr_par' id='par_1_17' lang='eng' title="bbox 346 1536 1186 1610">
|
||||
<span class='ocr_line' id='line_1_25' title="bbox 346 1536 1186 1570; baseline 0.001 -7; x_size 34; x_descenders 7; x_ascenders 8"><span class='ocrx_word' id='word_1_212' title='bbox 346 1537 409 1569; x_wconf 90'>Any</span> <span class='ocrx_word' id='word_1_213' title='bbox 419 1536 571 1563; x_wconf 86'>additional</span> <span class='ocrx_word' id='word_1_214' title='bbox 582 1541 659 1564; x_wconf 85'>notes</span> <span class='ocrx_word' id='word_1_215' title='bbox 670 1537 766 1570; x_wconf 87'>played</span> <span class='ocrx_word' id='word_1_216' title='bbox 777 1537 830 1563; x_wconf 88'>will</span> <span class='ocrx_word' id='word_1_217' title='bbox 840 1537 874 1564; x_wconf 92'>be</span> <span class='ocrx_word' id='word_1_218' title='bbox 885 1537 976 1564; x_wconf 88'>added</span> <span class='ocrx_word' id='word_1_219' title='bbox 986 1537 1045 1564; x_wconf 89'>into</span> <span class='ocrx_word' id='word_1_220' title='bbox 1055 1537 1101 1564; x_wconf 89'>the</span> <span class='ocrx_word' id='word_1_221' title='bbox 1111 1537 1186 1564; x_wconf 82'>track</span>
|
||||
</span>
|
||||
<span class='ocr_line' id='line_1_26' title="bbox 347 1575 1052 1610; baseline 0.001 -8; x_size 34; x_descenders 7; x_ascenders 8"><span class='ocrx_word' id='word_1_222' title='bbox 347 1575 495 1609; x_wconf 86'>—existing</span> <span class='ocrx_word' id='word_1_223' title='bbox 505 1580 582 1603; x_wconf 89'>notes</span> <span class='ocrx_word' id='word_1_224' title='bbox 593 1584 637 1603; x_wconf 90'>are</span> <span class='ocrx_word' id='word_1_225' title='bbox 648 1580 696 1603; x_wconf 88'>not</span> <span class='ocrx_word' id='word_1_226' title='bbox 707 1576 800 1603; x_wconf 90'>erased</span> <span class='ocrx_word' id='word_1_227' title='bbox 811 1576 890 1603; x_wconf 87'>while</span> <span class='ocrx_word' id='word_1_228' title='bbox 900 1576 1052 1610; x_wconf 87'>recording!</span>
|
||||
</span>
|
||||
</p>
|
||||
|
||||
<p class='ocr_par' id='par_1_18' lang='eng' title="bbox 346 1616 1205 1965">
|
||||
<span class='ocr_line' id='line_1_27' title="bbox 384 1616 1199 1648; baseline 0.001 -6; x_size 32; x_descenders 5; x_ascenders 8"><span class='ocrx_word' id='word_1_229' title='bbox 384 1616 471 1642; x_wconf 88'>FAST</span> <span class='ocrx_word' id='word_1_230' title='bbox 481 1616 671 1648; x_wconf 88'>FORWARD,</span> <span class='ocrx_word' id='word_1_231' title='bbox 684 1617 844 1648; x_wconf 87'>REWIND,</span> <span class='ocrx_word' id='word_1_232' title='bbox 857 1616 912 1643; x_wconf 89'>and</span> <span class='ocrx_word' id='word_1_233' title='bbox 924 1616 1068 1643; x_wconf 78'>LOCATE</span> <span class='ocrx_word' id='word_1_234' title='bbox 1079 1616 1199 1643; x_wconf 87'>controls</span>
|
||||
</span>
|
||||
<span class='ocr_line' id='line_1_28' title="bbox 346 1655 1202 1689; baseline 0 -7; x_size 34; x_descenders 6; x_ascenders 9"><span class='ocrx_word' id='word_1_235' title='bbox 346 1663 409 1688; x_wconf 89'>may</span> <span class='ocrx_word' id='word_1_236' title='bbox 419 1655 453 1682; x_wconf 94'>be</span> <span class='ocrx_word' id='word_1_237' title='bbox 463 1655 530 1682; x_wconf 90'>used</span> <span class='ocrx_word' id='word_1_238' title='bbox 541 1659 569 1682; x_wconf 90'>at</span> <span class='ocrx_word' id='word_1_239' title='bbox 580 1663 632 1688; x_wconf 86'>any</span> <span class='ocrx_word' id='word_1_240' title='bbox 642 1655 707 1683; x_wconf 88'>time</span> <span class='ocrx_word' id='word_1_241' title='bbox 717 1659 746 1683; x_wconf 88'>to</span> <span class='ocrx_word' id='word_1_242' title='bbox 757 1655 867 1689; x_wconf 88'>quickly</span> <span class='ocrx_word' id='word_1_243' title='bbox 878 1664 968 1683; x_wconf 87'>access</span> <span class='ocrx_word' id='word_1_244' title='bbox 979 1664 1032 1689; x_wconf 87'>any</span> <span class='ocrx_word' id='word_1_245' title='bbox 1042 1655 1164 1683; x_wconf 90'>location</span> <span class='ocrx_word' id='word_1_246' title='bbox 1174 1655 1202 1682; x_wconf 94'>in</span>
|
||||
</span>
|
||||
<span class='ocr_line' id='line_1_29' title="bbox 346 1694 1204 1728; baseline 0.001 -7; x_size 33; x_descenders 6; x_ascenders 8"><span class='ocrx_word' id='word_1_247' title='bbox 346 1702 414 1727; x_wconf 88'>your</span> <span class='ocrx_word' id='word_1_248' title='bbox 424 1702 558 1727; x_wconf 87'>sequence</span> <span class='ocrx_word' id='word_1_249' title='bbox 570 1694 612 1721; x_wconf 84'>for</span> <span class='ocrx_word' id='word_1_250' title='bbox 623 1695 847 1728; x_wconf 84'>spot—recording.</span> <span class='ocrx_word' id='word_1_251' title='bbox 860 1696 897 1722; x_wconf 89'>To</span> <span class='ocrx_word' id='word_1_252' title='bbox 908 1695 1028 1722; x_wconf 82'>overdub</span> <span class='ocrx_word' id='word_1_253' title='bbox 1039 1703 1056 1722; x_wconf 91'>a</span> <span class='ocrx_word' id='word_1_254' title='bbox 1066 1703 1125 1722; x_wconf 89'>new</span> <span class='ocrx_word' id='word_1_255' title='bbox 1135 1699 1204 1728; x_wconf 88'>part,</span>
|
||||
</span>
|
||||
<span class='ocr_line' id='line_1_30' title="bbox 347 1733 1150 1768; baseline 0.001 -8; x_size 35; x_descenders 7; x_ascenders 9"><span class='ocrx_word' id='word_1_256' title='bbox 347 1733 426 1761; x_wconf 88'>select</span> <span class='ocrx_word' id='word_1_257' title='bbox 437 1741 453 1761; x_wconf 88'>a</span> <span class='ocrx_word' id='word_1_258' title='bbox 463 1733 589 1761; x_wconf 86'>different</span> <span class='ocrx_word' id='word_1_259' title='bbox 599 1734 674 1761; x_wconf 85'>track</span> <span class='ocrx_word' id='word_1_260' title='bbox 685 1734 741 1761; x_wconf 87'>and</span> <span class='ocrx_word' id='word_1_261' title='bbox 752 1738 818 1761; x_wconf 83'>start</span> <span class='ocrx_word' id='word_1_262' title='bbox 828 1734 1086 1768; x_wconf 63'>recording~while</span> <span class='ocrx_word' id='word_1_263' title='bbox 1096 1742 1150 1767; x_wconf 89'>you</span>
|
||||
</span>
|
||||
<span class='ocr_line' id='line_1_31' title="bbox 346 1773 1203 1808; baseline 0.001 -8; x_size 33; x_descenders 6; x_ascenders 8"><span class='ocrx_word' id='word_1_264' title='bbox 346 1774 448 1806; x_wconf 86'>record,</span> <span class='ocrx_word' id='word_1_265' title='bbox 460 1774 506 1801; x_wconf 87'>the</span> <span class='ocrx_word' id='word_1_266' title='bbox 517 1773 662 1801; x_wconf 64'>first‘track</span> <span class='ocrx_word' id='word_1_267' title='bbox 673 1774 726 1801; x_wconf 91'>will</span> <span class='ocrx_word' id='word_1_268' title='bbox 736 1774 799 1807; x_wconf 89'>play</span> <span class='ocrx_word' id='word_1_269' title='bbox 809 1774 836 1801; x_wconf 91'>in</span> <span class='ocrx_word' id='word_1_270' title='bbox 847 1774 949 1808; x_wconf 84'>perfect</span> <span class='ocrx_word' id='word_1_271' title='bbox 961 1782 1026 1808; x_wconf 87'>sync</span> <span class='ocrx_word' id='word_1_272' title='bbox 1037 1774 1137 1808; x_wconf 89'>(unless</span> <span class='ocrx_word' id='word_1_273' title='bbox 1148 1782 1203 1807; x_wconf 93'>you</span>
|
||||
</span>
|
||||
<span class='ocr_line' id='line_1_32' title="bbox 346 1813 1191 1847; baseline 0.002 -8; x_size 33; x_descenders 5; x_ascenders 9"><span class='ocrx_word' id='word_1_274' title='bbox 346 1813 454 1840; x_wconf 86'>MUTE</span> <span class='ocrx_word' id='word_1_275' title='bbox 464 1813 492 1845; x_wconf 88'>it,</span> <span class='ocrx_word' id='word_1_276' title='bbox 505 1821 537 1840; x_wconf 84'>or</span> <span class='ocrx_word' id='word_1_277' title='bbox 547 1813 642 1840; x_wconf 88'>SOLO</span> <span class='ocrx_word' id='word_1_278' title='bbox 653 1814 769 1841; x_wconf 87'>another</span> <span class='ocrx_word' id='word_1_279' title='bbox 779 1814 875 1847; x_wconf 86'>track).</span> <span class='ocrx_word' id='word_1_280' title='bbox 889 1814 920 1840; x_wconf 86'>In</span> <span class='ocrx_word' id='word_1_281' title='bbox 930 1813 984 1841; x_wconf 86'>this</span> <span class='ocrx_word' id='word_1_282' title='bbox 995 1822 1057 1847; x_wconf 87'>way,</span> <span class='ocrx_word' id='word_1_283' title='bbox 1069 1822 1106 1847; x_wconf 88'>up</span> <span class='ocrx_word' id='word_1_284' title='bbox 1117 1818 1146 1841; x_wconf 77'>to</span> <span class='ocrx_word' id='word_1_285' title='bbox 1158 1814 1191 1841; x_wconf 90'>32</span>
|
||||
</span>
|
||||
<span class='ocr_line' id='line_1_33' title="bbox 346 1852 1205 1885; baseline 0.001 -6; x_size 33; x_descenders 6; x_ascenders 8"><span class='ocrx_word' id='word_1_286' title='bbox 346 1852 434 1879; x_wconf 84'>tracks</span> <span class='ocrx_word' id='word_1_287' title='bbox 445 1860 508 1885; x_wconf 90'>may</span> <span class='ocrx_word' id='word_1_288' title='bbox 518 1853 552 1879; x_wconf 93'>be</span> <span class='ocrx_word' id='word_1_289' title='bbox 562 1853 748 1880; x_wconf 90'>overdubbed!</span> <span class='ocrx_word' id='word_1_290' title='bbox 761 1853 808 1880; x_wconf 92'>All</span> <span class='ocrx_word' id='word_1_291' title='bbox 819 1854 905 1880; x_wconf 81'>MIDI</span> <span class='ocrx_word' id='word_1_292' title='bbox 917 1853 1011 1880; x_wconf 81'>effects</span> <span class='ocrx_word' id='word_1_293' title='bbox 1022 1861 1067 1880; x_wconf 86'>are</span> <span class='ocrx_word' id='word_1_294' title='bbox 1076 1853 1205 1880; x_wconf 87'>recorded</span>
|
||||
</span>
|
||||
<span class='ocr_line' id='line_1_34' title="bbox 346 1891 1168 1926; baseline 0.002 -8; x_size 34; x_descenders 7; x_ascenders 8"><span class='ocrx_word' id='word_1_295' title='bbox 346 1891 485 1925; x_wconf 84'>including</span> <span class='ocrx_word' id='word_1_296' title='bbox 495 1891 570 1925; x_wconf 87'>pitch</span> <span class='ocrx_word' id='word_1_297' title='bbox 580 1892 663 1924; x_wconf 84'>bend,</span> <span class='ocrx_word' id='word_1_298' title='bbox 675 1892 859 1924; x_wconf 86'>modulation,</span> <span class='ocrx_word' id='word_1_299' title='bbox 872 1892 991 1926; x_wconf 83'>velocity,</span> <span class='ocrx_word' id='word_1_300' title='bbox 1004 1892 1168 1924; x_wconf 85'>aftertouch,</span>
|
||||
</span>
|
||||
<span class='ocr_line' id='line_1_35' title="bbox 346 1931 895 1965; baseline 0.002 -7; x_size 33; x_descenders 6; x_ascenders 8"><span class='ocrx_word' id='word_1_301' title='bbox 346 1931 448 1958; x_wconf 88'>sustain</span> <span class='ocrx_word' id='word_1_302' title='bbox 459 1931 549 1965; x_wconf 88'>pedal,</span> <span class='ocrx_word' id='word_1_303' title='bbox 561 1932 617 1959; x_wconf 90'>and</span> <span class='ocrx_word' id='word_1_304' title='bbox 628 1940 756 1965; x_wconf 88'>program</span> <span class='ocrx_word' id='word_1_305' title='bbox 766 1932 895 1965; x_wconf 87'>changes!</span>
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
<div class='ocr_carea' id='block_1_15' title="bbox 346 1998 1212 2163">
|
||||
<p class='ocr_par' id='par_1_19' lang='eng' title="bbox 346 1998 479 2040">
|
||||
<span class='ocr_line' id='line_1_36' title="bbox 346 1998 479 2040; baseline -0.008 -9; x_size 43; x_descenders 10; x_ascenders 11"><span class='ocrx_word' id='word_1_306' title='bbox 346 1998 479 2040; x_wconf 87'>Editing</span>
|
||||
</span>
|
||||
</p>
|
||||
|
||||
<p class='ocr_par' id='par_1_20' lang='eng' title="bbox 346 2050 1212 2163">
|
||||
<span class='ocr_line' id='line_1_37' title="bbox 383 2050 1186 2084; baseline 0.001 -8; x_size 34; x_descenders 7; x_ascenders 8"><span class='ocrx_word' id='word_1_307' title='bbox 383 2050 419 2076; x_wconf 89'>To</span> <span class='ocrx_word' id='word_1_308' title='bbox 430 2057 503 2076; x_wconf 87'>erase</span> <span class='ocrx_word' id='word_1_309' title='bbox 514 2058 530 2077; x_wconf 91'>a</span> <span class='ocrx_word' id='word_1_310' title='bbox 540 2058 634 2083; x_wconf 88'>wrong</span> <span class='ocrx_word' id='word_1_311' title='bbox 644 2054 717 2082; x_wconf 84'>note,</span> <span class='ocrx_word' id='word_1_312' title='bbox 729 2050 829 2083; x_wconf 89'>simply</span> <span class='ocrx_word' id='word_1_313' title='bbox 839 2050 905 2077; x_wconf 88'>hold</span> <span class='ocrx_word' id='word_1_314' title='bbox 916 2051 1037 2077; x_wconf 85'>ERASE</span> <span class='ocrx_word' id='word_1_315' title='bbox 1048 2050 1103 2077; x_wconf 89'>and</span> <span class='ocrx_word' id='word_1_316' title='bbox 1113 2059 1186 2084; x_wconf 89'>press</span>
|
||||
</span>
|
||||
<span class='ocr_line' id='line_1_38' title="bbox 346 2089 1212 2124; baseline 0.002 -8; x_size 33; x_descenders 6; x_ascenders 8"><span class='ocrx_word' id='word_1_317' title='bbox 346 2089 391 2116; x_wconf 86'>the</span> <span class='ocrx_word' id='word_1_318' title='bbox 402 2094 465 2117; x_wconf 86'>note</span> <span class='ocrx_word' id='word_1_319' title='bbox 475 2094 504 2117; x_wconf 86'>to</span> <span class='ocrx_word' id='word_1_320' title='bbox 515 2090 549 2117; x_wconf 93'>be</span> <span class='ocrx_word' id='word_1_321' title='bbox 559 2090 652 2117; x_wconf 89'>erased</span> <span class='ocrx_word' id='word_1_322' title='bbox 661 2090 718 2123; x_wconf 91'>just</span> <span class='ocrx_word' id='word_1_323' title='bbox 729 2090 822 2117; x_wconf 85'>before</span> <span class='ocrx_word' id='word_1_324' title='bbox 833 2090 852 2117; x_wconf 89'>it</span> <span class='ocrx_word' id='word_1_325' title='bbox 862 2090 937 2124; x_wconf 87'>plays</span> <span class='ocrx_word' id='word_1_326' title='bbox 947 2090 975 2117; x_wconf 92'>in</span> <span class='ocrx_word' id='word_1_327' title='bbox 986 2090 1032 2118; x_wconf 87'>the</span> <span class='ocrx_word' id='word_1_328' title='bbox 1043 2098 1212 2124; x_wconf 78'>sequence—</span>
|
||||
</span>
|
||||
<span class='ocr_line' id='line_1_39' title="bbox 346 2129 1134 2163; baseline 0.003 -8; x_size 34; x_descenders 7; x_ascenders 8"><span class='ocrx_word' id='word_1_329' title='bbox 346 2129 425 2156; x_wconf 92'>when</span> <span class='ocrx_word' id='word_1_330' title='bbox 435 2129 531 2162; x_wconf 91'>played</span> <span class='ocrx_word' id='word_1_331' title='bbox 542 2129 621 2161; x_wconf 82'>back,</span> <span class='ocrx_word' id='word_1_332' title='bbox 633 2129 652 2156; x_wconf 84'>it</span> <span class='ocrx_word' id='word_1_333' title='bbox 663 2129 716 2156; x_wconf 89'>will</span> <span class='ocrx_word' id='word_1_334' title='bbox 726 2130 760 2157; x_wconf 88'>be</span> <span class='ocrx_word' id='word_1_335' title='bbox 771 2138 849 2163; x_wconf 86'>gone.</span> <span class='ocrx_word' id='word_1_336' title='bbox 861 2131 947 2157; x_wconf 86'>Notes</span> <span class='ocrx_word' id='word_1_337' title='bbox 958 2138 1021 2163; x_wconf 88'>may</span> <span class='ocrx_word' id='word_1_338' title='bbox 1031 2130 1089 2157; x_wconf 87'>also</span> <span class='ocrx_word' id='word_1_339' title='bbox 1100 2130 1134 2157; x_wconf 91'>be</span>
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
<div class='ocr_carea' id='block_1_16' title="bbox 345 2168 1228 2242">
|
||||
<p class='ocr_par' id='par_1_21' lang='eng' title="bbox 345 2168 1228 2242">
|
||||
<span class='ocr_line' id='line_1_40' title="bbox 346 2168 1220 2203; baseline 0.001 -8; x_size 34; x_descenders 7; x_ascenders 8"><span class='ocrx_word' id='word_1_340' title='bbox 346 2168 445 2200; x_wconf 86'>added,</span> <span class='ocrx_word' id='word_1_341' title='bbox 457 2168 560 2200; x_wconf 87'>erased,</span> <span class='ocrx_word' id='word_1_342' title='bbox 572 2177 604 2196; x_wconf 93'>or</span> <span class='ocrx_word' id='word_1_343' title='bbox 614 2169 739 2202; x_wconf 82'>changed</span> <span class='ocrx_word' id='word_1_344' title='bbox 749 2169 829 2203; x_wconf 86'>using</span> <span class='ocrx_word' id='word_1_345' title='bbox 839 2169 885 2196; x_wconf 85'>the</span> <span class='ocrx_word' id='word_1_346' title='bbox 896 2170 1031 2196; x_wconf 89'>SINGLE</span> <span class='ocrx_word' id='word_1_347' title='bbox 1042 2170 1131 2196; x_wconf 87'>STEP</span> <span class='ocrx_word' id='word_1_348' title='bbox 1143 2169 1220 2196; x_wconf 82'>func-</span>
|
||||
</span>
|
||||
<span class='ocr_line' id='line_1_41' title="bbox 345 2207 1228 2242; baseline 0.002 -8; x_size 35; x_descenders 7; x_ascenders 9"><span class='ocrx_word' id='word_1_349' title='bbox 345 2207 412 2234; x_wconf 87'>tion.</span> <span class='ocrx_word' id='word_1_350' title='bbox 424 2208 461 2235; x_wconf 88'>To</span> <span class='ocrx_word' id='word_1_351' title='bbox 472 2208 592 2235; x_wconf 88'>overdub</span> <span class='ocrx_word' id='word_1_352' title='bbox 603 2212 680 2235; x_wconf 84'>notes</span> <span class='ocrx_word' id='word_1_353' title='bbox 691 2212 718 2235; x_wconf 89'>at</span> <span class='ocrx_word' id='word_1_354' title='bbox 729 2208 841 2242; x_wconf 83'>specific</span> <span class='ocrx_word' id='word_1_355' title='bbox 851 2209 943 2242; x_wconf 89'>points</span> <span class='ocrx_word' id='word_1_356' title='bbox 955 2208 1049 2236; x_wconf 87'>within</span> <span class='ocrx_word' id='word_1_357' title='bbox 1060 2217 1076 2236; x_wconf 87'>a</span> <span class='ocrx_word' id='word_1_358' title='bbox 1086 2216 1228 2242; x_wconf 86'>sequence,</span>
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
<div class='ocr_carea' id='block_1_17' title="bbox 345 2293 705 2326">
|
||||
<p class='ocr_par' id='par_1_22' lang='eng' title="bbox 345 2293 705 2326">
|
||||
<span class='ocr_line' id='line_1_42' title="bbox 345 2293 705 2326; baseline 0.003 -1; x_size 38.38298; x_descenders 5.3829789; x_ascenders 10"><span class='ocrx_word' id='word_1_359' title='bbox 345 2293 541 2326; x_wconf 86'>Additional</span> <span class='ocrx_word' id='word_1_360' title='bbox 553 2293 705 2326; x_wconf 83'>Features</span>
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
<div class='ocr_carea' id='block_1_18' title="bbox 1295 1289 2165 1593">
|
||||
<p class='ocr_par' id='par_1_23' lang='eng' title="bbox 1296 1289 2165 1362">
|
||||
<span class='ocr_line' id='line_1_43' title="bbox 1296 1289 2165 1322; baseline 0.001 -7; x_size 35.040108; x_descenders 6.9264708; x_ascenders 8.613636"><span class='ocrx_word' id='word_1_361' title='bbox 1296 1289 1394 1322; x_wconf 91'>simply</span> <span class='ocrx_word' id='word_1_362' title='bbox 1404 1297 1452 1316; x_wconf 87'>use</span> <span class='ocrx_word' id='word_1_363' title='bbox 1463 1290 1615 1321; x_wconf 86'>LOCATE,</span> <span class='ocrx_word' id='word_1_364' title='bbox 1628 1290 1716 1316; x_wconf 88'>FAST</span> <span class='ocrx_word' id='word_1_365' title='bbox 1726 1289 1917 1321; x_wconf 86'>FORWARD,</span> <span class='ocrx_word' id='word_1_366' title='bbox 1929 1297 1960 1317; x_wconf 92'>or</span> <span class='ocrx_word' id='word_1_367' title='bbox 1972 1290 2126 1316; x_wconf 91'>REWIND</span> <span class='ocrx_word' id='word_1_368' title='bbox 2136 1294 2165 1317; x_wconf 82'>to</span>
|
||||
</span>
|
||||
<span class='ocr_line' id='line_1_44' title="bbox 1297 1328 2033 1362; baseline 0.001 -7; x_size 32; x_descenders 5; x_ascenders 8"><span class='ocrx_word' id='word_1_369' title='bbox 1297 1328 1356 1355; x_wconf 77'>find</span> <span class='ocrx_word' id='word_1_370' title='bbox 1366 1329 1412 1355; x_wconf 89'>the</span> <span class='ocrx_word' id='word_1_371' title='bbox 1423 1328 1527 1356; x_wconf 85'>desired</span> <span class='ocrx_word' id='word_1_372' title='bbox 1537 1329 1587 1356; x_wconf 88'>bar</span> <span class='ocrx_word' id='word_1_373' title='bbox 1598 1329 1720 1361; x_wconf 86'>number,</span> <span class='ocrx_word' id='word_1_374' title='bbox 1732 1329 1798 1356; x_wconf 78'>then</span> <span class='ocrx_word' id='word_1_375' title='bbox 1809 1333 1874 1356; x_wconf 87'>start</span> <span class='ocrx_word' id='word_1_376' title='bbox 1885 1329 2033 1362; x_wconf 85'>recording.</span>
|
||||
</span>
|
||||
</p>
|
||||
|
||||
<p class='ocr_par' id='par_1_24' lang='eng' title="bbox 1295 1368 2160 1593">
|
||||
<span class='ocr_line' id='line_1_45' title="bbox 1332 1368 2160 1402; baseline 0.002 -8; x_size 34; x_descenders 7; x_ascenders 8"><span class='ocrx_word' id='word_1_377' title='bbox 1332 1368 1391 1395; x_wconf 90'>The</span> <span class='ocrx_word' id='word_1_378' title='bbox 1402 1368 1650 1395; x_wconf 86'>INSERT/COPY</span> <span class='ocrx_word' id='word_1_379' title='bbox 1662 1368 1789 1395; x_wconf 81'>function</span> <span class='ocrx_word' id='word_1_380' title='bbox 1800 1368 1893 1395; x_wconf 90'>allows</span> <span class='ocrx_word' id='word_1_381' title='bbox 1904 1376 1958 1402; x_wconf 91'>you</span> <span class='ocrx_word' id='word_1_382' title='bbox 1968 1373 1997 1395; x_wconf 91'>to</span> <span class='ocrx_word' id='word_1_383' title='bbox 2008 1377 2087 1396; x_wconf 91'>move</span> <span class='ocrx_word' id='word_1_384' title='bbox 2097 1369 2160 1396; x_wconf 89'>bars</span>
|
||||
</span>
|
||||
<span class='ocr_line' id='line_1_46' title="bbox 1297 1407 2151 1441; baseline 0.002 -8; x_size 33; x_descenders 6; x_ascenders 8"><span class='ocrx_word' id='word_1_385' title='bbox 1297 1407 1369 1434; x_wconf 86'>from</span> <span class='ocrx_word' id='word_1_386' title='bbox 1380 1415 1433 1434; x_wconf 88'>one</span> <span class='ocrx_word' id='word_1_387' title='bbox 1443 1407 1565 1435; x_wconf 85'>location</span> <span class='ocrx_word' id='word_1_388' title='bbox 1576 1411 1605 1434; x_wconf 89'>to</span> <span class='ocrx_word' id='word_1_389' title='bbox 1616 1407 1796 1435; x_wconf 85'>another—in</span> <span class='ocrx_word' id='word_1_390' title='bbox 1806 1408 1852 1435; x_wconf 88'>the</span> <span class='ocrx_word' id='word_1_391' title='bbox 1863 1416 1937 1435; x_wconf 90'>same</span> <span class='ocrx_word' id='word_1_392' title='bbox 1948 1416 2083 1441; x_wconf 88'>sequence</span> <span class='ocrx_word' id='word_1_393' title='bbox 2093 1416 2125 1435; x_wconf 90'>or</span> <span class='ocrx_word' id='word_1_394' title='bbox 2135 1416 2151 1435; x_wconf 88'>a</span>
|
||||
</span>
|
||||
<span class='ocr_line' id='line_1_47' title="bbox 1296 1447 2160 1481; baseline 0.001 -7; x_size 34; x_descenders 7; x_ascenders 8"><span class='ocrx_word' id='word_1_395' title='bbox 1296 1447 1421 1474; x_wconf 81'>different</span> <span class='ocrx_word' id='word_1_396' title='bbox 1431 1455 1491 1474; x_wconf 89'>one.</span> <span class='ocrx_word' id='word_1_397' title='bbox 1504 1448 1555 1474; x_wconf 87'>For</span> <span class='ocrx_word' id='word_1_398' title='bbox 1565 1448 1698 1481; x_wconf 84'>example,</span> <span class='ocrx_word' id='word_1_399' title='bbox 1710 1456 1764 1481; x_wconf 91'>you</span> <span class='ocrx_word' id='word_1_400' title='bbox 1775 1448 1863 1481; x_wconf 84'>might</span> <span class='ocrx_word' id='word_1_401' title='bbox 1873 1448 1955 1475; x_wconf 86'>insert</span> <span class='ocrx_word' id='word_1_402' title='bbox 1966 1456 1983 1475; x_wconf 92'>a</span> <span class='ocrx_word' id='word_1_403' title='bbox 1993 1456 2064 1481; x_wconf 88'>copy</span> <span class='ocrx_word' id='word_1_404' title='bbox 2074 1448 2106 1475; x_wconf 90'>of</span> <span class='ocrx_word' id='word_1_405' title='bbox 2115 1448 2160 1475; x_wconf 90'>the</span>
|
||||
</span>
|
||||
<span class='ocr_line' id='line_1_48' title="bbox 1297 1486 2087 1521; baseline 0 -7; x_size 35; x_descenders 7; x_ascenders 9"><span class='ocrx_word' id='word_1_406' title='bbox 1297 1486 1355 1514; x_wconf 82'>first</span> <span class='ocrx_word' id='word_1_407' title='bbox 1366 1495 1439 1514; x_wconf 89'>verse</span> <span class='ocrx_word' id='word_1_408' title='bbox 1449 1487 1571 1514; x_wconf 89'>between</span> <span class='ocrx_word' id='word_1_409' title='bbox 1582 1487 1628 1514; x_wconf 88'>the</span> <span class='ocrx_word' id='word_1_410' title='bbox 1638 1487 1740 1514; x_wconf 87'>second</span> <span class='ocrx_word' id='word_1_411' title='bbox 1751 1487 1852 1514; x_wconf 83'>chorus</span> <span class='ocrx_word' id='word_1_412' title='bbox 1863 1487 1919 1514; x_wconf 90'>and</span> <span class='ocrx_word' id='word_1_413' title='bbox 1929 1487 1975 1514; x_wconf 88'>the</span> <span class='ocrx_word' id='word_1_414' title='bbox 1985 1487 2087 1521; x_wconf 85'>bridge.</span>
|
||||
</span>
|
||||
<span class='ocr_line' id='line_1_49' title="bbox 1296 1527 2047 1560; baseline 0.003 -8; x_size 32; x_descenders 6; x_ascenders 7"><span class='ocrx_word' id='word_1_415' title='bbox 1296 1527 1441 1553; x_wconf 88'>DELETE</span> <span class='ocrx_word' id='word_1_416' title='bbox 1453 1527 1546 1553; x_wconf 90'>BARS</span> <span class='ocrx_word' id='word_1_417' title='bbox 1557 1531 1681 1559; x_wconf 84'>operates</span> <span class='ocrx_word' id='word_1_418' title='bbox 1691 1527 1737 1553; x_wconf 86'>the</span> <span class='ocrx_word' id='word_1_419' title='bbox 1748 1535 1823 1554; x_wconf 90'>same</span> <span class='ocrx_word' id='word_1_420' title='bbox 1833 1535 1891 1560; x_wconf 93'>way</span> <span class='ocrx_word' id='word_1_421' title='bbox 1901 1531 1930 1554; x_wconf 91'>to</span> <span class='ocrx_word' id='word_1_422' title='bbox 1940 1535 2047 1554; x_wconf 90'>remove</span>
|
||||
</span>
|
||||
<span class='ocr_line' id='line_1_50' title="bbox 1295 1565 1577 1593; baseline 0.004 -1; x_size 34.748871; x_descenders 6.7488689; x_ascenders 9"><span class='ocrx_word' id='word_1_423' title='bbox 1295 1565 1441 1592; x_wconf 88'>unwanted</span> <span class='ocrx_word' id='word_1_424' title='bbox 1452 1565 1577 1593; x_wconf 84'>sections.</span>
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
<div class='ocr_carea' id='block_1_19' title="bbox 1295 1638 2215 1960">
|
||||
<p class='ocr_par' id='par_1_25' lang='eng' title="bbox 1296 1638 1589 1680">
|
||||
<span class='ocr_line' id='line_1_51' title="bbox 1296 1638 1589 1680; baseline 0 -9; x_size 42; x_descenders 9; x_ascenders 10"><span class='ocrx_word' id='word_1_425' title='bbox 1296 1638 1452 1680; x_wconf 86'>Creating</span> <span class='ocrx_word' id='word_1_426' title='bbox 1465 1648 1485 1671; x_wconf 85'>a</span> <span class='ocrx_word' id='word_1_427' title='bbox 1497 1639 1589 1680; x_wconf 87'>Song</span>
|
||||
</span>
|
||||
</p>
|
||||
|
||||
<p class='ocr_par' id='par_1_26' lang='eng' title="bbox 1295 1690 2215 1960">
|
||||
<span class='ocr_line' id='line_1_52' title="bbox 1333 1690 2146 1723; baseline 0 -6; x_size 33; x_descenders 6; x_ascenders 8"><span class='ocrx_word' id='word_1_428' title='bbox 1333 1690 1394 1717; x_wconf 88'>One</span> <span class='ocrx_word' id='word_1_429' title='bbox 1404 1698 1462 1723; x_wconf 93'>way</span> <span class='ocrx_word' id='word_1_430' title='bbox 1472 1694 1500 1717; x_wconf 89'>to</span> <span class='ocrx_word' id='word_1_431' title='bbox 1511 1694 1598 1717; x_wconf 88'>create</span> <span class='ocrx_word' id='word_1_432' title='bbox 1608 1698 1625 1717; x_wconf 88'>a</span> <span class='ocrx_word' id='word_1_433' title='bbox 1635 1698 1704 1723; x_wconf 83'>song</span> <span class='ocrx_word' id='word_1_434' title='bbox 1715 1690 1736 1717; x_wconf 90'>is</span> <span class='ocrx_word' id='word_1_435' title='bbox 1747 1694 1776 1717; x_wconf 89'>to</span> <span class='ocrx_word' id='word_1_436' title='bbox 1787 1690 1880 1717; x_wconf 86'>record</span> <span class='ocrx_word' id='word_1_437' title='bbox 1891 1690 1958 1717; x_wconf 89'>each</span> <span class='ocrx_word' id='word_1_438' title='bbox 1969 1690 2044 1717; x_wconf 87'>track</span> <span class='ocrx_word' id='word_1_439' title='bbox 2056 1690 2090 1717; x_wconf 89'>all</span> <span class='ocrx_word' id='word_1_440' title='bbox 2101 1690 2146 1717; x_wconf 88'>the</span>
|
||||
</span>
|
||||
<span class='ocr_line' id='line_1_53' title="bbox 1295 1729 2121 1762; baseline 0.001 -6; x_size 33; x_descenders 6; x_ascenders 8"><span class='ocrx_word' id='word_1_441' title='bbox 1295 1737 1353 1762; x_wconf 87'>way</span> <span class='ocrx_word' id='word_1_442' title='bbox 1362 1729 1481 1762; x_wconf 83'>through</span> <span class='ocrx_word' id='word_1_443' title='bbox 1493 1729 1541 1762; x_wconf 90'>(up</span> <span class='ocrx_word' id='word_1_444' title='bbox 1552 1733 1581 1756; x_wconf 89'>to</span> <span class='ocrx_word' id='word_1_445' title='bbox 1592 1730 1644 1756; x_wconf 89'>999</span> <span class='ocrx_word' id='word_1_446' title='bbox 1654 1729 1738 1762; x_wconf 90'>bars).</span> <span class='ocrx_word' id='word_1_447' title='bbox 1751 1729 1878 1757; x_wconf 89'>Another</span> <span class='ocrx_word' id='word_1_448' title='bbox 1888 1737 1945 1762; x_wconf 89'>way</span> <span class='ocrx_word' id='word_1_449' title='bbox 1956 1729 1977 1757; x_wconf 90'>is</span> <span class='ocrx_word' id='word_1_450' title='bbox 1987 1733 2016 1757; x_wconf 89'>to</span> <span class='ocrx_word' id='word_1_451' title='bbox 2027 1729 2121 1757; x_wconf 86'>record</span>
|
||||
</span>
|
||||
<span class='ocr_line' id='line_1_54' title="bbox 1296 1768 2066 1802; baseline 0 -6; x_size 33; x_descenders 5; x_ascenders 9"><span class='ocrx_word' id='word_1_452' title='bbox 1296 1768 1362 1796; x_wconf 86'>each</span> <span class='ocrx_word' id='word_1_453' title='bbox 1373 1768 1448 1796; x_wconf 87'>basic</span> <span class='ocrx_word' id='word_1_454' title='bbox 1458 1768 1562 1796; x_wconf 83'>section</span> <span class='ocrx_word' id='word_1_455' title='bbox 1574 1769 1666 1802; x_wconf 89'>(verse,</span> <span class='ocrx_word' id='word_1_456' title='bbox 1679 1769 1788 1801; x_wconf 86'>chorus,</span> <span class='ocrx_word' id='word_1_457' title='bbox 1800 1769 1865 1802; x_wconf 83'>etc.)</span> <span class='ocrx_word' id='word_1_458' title='bbox 1876 1768 1904 1795; x_wconf 91'>in</span> <span class='ocrx_word' id='word_1_459' title='bbox 1914 1768 2066 1796; x_wconf 86'>individual</span>
|
||||
</span>
|
||||
<span class='ocr_line' id='line_1_55' title="bbox 1296 1808 2215 1841; baseline 0 -6; x_size 32; x_descenders 5; x_ascenders 8"><span class='ocrx_word' id='word_1_460' title='bbox 1296 1816 1451 1841; x_wconf 85'>sequences,</span> <span class='ocrx_word' id='word_1_461' title='bbox 1463 1808 1528 1835; x_wconf 86'>then</span> <span class='ocrx_word' id='word_1_462' title='bbox 1538 1816 1587 1835; x_wconf 90'>use</span> <span class='ocrx_word' id='word_1_463' title='bbox 1597 1808 1643 1835; x_wconf 89'>the</span> <span class='ocrx_word' id='word_1_464' title='bbox 1653 1809 1799 1835; x_wconf 89'>CREATE</span> <span class='ocrx_word' id='word_1_465' title='bbox 1810 1808 1911 1835; x_wconf 89'>SONG</span> <span class='ocrx_word' id='word_1_466' title='bbox 1923 1808 2050 1836; x_wconf 85'>function</span> <span class='ocrx_word' id='word_1_467' title='bbox 2060 1812 2089 1835; x_wconf 89'>to</span> <span class='ocrx_word' id='word_1_468' title='bbox 2103 1808 2215 1836; x_wconf 87'>“chain”</span>
|
||||
</span>
|
||||
<span class='ocr_line' id='line_1_56' title="bbox 1295 1847 2135 1881; baseline 0.001 -7; x_size 34; x_descenders 7; x_ascenders 8"><span class='ocrx_word' id='word_1_469' title='bbox 1295 1848 1370 1874; x_wconf 91'>them</span> <span class='ocrx_word' id='word_1_470' title='bbox 1381 1848 1508 1881; x_wconf 83'>together.</span> <span class='ocrx_word' id='word_1_471' title='bbox 1521 1848 1667 1875; x_wconf 87'>CREATE</span> <span class='ocrx_word' id='word_1_472' title='bbox 1678 1848 1779 1875; x_wconf 91'>SONG</span> <span class='ocrx_word' id='word_1_473' title='bbox 1789 1847 1842 1874; x_wconf 92'>will</span> <span class='ocrx_word' id='word_1_474' title='bbox 1853 1848 1918 1875; x_wconf 86'>then</span> <span class='ocrx_word' id='word_1_475' title='bbox 1929 1848 2135 1881; x_wconf 81'>automatically</span>
|
||||
</span>
|
||||
<span class='ocr_line' id='line_1_57' title="bbox 1296 1887 2162 1920; baseline 0 -6; x_size 33; x_descenders 6; x_ascenders 8"><span class='ocrx_word' id='word_1_476' title='bbox 1296 1895 1366 1920; x_wconf 89'>copy</span> <span class='ocrx_word' id='word_1_477' title='bbox 1377 1887 1412 1914; x_wconf 88'>all</span> <span class='ocrx_word' id='word_1_478' title='bbox 1422 1887 1468 1914; x_wconf 85'>the</span> <span class='ocrx_word' id='word_1_479' title='bbox 1478 1891 1552 1920; x_wconf 86'>parts</span> <span class='ocrx_word' id='word_1_480' title='bbox 1563 1887 1621 1914; x_wconf 86'>into</span> <span class='ocrx_word' id='word_1_481' title='bbox 1632 1895 1649 1914; x_wconf 91'>a</span> <span class='ocrx_word' id='word_1_482' title='bbox 1659 1895 1718 1914; x_wconf 91'>new</span> <span class='ocrx_word' id='word_1_483' title='bbox 1729 1895 1870 1920; x_wconf 83'>sequence.</span> <span class='ocrx_word' id='word_1_484' title='bbox 1884 1887 1911 1914; x_wconf 84'>If</span> <span class='ocrx_word' id='word_1_485' title='bbox 1919 1887 2033 1919; x_wconf 89'>desired,</span> <span class='ocrx_word' id='word_1_486' title='bbox 2045 1895 2099 1920; x_wconf 92'>you</span> <span class='ocrx_word' id='word_1_487' title='bbox 2110 1895 2162 1914; x_wconf 85'>can</span>
|
||||
</span>
|
||||
<span class='ocr_line' id='line_1_58' title="bbox 1296 1926 2169 1960; baseline 0.001 -7; x_size 34; x_descenders 7; x_ascenders 9"><span class='ocrx_word' id='word_1_488' title='bbox 1296 1934 1361 1953; x_wconf 89'>even</span> <span class='ocrx_word' id='word_1_489' title='bbox 1372 1930 1411 1953; x_wconf 90'>set</span> <span class='ocrx_word' id='word_1_490' title='bbox 1422 1926 1468 1953; x_wconf 88'>the</span> <span class='ocrx_word' id='word_1_491' title='bbox 1478 1926 1528 1953; x_wconf 89'>last</span> <span class='ocrx_word' id='word_1_492' title='bbox 1540 1926 1590 1953; x_wconf 88'>few</span> <span class='ocrx_word' id='word_1_493' title='bbox 1601 1927 1664 1953; x_wconf 89'>bars</span> <span class='ocrx_word' id='word_1_494' title='bbox 1675 1931 1704 1954; x_wconf 85'>to</span> <span class='ocrx_word' id='word_1_495' title='bbox 1715 1931 1806 1960; x_wconf 89'>repeat</span> <span class='ocrx_word' id='word_1_496' title='bbox 1816 1926 1955 1960; x_wconf 84'>infinitely,</span> <span class='ocrx_word' id='word_1_497' title='bbox 1968 1926 2011 1954; x_wconf 86'>for</span> <span class='ocrx_word' id='word_1_498' title='bbox 2022 1935 2038 1954; x_wconf 92'>a</span> <span class='ocrx_word' id='word_1_499' title='bbox 2049 1927 2169 1954; x_wconf 83'>fadeout.</span>
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
<div class='ocr_carea' id='block_1_20' title="bbox 1293 2000 2179 2242">
|
||||
<p class='ocr_par' id='par_1_27' lang='eng' title="bbox 1294 2000 1948 2040">
|
||||
<span class='ocr_line' id='line_1_59' title="bbox 1294 2000 1948 2040; baseline 0.002 -8; x_size 40; x_descenders 8; x_ascenders 10"><span class='ocrx_word' id='word_1_500' title='bbox 1294 2000 1532 2040; x_wconf 84'>Composition</span> <span class='ocrx_word' id='word_1_501' title='bbox 1544 2000 1699 2033; x_wconf 85'>Without</span> <span class='ocrx_word' id='word_1_502' title='bbox 1711 2000 1948 2040; x_wconf 85'>Compromise</span>
|
||||
</span>
|
||||
</p>
|
||||
|
||||
<p class='ocr_par' id='par_1_28' lang='eng' title="bbox 1293 2051 2179 2242">
|
||||
<span class='ocr_line' id='line_1_60' title="bbox 1331 2051 2179 2085; baseline 0 -7; x_size 34; x_descenders 7; x_ascenders 9"><span class='ocrx_word' id='word_1_503' title='bbox 1331 2051 1389 2078; x_wconf 90'>The</span> <span class='ocrx_word' id='word_1_504' title='bbox 1399 2051 1563 2085; x_wconf 83'>technology</span> <span class='ocrx_word' id='word_1_505' title='bbox 1573 2059 1627 2084; x_wconf 92'>you</span> <span class='ocrx_word' id='word_1_506' title='bbox 1638 2060 1686 2079; x_wconf 86'>use</span> <span class='ocrx_word' id='word_1_507' title='bbox 1697 2051 1797 2078; x_wconf 89'>should</span> <span class='ocrx_word' id='word_1_508' title='bbox 1808 2059 1887 2078; x_wconf 87'>never</span> <span class='ocrx_word' id='word_1_509' title='bbox 1897 2052 1932 2079; x_wconf 91'>be</span> <span class='ocrx_word' id='word_1_510' title='bbox 1942 2059 1973 2079; x_wconf 89'>so</span> <span class='ocrx_word' id='word_1_511' title='bbox 1984 2051 2110 2085; x_wconf 85'>complex</span> <span class='ocrx_word' id='word_1_512' title='bbox 2120 2052 2179 2078; x_wconf 86'>that</span>
|
||||
</span>
|
||||
<span class='ocr_line' id='line_1_61' title="bbox 1294 2090 2157 2124; baseline 0 -6; x_size 34; x_descenders 7; x_ascenders 8"><span class='ocrx_word' id='word_1_513' title='bbox 1294 2090 1313 2118; x_wconf 86'>it</span> <span class='ocrx_word' id='word_1_514' title='bbox 1323 2091 1459 2118; x_wconf 87'>interferes</span> <span class='ocrx_word' id='word_1_515' title='bbox 1470 2091 1535 2118; x_wconf 84'>with</span> <span class='ocrx_word' id='word_1_516' title='bbox 1545 2091 1591 2118; x_wconf 88'>the</span> <span class='ocrx_word' id='word_1_517' title='bbox 1602 2091 1715 2118; x_wconf 90'>creative</span> <span class='ocrx_word' id='word_1_518' title='bbox 1725 2099 1841 2124; x_wconf 83'>process.</span> <span class='ocrx_word' id='word_1_519' title='bbox 1854 2091 1947 2118; x_wconf 78'>That’s</span> <span class='ocrx_word' id='word_1_520' title='bbox 1957 2091 2086 2124; x_wconf 86'>precisely</span> <span class='ocrx_word' id='word_1_521' title='bbox 2096 2091 2157 2124; x_wconf 89'>why</span>
|
||||
</span>
|
||||
<span class='ocr_line' id='line_1_62' title="bbox 1293 2130 2156 2164; baseline 0 -7; x_size 34; x_descenders 7; x_ascenders 8"><span class='ocrx_word' id='word_1_522' title='bbox 1293 2130 1339 2157; x_wconf 90'>the</span> <span class='ocrx_word' id='word_1_523' title='bbox 1350 2130 1576 2164; x_wconf 80'>LinnSequencer</span> <span class='ocrx_word' id='word_1_524' title='bbox 1586 2130 1607 2157; x_wconf 89'>is</span> <span class='ocrx_word' id='word_1_525' title='bbox 1619 2130 1747 2164; x_wconf 87'>designed</span> <span class='ocrx_word' id='word_1_526' title='bbox 1758 2134 1787 2157; x_wconf 87'>to</span> <span class='ocrx_word' id='word_1_527' title='bbox 1798 2130 1834 2157; x_wconf 89'>let</span> <span class='ocrx_word' id='word_1_528' title='bbox 1844 2138 1899 2163; x_wconf 93'>you</span> <span class='ocrx_word' id='word_1_529' title='bbox 1910 2138 2051 2164; x_wconf 88'>compose,</span> <span class='ocrx_word' id='word_1_530' title='bbox 2063 2130 2156 2157; x_wconf 87'>record</span>
|
||||
</span>
|
||||
<span class='ocr_line' id='line_1_63' title="bbox 1294 2169 2145 2203; baseline 0 -6; x_size 33; x_descenders 6; x_ascenders 8"><span class='ocrx_word' id='word_1_531' title='bbox 1294 2170 1349 2197; x_wconf 90'>and</span> <span class='ocrx_word' id='word_1_532' title='bbox 1360 2169 1414 2197; x_wconf 83'>edit</span> <span class='ocrx_word' id='word_1_533' title='bbox 1425 2170 1503 2197; x_wconf 89'>while</span> <span class='ocrx_word' id='word_1_534' title='bbox 1514 2170 1643 2203; x_wconf 90'>devoting</span> <span class='ocrx_word' id='word_1_535' title='bbox 1653 2178 1721 2203; x_wconf 92'>your</span> <span class='ocrx_word' id='word_1_536' title='bbox 1731 2170 1882 2197; x_wconf 88'>undivided</span> <span class='ocrx_word' id='word_1_537' title='bbox 1893 2170 2027 2197; x_wconf 86'>attention</span> <span class='ocrx_word' id='word_1_538' title='bbox 2037 2174 2067 2197; x_wconf 91'>to</span> <span class='ocrx_word' id='word_1_539' title='bbox 2077 2178 2145 2203; x_wconf 90'>your</span>
|
||||
</span>
|
||||
<span class='ocr_line' id='line_1_64' title="bbox 1294 2209 2126 2242; baseline 0 -6; x_size 33; x_descenders 6; x_ascenders 8"><span class='ocrx_word' id='word_1_540' title='bbox 1294 2209 1388 2236; x_wconf 88'>music.</span> <span class='ocrx_word' id='word_1_541' title='bbox 1402 2209 1451 2236; x_wconf 89'>See</span> <span class='ocrx_word' id='word_1_542' title='bbox 1460 2217 1529 2242; x_wconf 92'>your</span> <span class='ocrx_word' id='word_1_543' title='bbox 1540 2209 1611 2236; x_wconf 87'>Linn</span> <span class='ocrx_word' id='word_1_544' title='bbox 1621 2209 1712 2236; x_wconf 86'>dealer</span> <span class='ocrx_word' id='word_1_545' title='bbox 1722 2209 1806 2242; x_wconf 85'>today</span> <span class='ocrx_word' id='word_1_546' title='bbox 1817 2209 1859 2236; x_wconf 87'>for</span> <span class='ocrx_word' id='word_1_547' title='bbox 1870 2217 1887 2236; x_wconf 88'>a</span> <span class='ocrx_word' id='word_1_548' title='bbox 1897 2209 2126 2236; x_wconf 76'>demonstration!</span>
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
<div class='ocr_carea' id='block_1_21' title="bbox 347 2343 2171 2378">
|
||||
<p class='ocr_par' id='par_1_29' lang='eng' title="bbox 347 2343 2171 2378">
|
||||
<span class='ocr_line' id='line_1_65' title="bbox 347 2343 2171 2378; baseline 0.001 -8; x_size 34; x_descenders 7; x_ascenders 8"><span class='ocrx_word' id='word_1_549' title='bbox 347 2350 361 2363; x_wconf 69'><strong>0</strong></span> <span class='ocrx_word' id='word_1_550' title='bbox 373 2343 483 2377; x_wconf 83'>Simple,</span> <span class='ocrx_word' id='word_1_551' title='bbox 495 2352 559 2377; x_wconf 89'>easy</span> <span class='ocrx_word' id='word_1_552' title='bbox 569 2348 598 2371; x_wconf 91'>to</span> <span class='ocrx_word' id='word_1_553' title='bbox 609 2344 683 2371; x_wconf 89'>learn</span> <span class='ocrx_word' id='word_1_554' title='bbox 694 2344 922 2378; x_wconf 80'>operation—the</span> <span class='ocrx_word' id='word_1_555' title='bbox 934 2345 967 2372; x_wconf 88'>32</span> <span class='ocrx_word' id='word_1_556' title='bbox 978 2345 1116 2372; x_wconf 86'>character</span> <span class='ocrx_word' id='word_1_557' title='bbox 1126 2345 1200 2372; x_wconf 92'>LCD</span> <span class='ocrx_word' id='word_1_558' title='bbox 1211 2345 1316 2378; x_wconf 90'>display</span> <span class='ocrx_word' id='word_1_559' title='bbox 1326 2345 1424 2378; x_wconf 88'>clearly</span> <span class='ocrx_word' id='word_1_560' title='bbox 1434 2345 1528 2378; x_wconf 86'>guides</span> <span class='ocrx_word' id='word_1_561' title='bbox 1539 2353 1594 2378; x_wconf 91'>you</span> <span class='ocrx_word' id='word_1_562' title='bbox 1604 2345 1724 2378; x_wconf 87'>through</span> <span class='ocrx_word' id='word_1_563' title='bbox 1735 2344 1770 2371; x_wconf 88'>all</span> <span class='ocrx_word' id='word_1_564' title='bbox 1781 2344 1947 2377; x_wconf 86'>operations.</span> <span class='ocrx_word' id='word_1_565' title='bbox 1961 2344 1989 2371; x_wconf 88'>If</span> <span class='ocrx_word' id='word_1_566' title='bbox 1997 2344 2112 2376; x_wconf 88'>needed,</span> <span class='ocrx_word' id='word_1_567' title='bbox 2125 2345 2171 2371; x_wconf 88'>the</span>
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
<div class='ocr_carea' id='block_1_22' title="bbox 373 2381 1083 2415">
|
||||
<p class='ocr_par' id='par_1_30' lang='eng' title="bbox 373 2381 1083 2415">
|
||||
<span class='ocr_line' id='line_1_66' title="bbox 373 2381 1083 2415; baseline 0.003 -8; x_size 34; x_descenders 7; x_ascenders 8"><span class='ocrx_word' id='word_1_568' title='bbox 373 2381 472 2407; x_wconf 85'>HELP</span> <span class='ocrx_word' id='word_1_569' title='bbox 483 2381 583 2408; x_wconf 85'>button</span> <span class='ocrx_word' id='word_1_570' title='bbox 594 2381 711 2415; x_wconf 87'>displays</span> <span class='ocrx_word' id='word_1_571' title='bbox 722 2382 875 2409; x_wconf 89'>additional</span> <span class='ocrx_word' id='word_1_572' title='bbox 886 2382 1083 2415; x_wconf 87'>explanations.</span>
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
<div class='ocr_carea' id='block_1_23' title="bbox 347 2427 2145 2507">
|
||||
<p class='ocr_par' id='par_1_31' lang='eng' title="bbox 347 2427 2145 2507">
|
||||
<span class='ocr_line' id='line_1_67' title="bbox 347 2427 1468 2461; baseline 0.002 -8; x_size 34; x_descenders 7; x_ascenders 8"><span class='ocrx_word' id='word_1_573' title='bbox 347 2432 361 2446; x_wconf 69'><strong>0</strong></span> <span class='ocrx_word' id='word_1_574' title='bbox 373 2427 612 2454; x_wconf 88'>Non-destructive</span> <span class='ocrx_word' id='word_1_575' title='bbox 622 2427 914 2461; x_wconf 85'>recording—existing</span> <span class='ocrx_word' id='word_1_576' title='bbox 924 2432 1002 2455; x_wconf 90'>notes</span> <span class='ocrx_word' id='word_1_577' title='bbox 1013 2436 1057 2455; x_wconf 88'>are</span> <span class='ocrx_word' id='word_1_578' title='bbox 1068 2432 1116 2455; x_wconf 84'>not</span> <span class='ocrx_word' id='word_1_579' title='bbox 1127 2428 1220 2455; x_wconf 87'>erased</span> <span class='ocrx_word' id='word_1_580' title='bbox 1231 2428 1309 2455; x_wconf 91'>while</span> <span class='ocrx_word' id='word_1_581' title='bbox 1319 2428 1468 2461; x_wconf 87'>recording.</span>
|
||||
</span>
|
||||
<span class='ocr_line' id='line_1_68' title="bbox 347 2473 2145 2507; baseline 0.001 -8; x_size 35; x_descenders 7; x_ascenders 9"><span class='ocrx_word' id='word_1_582' title='bbox 347 2478 361 2492; x_wconf 71'><strong>0</strong></span> <span class='ocrx_word' id='word_1_583' title='bbox 372 2473 433 2500; x_wconf 90'>Two</span> <span class='ocrx_word' id='word_1_584' title='bbox 444 2473 689 2500; x_wconf 89'>FOOTSWITCH</span> <span class='ocrx_word' id='word_1_585' title='bbox 701 2474 837 2501; x_wconf 79'>INPUTS</span> <span class='ocrx_word' id='word_1_586' title='bbox 848 2481 910 2507; x_wconf 89'>may</span> <span class='ocrx_word' id='word_1_587' title='bbox 921 2473 955 2500; x_wconf 91'>be</span> <span class='ocrx_word' id='word_1_588' title='bbox 966 2473 1091 2507; x_wconf 85'>assigned</span> <span class='ocrx_word' id='word_1_589' title='bbox 1101 2478 1130 2501; x_wconf 81'>to</span> <span class='ocrx_word' id='word_1_590' title='bbox 1141 2474 1271 2507; x_wconf 84'>remotely</span> <span class='ocrx_word' id='word_1_591' title='bbox 1281 2473 1387 2501; x_wconf 86'>control</span> <span class='ocrx_word' id='word_1_592' title='bbox 1398 2482 1481 2507; x_wconf 86'>many</span> <span class='ocrx_word' id='word_1_593' title='bbox 1491 2473 1523 2501; x_wconf 90'>of</span> <span class='ocrx_word' id='word_1_594' title='bbox 1531 2474 1578 2501; x_wconf 89'>the</span> <span class='ocrx_word' id='word_1_595' title='bbox 1588 2473 1750 2506; x_wconf 82'>commonly</span> <span class='ocrx_word' id='word_1_596' title='bbox 1760 2473 1827 2500; x_wconf 88'>used</span> <span class='ocrx_word' id='word_1_597' title='bbox 1840 2473 1991 2505; x_wconf 77'>functions,</span> <span class='ocrx_word' id='word_1_598' title='bbox 2003 2473 2145 2507; x_wconf 84'>including</span>
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
<div class='ocr_carea' id='block_1_24' title="bbox 372 2510 1090 2543">
|
||||
<p class='ocr_par' id='par_1_32' lang='eng' title="bbox 372 2510 1090 2543">
|
||||
<span class='ocr_line' id='line_1_69' title="bbox 372 2510 1090 2543; baseline 0.001 -6; x_size 35.625; x_descenders 8.90625; x_ascenders 8.90625"><span class='ocrx_word' id='word_1_599' title='bbox 372 2510 500 2542; x_wconf 88'>ERASE,</span> <span class='ocrx_word' id='word_1_600' title='bbox 513 2511 660 2542; x_wconf 86'>REPEAT,</span> <span class='ocrx_word' id='word_1_601' title='bbox 673 2511 883 2543; x_wconf 80'>PLAY/STOP,</span> <span class='ocrx_word' id='word_1_602' title='bbox 896 2519 927 2538; x_wconf 90'>or</span> <span class='ocrx_word' id='word_1_603' title='bbox 939 2511 1090 2538; x_wconf 83'>LOCATE.</span>
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
<div class='ocr_carea' id='block_1_25' title="bbox 347 2556 1768 2590">
|
||||
<p class='ocr_par' id='par_1_33' lang='eng' title="bbox 347 2556 1768 2590">
|
||||
<span class='ocr_line' id='line_1_70' title="bbox 347 2556 1768 2590; baseline 0.001 -8; x_size 34; x_descenders 7; x_ascenders 8"><span class='ocrx_word' id='word_1_604' title='bbox 347 2561 361 2575; x_wconf 71'><strong>0</strong></span> <span class='ocrx_word' id='word_1_605' title='bbox 372 2556 433 2583; x_wconf 91'>Two</span> <span class='ocrx_word' id='word_1_606' title='bbox 443 2556 612 2583; x_wconf 83'>TRIGGER</span> <span class='ocrx_word' id='word_1_607' title='bbox 623 2556 797 2584; x_wconf 84'>OUTPUTS</span> <span class='ocrx_word' id='word_1_608' title='bbox 808 2565 871 2590; x_wconf 89'>may</span> <span class='ocrx_word' id='word_1_609' title='bbox 881 2557 915 2584; x_wconf 91'>be</span> <span class='ocrx_word' id='word_1_610' title='bbox 925 2557 1119 2590; x_wconf 84'>programmed</span> <span class='ocrx_word' id='word_1_611' title='bbox 1129 2561 1158 2584; x_wconf 93'>to</span> <span class='ocrx_word' id='word_1_612' title='bbox 1169 2561 1270 2590; x_wconf 87'>output</span> <span class='ocrx_word' id='word_1_613' title='bbox 1281 2557 1370 2590; x_wconf 88'>pulses</span> <span class='ocrx_word' id='word_1_614' title='bbox 1381 2561 1409 2584; x_wconf 92'>at</span> <span class='ocrx_word' id='word_1_615' title='bbox 1419 2565 1472 2590; x_wconf 90'>any</span> <span class='ocrx_word' id='word_1_616' title='bbox 1483 2557 1598 2584; x_wconf 86'>selected</span> <span class='ocrx_word' id='word_1_617' title='bbox 1608 2561 1673 2584; x_wconf 89'>note</span> <span class='ocrx_word' id='word_1_618' title='bbox 1683 2556 1768 2583; x_wconf 89'>value.</span>
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
<div class='ocr_carea' id='block_1_26' title="bbox 347 2601 1226 2635">
|
||||
<p class='ocr_par' id='par_1_34' lang='eng' title="bbox 347 2601 1226 2635">
|
||||
<span class='ocr_line' id='line_1_71' title="bbox 347 2601 1226 2635; baseline 0.001 -7; x_size 33; x_descenders 6; x_ascenders 8"><span class='ocrx_word' id='word_1_619' title='bbox 347 2607 361 2620; x_wconf 65'><strong>0</strong></span> <span class='ocrx_word' id='word_1_620' title='bbox 372 2601 434 2628; x_wconf 88'>Will</span> <span class='ocrx_word' id='word_1_621' title='bbox 445 2609 510 2634; x_wconf 89'>sync</span> <span class='ocrx_word' id='word_1_622' title='bbox 521 2605 549 2628; x_wconf 84'>to</span> <span class='ocrx_word' id='word_1_623' title='bbox 561 2602 690 2629; x_wconf 88'>standard</span> <span class='ocrx_word' id='word_1_624' title='bbox 701 2602 864 2629; x_wconf 86'>LinnDrum</span> <span class='ocrx_word' id='word_1_625' title='bbox 875 2610 907 2629; x_wconf 91'>or</span> <span class='ocrx_word' id='word_1_626' title='bbox 918 2602 989 2629; x_wconf 89'>Linn</span> <span class='ocrx_word' id='word_1_627' title='bbox 1000 2603 1069 2629; x_wconf 90'>9000</span> <span class='ocrx_word' id='word_1_628' title='bbox 1080 2610 1145 2635; x_wconf 87'>sync</span> <span class='ocrx_word' id='word_1_629' title='bbox 1155 2607 1226 2630; x_wconf 89'>tone.</span>
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
<div class='ocr_carea' id='block_1_27' title="bbox 347 2648 2100 2727">
|
||||
<p class='ocr_par' id='par_1_35' lang='eng' title="bbox 347 2648 2100 2727">
|
||||
<span class='ocr_line' id='line_1_72' title="bbox 347 2648 1664 2682; baseline 0.001 -7; x_size 33; x_descenders 6; x_ascenders 8"><span class='ocrx_word' id='word_1_630' title='bbox 347 2654 360 2667; x_wconf 75'>'</span> <span class='ocrx_word' id='word_1_631' title='bbox 372 2648 483 2675; x_wconf 89'>Utilizes</span> <span class='ocrx_word' id='word_1_632' title='bbox 493 2648 564 2680; x_wconf 75'>ultra</span> <span class='ocrx_word' id='word_1_633' title='bbox 573 2648 744 2682; x_wconf 86'>high—speed,</span> <span class='ocrx_word' id='word_1_634' title='bbox 757 2649 772 2676; x_wconf 91'>8</span> <span class='ocrx_word' id='word_1_635' title='bbox 783 2649 862 2675; x_wconf 89'>MHz</span> <span class='ocrx_word' id='word_1_636' title='bbox 873 2649 954 2676; x_wconf 88'>80186</span> <span class='ocrx_word' id='word_1_637' title='bbox 965 2649 994 2676; x_wconf 91'>16</span> <span class='ocrx_word' id='word_1_638' title='bbox 1004 2648 1043 2676; x_wconf 90'>bit</span> <span class='ocrx_word' id='word_1_639' title='bbox 1054 2653 1197 2682; x_wconf 88'>computer</span> <span class='ocrx_word' id='word_1_640' title='bbox 1208 2649 1350 2682; x_wconf 90'>internally</span> <span class='ocrx_word' id='word_1_641' title='bbox 1361 2649 1403 2676; x_wconf 87'>for</span> <span class='ocrx_word' id='word_1_642' title='bbox 1414 2649 1502 2676; x_wconf 87'>FAST</span> <span class='ocrx_word' id='word_1_643' title='bbox 1512 2648 1664 2682; x_wconf 81'>operation.</span>
|
||||
</span>
|
||||
<span class='ocr_line' id='line_1_73' title="bbox 347 2694 2100 2727; baseline 0.001 -7; x_size 33; x_descenders 6; x_ascenders 8"><span class='ocrx_word' id='word_1_644' title='bbox 347 2699 361 2713; x_wconf 70'><strong>0</strong></span> <span class='ocrx_word' id='word_1_645' title='bbox 372 2694 504 2721; x_wconf 88'>TEMPO</span> <span class='ocrx_word' id='word_1_646' title='bbox 515 2702 578 2727; x_wconf 92'>may</span> <span class='ocrx_word' id='word_1_647' title='bbox 589 2694 623 2721; x_wconf 90'>be</span> <span class='ocrx_word' id='word_1_648' title='bbox 633 2694 764 2727; x_wconf 87'>specified</span> <span class='ocrx_word' id='word_1_649' title='bbox 774 2694 802 2721; x_wconf 89'>in</span> <span class='ocrx_word' id='word_1_650' title='bbox 814 2695 1172 2722; x_wconf 84'>BEATS-PER—MINUTE</span> <span class='ocrx_word' id='word_1_651' title='bbox 1183 2703 1215 2722; x_wconf 93'>or</span> <span class='ocrx_word' id='word_1_652' title='bbox 1225 2695 1567 2722; x_wconf 84'>FRAMES-PER—BEAT</span> <span class='ocrx_word' id='word_1_653' title='bbox 1577 2698 1605 2721; x_wconf 89'>at</span> <span class='ocrx_word' id='word_1_654' title='bbox 1616 2695 1659 2726; x_wconf 91'>24,</span> <span class='ocrx_word' id='word_1_655' title='bbox 1672 2695 1716 2726; x_wconf 88'>25,</span> <span class='ocrx_word' id='word_1_656' title='bbox 1728 2702 1760 2721; x_wconf 90'>or</span> <span class='ocrx_word' id='word_1_657' title='bbox 1772 2695 1806 2721; x_wconf 88'>30</span> <span class='ocrx_word' id='word_1_658' title='bbox 1817 2694 1917 2721; x_wconf 86'>frames</span> <span class='ocrx_word' id='word_1_659' title='bbox 1928 2702 1976 2727; x_wconf 89'>per</span> <span class='ocrx_word' id='word_1_660' title='bbox 1987 2694 2100 2726; x_wconf 87'>second,</span>
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
<div class='ocr_carea' id='block_1_28' title="bbox 373 2731 652 2765">
|
||||
<p class='ocr_par' id='par_1_36' lang='eng' title="bbox 373 2731 652 2765">
|
||||
<span class='ocr_line' id='line_1_74' title="bbox 373 2731 652 2765; baseline 0 -7; x_size 33; x_descenders 6; x_ascenders 8"><span class='ocrx_word' id='word_1_661' title='bbox 373 2731 449 2764; x_wconf 87'>(even</span> <span class='ocrx_word' id='word_1_662' title='bbox 460 2731 529 2765; x_wconf 88'>drop</span> <span class='ocrx_word' id='word_1_663' title='bbox 541 2731 652 2764; x_wconf 81'>frame!)</span>
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
<div class='ocr_carea' id='block_1_29' title="bbox 347 2777 2174 2811">
|
||||
<p class='ocr_par' id='par_1_37' lang='eng' title="bbox 347 2777 2174 2811">
|
||||
<span class='ocr_line' id='line_1_75' title="bbox 347 2777 2174 2811; baseline 0.001 -8; x_size 33; x_descenders 5; x_ascenders 9"><span class='ocrx_word' id='word_1_664' title='bbox 347 2782 360 2796; x_wconf 72'><strong>0</strong></span> <span class='ocrx_word' id='word_1_665' title='bbox 372 2777 504 2804; x_wconf 82'>TEMPO</span> <span class='ocrx_word' id='word_1_666' title='bbox 515 2785 578 2810; x_wconf 91'>may</span> <span class='ocrx_word' id='word_1_667' title='bbox 588 2777 622 2804; x_wconf 92'>be</span> <span class='ocrx_word' id='word_1_668' title='bbox 633 2778 741 2804; x_wconf 84'>entered</span> <span class='ocrx_word' id='word_1_669' title='bbox 751 2777 934 2811; x_wconf 80'>numerically,</span> <span class='ocrx_word' id='word_1_670' title='bbox 946 2777 1101 2811; x_wconf 85'>adjustable</span> <span class='ocrx_word' id='word_1_671' title='bbox 1111 2777 1139 2804; x_wconf 92'>in</span> <span class='ocrx_word' id='word_1_672' title='bbox 1149 2778 1239 2805; x_wconf 88'>tenths</span> <span class='ocrx_word' id='word_1_673' title='bbox 1250 2778 1282 2805; x_wconf 85'>of</span> <span class='ocrx_word' id='word_1_674' title='bbox 1290 2786 1307 2805; x_wconf 94'>a</span> <span class='ocrx_word' id='word_1_675' title='bbox 1317 2777 1567 2805; x_wconf 85'>Beat-Per-Minute</span> <span class='ocrx_word' id='word_1_676' title='bbox 1577 2777 1748 2809; x_wconf 85'>increments,</span> <span class='ocrx_word' id='word_1_677' title='bbox 1760 2785 1792 2804; x_wconf 87'>or</span> <span class='ocrx_word' id='word_1_678' title='bbox 1803 2777 1839 2810; x_wconf 94'>by</span> <span class='ocrx_word' id='word_1_679' title='bbox 1849 2777 1964 2811; x_wconf 84'>tapping</span> <span class='ocrx_word' id='word_1_680' title='bbox 1975 2781 2086 2810; x_wconf 85'>quarter</span> <span class='ocrx_word' id='word_1_681' title='bbox 2097 2781 2174 2804; x_wconf 85'>notes</span>
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
<div class='ocr_carea' id='block_1_30' title="bbox 372 2815 808 2842">
|
||||
<p class='ocr_par' id='par_1_38' lang='eng' title="bbox 372 2815 808 2842">
|
||||
<span class='ocr_line' id='line_1_76' title="bbox 372 2815 808 2842; baseline 0.002 -1; x_size 32.351353; x_descenders 5.3513513; x_ascenders 9"><span class='ocrx_word' id='word_1_682' title='bbox 372 2822 410 2841; x_wconf 93'>on</span> <span class='ocrx_word' id='word_1_683' title='bbox 420 2815 466 2842; x_wconf 86'>the</span> <span class='ocrx_word' id='word_1_684' title='bbox 476 2815 545 2841; x_wconf 91'>TAP</span> <span class='ocrx_word' id='word_1_685' title='bbox 556 2815 689 2842; x_wconf 85'>TEMPO</span> <span class='ocrx_word' id='word_1_686' title='bbox 699 2815 808 2842; x_wconf 83'>button.</span>
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
<div class='ocr_carea' id='block_1_31' title="bbox 347 2861 1792 2940">
|
||||
<p class='ocr_par' id='par_1_39' lang='eng' title="bbox 347 2861 1792 2940">
|
||||
<span class='ocr_line' id='line_1_77' title="bbox 347 2861 1792 2895; baseline 0.001 -8; x_size 33; x_descenders 6; x_ascenders 8"><span class='ocrx_word' id='word_1_687' title='bbox 347 2866 360 2880; x_wconf 68'><strong>0</strong></span> <span class='ocrx_word' id='word_1_688' title='bbox 372 2861 504 2887; x_wconf 87'>TEMPO</span> <span class='ocrx_word' id='word_1_689' title='bbox 515 2861 696 2888; x_wconf 86'>CHANGES</span> <span class='ocrx_word' id='word_1_690' title='bbox 707 2869 771 2894; x_wconf 92'>may</span> <span class='ocrx_word' id='word_1_691' title='bbox 781 2861 815 2888; x_wconf 92'>be</span> <span class='ocrx_word' id='word_1_692' title='bbox 825 2861 1019 2894; x_wconf 85'>programmed</span> <span class='ocrx_word' id='word_1_693' title='bbox 1030 2861 1087 2888; x_wconf 88'>into</span> <span class='ocrx_word' id='word_1_694' title='bbox 1099 2869 1115 2888; x_wconf 87'>a</span> <span class='ocrx_word' id='word_1_695' title='bbox 1126 2870 1268 2895; x_wconf 87'>sequence,</span> <span class='ocrx_word' id='word_1_696' title='bbox 1280 2861 1344 2888; x_wconf 89'>with</span> <span class='ocrx_word' id='word_1_697' title='bbox 1356 2862 1467 2888; x_wconf 88'>smooth</span> <span class='ocrx_word' id='word_1_698' title='bbox 1478 2861 1635 2888; x_wconf 85'>transitions</span> <span class='ocrx_word' id='word_1_699' title='bbox 1646 2861 1670 2887; x_wconf 90'>if</span> <span class='ocrx_word' id='word_1_700' title='bbox 1679 2861 1792 2888; x_wconf 89'>desired.</span>
|
||||
</span>
|
||||
<span class='ocr_line' id='line_1_78' title="bbox 347 2906 1507 2940; baseline 0.002 -8; x_size 33; x_descenders 7; x_ascenders 8"><span class='ocrx_word' id='word_1_701' title='bbox 347 2911 360 2925; x_wconf 74'><strong><em>°</em></strong></span> <span class='ocrx_word' id='word_1_702' title='bbox 371 2906 434 2938; x_wconf 92'>Any</span> <span class='ocrx_word' id='word_1_703' title='bbox 444 2906 539 2932; x_wconf 85'>TIME</span> <span class='ocrx_word' id='word_1_704' title='bbox 550 2906 763 2933; x_wconf 88'>SIGNATURE</span> <span class='ocrx_word' id='word_1_705' title='bbox 773 2915 836 2939; x_wconf 88'>may</span> <span class='ocrx_word' id='word_1_706' title='bbox 846 2907 880 2933; x_wconf 91'>be</span> <span class='ocrx_word' id='word_1_707' title='bbox 891 2907 968 2938; x_wconf 89'>used,</span> <span class='ocrx_word' id='word_1_708' title='bbox 980 2907 1036 2934; x_wconf 89'>and</span> <span class='ocrx_word' id='word_1_709' title='bbox 1046 2915 1109 2940; x_wconf 91'>may</span> <span class='ocrx_word' id='word_1_710' title='bbox 1120 2907 1154 2934; x_wconf 90'>be</span> <span class='ocrx_word' id='word_1_711' title='bbox 1164 2907 1288 2940; x_wconf 84'>changed</span> <span class='ocrx_word' id='word_1_712' title='bbox 1299 2907 1393 2934; x_wconf 83'>within</span> <span class='ocrx_word' id='word_1_713' title='bbox 1404 2915 1420 2934; x_wconf 89'>a</span> <span class='ocrx_word' id='word_1_714' title='bbox 1431 2915 1507 2940; x_wconf 87'>song.</span>
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
<div class='ocr_carea' id='block_1_32' title="bbox 1540 2970 1878 3140">
|
||||
<p class='ocr_par' id='par_1_40' lang='eng' title="bbox 1540 2970 1878 3140">
|
||||
<span class='ocr_line' id='line_1_79' title="bbox 1540 2970 1800 3089; baseline 0 -14; x_size 100.5; x_descenders 16.5; x_ascenders 28.499998"><span class='ocrx_word' id='word_1_715' title='bbox 1540 2970 1800 3089; x_wconf 74'>E1111</span>
|
||||
</span>
|
||||
<span class='ocr_line' id='line_1_80' title="bbox 1554 3108 1878 3140; baseline 0 -5; x_size 32; x_descenders 5; x_ascenders 9"><span class='ocrx_word' id='word_1_716' title='bbox 1554 3108 1624 3135; x_wconf 91'>Linn</span> <span class='ocrx_word' id='word_1_717' title='bbox 1635 3108 1808 3140; x_wconf 87'>Electronics,</span> <span class='ocrx_word' id='word_1_718' title='bbox 1822 3109 1878 3136; x_wconf 84'>Inc.</span>
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
<div class='ocr_carea' id='block_1_33' title="bbox 1554 3150 2188 3226">
|
||||
<p class='ocr_par' id='par_1_41' lang='eng' title="bbox 1554 3150 2188 3226">
|
||||
<span class='ocr_line' id='line_1_81' title="bbox 1557 3150 2163 3182; baseline 0 -5; x_size 32; x_descenders 5; x_ascenders 8"><span class='ocrx_word' id='word_1_719' title='bbox 1557 3150 1638 3177; x_wconf 88'>18720</span> <span class='ocrx_word' id='word_1_720' title='bbox 1648 3150 1761 3177; x_wconf 89'>Oxnard</span> <span class='ocrx_word' id='word_1_721' title='bbox 1772 3150 1866 3182; x_wconf 81'>Street,</span> <span class='ocrx_word' id='word_1_722' title='bbox 1878 3150 2006 3182; x_wconf 86'>Tarzana,</span> <span class='ocrx_word' id='word_1_723' title='bbox 2019 3150 2071 3177; x_wconf 93'>CA</span> <span class='ocrx_word' id='word_1_724' title='bbox 2082 3150 2163 3177; x_wconf 88'>91356</span>
|
||||
</span>
|
||||
<span class='ocr_line' id='line_1_82' title="bbox 1554 3192 2188 3226; baseline 0 -7; x_size 33.5; x_descenders 5.5; x_ascenders 8.5"><span class='ocrx_word' id='word_1_725' title='bbox 1554 3193 1622 3226; x_wconf 89'>(818)</span> <span class='ocrx_word' id='word_1_726' title='bbox 1633 3193 1755 3219; x_wconf 60'>7088131</span> <span class='ocrx_word' id='word_1_727' title='bbox 1765 3193 1788 3219; x_wconf 91'>T</span> <span class='ocrx_word' id='word_1_728' title='bbox 1789 3193 1888 3219; x_wconf 87'>ELEX</span> <span class='ocrx_word' id='word_1_729' title='bbox 1899 3192 2022 3219; x_wconf 82'>#298949</span> <span class='ocrx_word' id='word_1_730' title='bbox 2033 3193 2125 3219; x_wconf 88'>LINN</span> <span class='ocrx_word' id='word_1_731' title='bbox 2135 3193 2188 3219; x_wconf 89'>UR</span>
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1 @@
|
||||
Tesseract Open Source OCR Engine v3.05.01 with Leptonica
|
||||
@@ -0,0 +1,123 @@
|
||||
The LinnSequencer
|
||||
32 Track MIDI Sequence Recorder
|
||||
|
||||
The LinnSequencer is a state—of—the-art composition and performance tool for the professional musician. It is
|
||||
|
||||
extremely powerful, yet amazingly simple to learn and use. It’s many remarkable features include:
|
||||
|
||||
0 Operation is similar to multi—track tape recorder with PLAY, STOP, RECORD, FAST
|
||||
FORWARD, REWIND, and LOCATE controls.
|
||||
|
||||
0 Each of the 100 sequences contains 32 simultaneous, polyphonic tracks. Each track may
|
||||
be assigned to one of 16 MIDI channels. Simultaneously plays up to 16 polyphonic
|
||||
|
||||
synthesizers !
|
||||
|
||||
0 Ultra—fast 3 1/2 ” disk drive stores complex songs in seconds and holds over 110,000 notes
|
||||
|
||||
per disk!
|
||||
|
||||
0 One or all tracks may be TRANSPOSED at the touch of a key.
|
||||
0 Exclusive real—time ERASE function makes editing FAST.
|
||||
0 Exclusive REPEAT function automatically repeats any held notes at a pre-selected
|
||||
|
||||
rhythmic value.
|
||||
|
||||
0 TIMING CORRECTION works during playback and operates without ‘chopping’ notes.
|
||||
|
||||
0 Optional SMPTE time code synchronization.
|
||||
|
||||
0 Optional remote control.
|
||||
|
||||
Recording 3 Sequence
|
||||
|
||||
To record a sequence, simply press RECORD and PLAY,
|
||||
then play your MIDI keyboard in time to the Sequencer’s
|
||||
click track. When the sequence loops back around to bar 1,
|
||||
you’ll hear what you played—only all timing errors will be
|
||||
|
||||
corrected! (Timing correction may be adjusted or defeated).
|
||||
|
||||
Any additional notes played will be added into the track
|
||||
—existing notes are not erased while recording!
|
||||
|
||||
FAST FORWARD, REWIND, and LOCATE controls
|
||||
may be used at any time to quickly access any location in
|
||||
your sequence for spot—recording. To overdub a new part,
|
||||
select a different track and start recording~while you
|
||||
record, the first‘track will play in perfect sync (unless you
|
||||
MUTE it, or SOLO another track). In this way, up to 32
|
||||
tracks may be overdubbed! All MIDI effects are recorded
|
||||
including pitch bend, modulation, velocity, aftertouch,
|
||||
sustain pedal, and program changes!
|
||||
|
||||
Editing
|
||||
|
||||
To erase a wrong note, simply hold ERASE and press
|
||||
the note to be erased just before it plays in the sequence—
|
||||
when played back, it will be gone. Notes may also be
|
||||
|
||||
added, erased, or changed using the SINGLE STEP func-
|
||||
tion. To overdub notes at specific points within a sequence,
|
||||
|
||||
Additional Features
|
||||
|
||||
simply use LOCATE, FAST FORWARD, or REWIND to
|
||||
find the desired bar number, then start recording.
|
||||
|
||||
The INSERT/COPY function allows you to move bars
|
||||
from one location to another—in the same sequence or a
|
||||
different one. For example, you might insert a copy of the
|
||||
first verse between the second chorus and the bridge.
|
||||
DELETE BARS operates the same way to remove
|
||||
unwanted sections.
|
||||
|
||||
Creating a Song
|
||||
|
||||
One way to create a song is to record each track all the
|
||||
way through (up to 999 bars). Another way is to record
|
||||
each basic section (verse, chorus, etc.) in individual
|
||||
sequences, then use the CREATE SONG function to “chain”
|
||||
them together. CREATE SONG will then automatically
|
||||
copy all the parts into a new sequence. If desired, you can
|
||||
even set the last few bars to repeat infinitely, for a fadeout.
|
||||
|
||||
Composition Without Compromise
|
||||
|
||||
The technology you use should never be so complex that
|
||||
it interferes with the creative process. That’s precisely why
|
||||
the LinnSequencer is designed to let you compose, record
|
||||
and edit while devoting your undivided attention to your
|
||||
music. See your Linn dealer today for a demonstration!
|
||||
|
||||
0 Simple, easy to learn operation—the 32 character LCD display clearly guides you through all operations. If needed, the
|
||||
|
||||
HELP button displays additional explanations.
|
||||
|
||||
0 Non-destructive recording—existing notes are not erased while recording.
|
||||
0 Two FOOTSWITCH INPUTS may be assigned to remotely control many of the commonly used functions, including
|
||||
|
||||
ERASE, REPEAT, PLAY/STOP, or LOCATE.
|
||||
|
||||
0 Two TRIGGER OUTPUTS may be programmed to output pulses at any selected note value.
|
||||
|
||||
0 Will sync to standard LinnDrum or Linn 9000 sync tone.
|
||||
|
||||
' Utilizes ultra high—speed, 8 MHz 80186 16 bit computer internally for FAST operation.
|
||||
0 TEMPO may be specified in BEATS-PER—MINUTE or FRAMES-PER—BEAT at 24, 25, or 30 frames per second,
|
||||
|
||||
(even drop frame!)
|
||||
|
||||
0 TEMPO may be entered numerically, adjustable in tenths of a Beat-Per-Minute increments, or by tapping quarter notes
|
||||
|
||||
on the TAP TEMPO button.
|
||||
|
||||
0 TEMPO CHANGES may be programmed into a sequence, with smooth transitions if desired.
|
||||
° Any TIME SIGNATURE may be used, and may be changed within a song.
|
||||
|
||||
E1111
|
||||
Linn Electronics, Inc.
|
||||
|
||||
18720 Oxnard Street, Tarzana, CA 91356
|
||||
(818) 7088131 T ELEX #298949 LINN UR
|
||||
|
||||
BIN
Binary file not shown.
+1
@@ -0,0 +1 @@
|
||||
Tesseract Open Source OCR Engine v3.05.01 with Leptonica
|
||||
+123
@@ -0,0 +1,123 @@
|
||||
The LinnSequencer
|
||||
32 Track MIDI Sequence Recorder
|
||||
|
||||
The LinnSequencer is a state—of—the-art composition and performance tool for the professional musician. It is
|
||||
|
||||
extremely powerful, yet amazingly simple to learn and use. It’s many remarkable features include:
|
||||
|
||||
0 Operation is similar to multi—track tape recorder with PLAY, STOP, RECORD, FAST
|
||||
FORWARD, REWIND, and LOCATE controls.
|
||||
|
||||
0 Each of the 100 sequences contains 32 simultaneous, polyphonic tracks. Each track may
|
||||
be assigned to one of 16 MIDI channels. Simultaneously plays up to 16 polyphonic
|
||||
|
||||
synthesizers !
|
||||
|
||||
0 Ultra—fast 3 1/2 ” disk drive stores complex songs in seconds and holds over 110,000 notes
|
||||
|
||||
per disk!
|
||||
|
||||
0 One or all tracks may be TRANSPOSED at the touch of a key.
|
||||
0 Exclusive real—time ERASE function makes editing FAST.
|
||||
0 Exclusive REPEAT function automatically repeats any held notes at a pre-selected
|
||||
|
||||
rhythmic value.
|
||||
|
||||
0 TIMING CORRECTION works during playback and operates without ‘chopping’ notes.
|
||||
|
||||
0 Optional SMPTE time code synchronization.
|
||||
|
||||
0 Optional remote control.
|
||||
|
||||
Recording 3 Sequence
|
||||
|
||||
To record a sequence, simply press RECORD and PLAY,
|
||||
then play your MIDI keyboard in time to the Sequencer’s
|
||||
click track. When the sequence loops back around to bar 1,
|
||||
you’ll hear what you played—only all timing errors will be
|
||||
|
||||
corrected! (Timing correction may be adjusted or defeated).
|
||||
|
||||
Any additional notes played will be added into the track
|
||||
—existing notes are not erased while recording!
|
||||
|
||||
FAST FORWARD, REWIND, and LOCATE controls
|
||||
may be used at any time to quickly access any location in
|
||||
your sequence for spot—recording. To overdub a new part,
|
||||
select a different track and start recording~while you
|
||||
record, the first‘track will play in perfect sync (unless you
|
||||
MUTE it, or SOLO another track). In this way, up to 32
|
||||
tracks may be overdubbed! All MIDI effects are recorded
|
||||
including pitch bend, modulation, velocity, aftertouch,
|
||||
sustain pedal, and program changes!
|
||||
|
||||
Editing
|
||||
|
||||
To erase a wrong note, simply hold ERASE and press
|
||||
the note to be erased just before it plays in the sequence—
|
||||
when played back, it will be gone. Notes may also be
|
||||
|
||||
added, erased, or changed using the SINGLE STEP func-
|
||||
tion. To overdub notes at specific points within a sequence,
|
||||
|
||||
Additional Features
|
||||
|
||||
simply use LOCATE, FAST FORWARD, or REWIND to
|
||||
find the desired bar number, then start recording.
|
||||
|
||||
The INSERT/COPY function allows you to move bars
|
||||
from one location to another—in the same sequence or a
|
||||
different one. For example, you might insert a copy of the
|
||||
first verse between the second chorus and the bridge.
|
||||
DELETE BARS operates the same way to remove
|
||||
unwanted sections.
|
||||
|
||||
Creating a Song
|
||||
|
||||
One way to create a song is to record each track all the
|
||||
way through (up to 999 bars). Another way is to record
|
||||
each basic section (verse, chorus, etc.) in individual
|
||||
sequences, then use the CREATE SONG function to “chain”
|
||||
them together. CREATE SONG will then automatically
|
||||
copy all the parts into a new sequence. If desired, you can
|
||||
even set the last few bars to repeat infinitely, for a fadeout.
|
||||
|
||||
Composition Without Compromise
|
||||
|
||||
The technology you use should never be so complex that
|
||||
it interferes with the creative process. That’s precisely why
|
||||
the LinnSequencer is designed to let you compose, record
|
||||
and edit while devoting your undivided attention to your
|
||||
music. See your Linn dealer today for a demonstration!
|
||||
|
||||
0 Simple, easy to learn operation—the 32 character LCD display clearly guides you through all operations. If needed, the
|
||||
|
||||
HELP button displays additional explanations.
|
||||
|
||||
0 Non-destructive recording—existing notes are not erased while recording.
|
||||
0 Two FOOTSWITCH INPUTS may be assigned to remotely control many of the commonly used functions, including
|
||||
|
||||
ERASE, REPEAT, PLAY/STOP, or LOCATE.
|
||||
|
||||
0 Two TRIGGER OUTPUTS may be programmed to output pulses at any selected note value.
|
||||
|
||||
0 Will sync to standard LinnDrum or Linn 9000 sync tone.
|
||||
|
||||
' Utilizes ultra high—speed, 8 MHz 80186 16 bit computer internally for FAST operation.
|
||||
0 TEMPO may be specified in BEATS-PER—MINUTE or FRAMES-PER—BEAT at 24, 25, or 30 frames per second,
|
||||
|
||||
(even drop frame!)
|
||||
|
||||
0 TEMPO may be entered numerically, adjustable in tenths of a Beat-Per-Minute increments, or by tapping quarter notes
|
||||
|
||||
on the TAP TEMPO button.
|
||||
|
||||
0 TEMPO CHANGES may be programmed into a sequence, with smooth transitions if desired.
|
||||
° Any TIME SIGNATURE may be used, and may be changed within a song.
|
||||
|
||||
E1111
|
||||
Linn Electronics, Inc.
|
||||
|
||||
18720 Oxnard Street, Tarzana, CA 91356
|
||||
(818) 7088131 T ELEX #298949 LINN UR
|
||||
|
||||
@@ -0,0 +1,335 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head>
|
||||
<title></title>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
|
||||
<meta name='ocr-system' content='tesseract 3.05.01' />
|
||||
<meta name='ocr-capabilities' content='ocr_page ocr_carea ocr_par ocr_line ocrx_word'/>
|
||||
</head>
|
||||
<body>
|
||||
<div class='ocr_page' id='page_1' title='image "/var/folders/37/78_114p552q16vv6vmgm5kr00000gn/T/com.github.ocrmypdf.wahjk6fa/000002.ocr.png"; bbox 0 0 2550 3300; ppageno 0'>
|
||||
<div class='ocr_carea' id='block_1_1' title="bbox 582 131 1968 303">
|
||||
<p class='ocr_par' id='par_1_1' lang='eng' title="bbox 582 131 1968 303">
|
||||
<span class='ocr_line' id='line_1_1' title="bbox 882 131 1657 217; baseline 0.001 -17; x_size 85; x_descenders 16; x_ascenders 19"><span class='ocrx_word' id='word_1_1' title='bbox 882 132 1036 202; x_wconf 86'>The</span> <span class='ocrx_word' id='word_1_2' title='bbox 1061 131 1657 217; x_wconf 84'>LinnSequencer</span>
|
||||
</span>
|
||||
<span class='ocr_line' id='line_1_2' title="bbox 582 215 1968 303; baseline 0 -17; x_size 87; x_descenders 16; x_ascenders 21"><span class='ocrx_word' id='word_1_3' title='bbox 582 215 674 286; x_wconf 90'>32</span> <span class='ocrx_word' id='word_1_4' title='bbox 697 218 923 288; x_wconf 84'>Track</span> <span class='ocrx_word' id='word_1_5' title='bbox 948 218 1181 287; x_wconf 94'><strong>MIDI</strong></span> <span class='ocrx_word' id='word_1_6' title='bbox 1208 217 1575 303; x_wconf 89'>Sequence</span> <span class='ocrx_word' id='word_1_7' title='bbox 1600 218 1968 288; x_wconf 83'>Recorder</span>
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
<div class='ocr_carea' id='block_1_2' title="bbox 347 380 2188 574">
|
||||
<p class='ocr_par' id='par_1_2' lang='eng' title="bbox 347 380 2188 423">
|
||||
<span class='ocr_line' id='line_1_3' title="bbox 347 380 2188 423; baseline -0.001 -12; x_size 38; x_descenders 8; x_ascenders 10"><span class='ocrx_word' id='word_1_8' title='bbox 347 380 412 410; x_wconf 86'>The</span> <span class='ocrx_word' id='word_1_9' title='bbox 424 380 676 417; x_wconf 85'>LinnSequencer</span> <span class='ocrx_word' id='word_1_10' title='bbox 688 380 712 411; x_wconf 87'>is</span> <span class='ocrx_word' id='word_1_11' title='bbox 724 390 743 411; x_wconf 90'>a</span> <span class='ocrx_word' id='word_1_12' title='bbox 754 381 1005 423; x_wconf 79'>state—of—the-art</span> <span class='ocrx_word' id='word_1_13' title='bbox 1017 380 1226 418; x_wconf 86'>composition</span> <span class='ocrx_word' id='word_1_14' title='bbox 1238 381 1299 411; x_wconf 88'>and</span> <span class='ocrx_word' id='word_1_15' title='bbox 1311 380 1525 418; x_wconf 85'>performance</span> <span class='ocrx_word' id='word_1_16' title='bbox 1536 380 1602 411; x_wconf 85'>tool</span> <span class='ocrx_word' id='word_1_17' title='bbox 1615 380 1663 411; x_wconf 82'>for</span> <span class='ocrx_word' id='word_1_18' title='bbox 1674 381 1725 410; x_wconf 94'>the</span> <span class='ocrx_word' id='word_1_19' title='bbox 1737 380 1940 417; x_wconf 85'>professional</span> <span class='ocrx_word' id='word_1_20' title='bbox 1952 380 2112 411; x_wconf 87'>musician.</span> <span class='ocrx_word' id='word_1_21' title='bbox 2127 381 2152 410; x_wconf 90'>It</span> <span class='ocrx_word' id='word_1_22' title='bbox 2164 380 2188 410; x_wconf 90'>is</span>
|
||||
</span>
|
||||
</p>
|
||||
|
||||
<p class='ocr_par' id='par_1_3' lang='eng' title="bbox 347 430 1988 468">
|
||||
<span class='ocr_line' id='line_1_4' title="bbox 347 430 1988 468; baseline 0 -8; x_size 37; x_descenders 7; x_ascenders 9"><span class='ocrx_word' id='word_1_23' title='bbox 347 430 507 467; x_wconf 86'>extremely</span> <span class='ocrx_word' id='word_1_24' title='bbox 518 430 677 467; x_wconf 84'>powerful,</span> <span class='ocrx_word' id='word_1_25' title='bbox 691 435 739 467; x_wconf 91'>yet</span> <span class='ocrx_word' id='word_1_26' title='bbox 752 430 924 468; x_wconf 87'>amazingly</span> <span class='ocrx_word' id='word_1_27' title='bbox 936 430 1044 468; x_wconf 85'>simple</span> <span class='ocrx_word' id='word_1_28' title='bbox 1055 435 1087 461; x_wconf 87'>to</span> <span class='ocrx_word' id='word_1_29' title='bbox 1099 431 1183 461; x_wconf 88'>learn</span> <span class='ocrx_word' id='word_1_30' title='bbox 1195 431 1257 461; x_wconf 90'>and</span> <span class='ocrx_word' id='word_1_31' title='bbox 1269 440 1329 461; x_wconf 89'>use.</span> <span class='ocrx_word' id='word_1_32' title='bbox 1344 431 1393 461; x_wconf 87'>It’s</span> <span class='ocrx_word' id='word_1_33' title='bbox 1406 440 1499 467; x_wconf 91'>many</span> <span class='ocrx_word' id='word_1_34' title='bbox 1510 430 1701 461; x_wconf 88'>remarkable</span> <span class='ocrx_word' id='word_1_35' title='bbox 1714 430 1843 460; x_wconf 85'>features</span> <span class='ocrx_word' id='word_1_36' title='bbox 1856 430 1988 461; x_wconf 87'>include:</span>
|
||||
</span>
|
||||
</p>
|
||||
|
||||
<p class='ocr_par' id='par_1_4' lang='eng' title="bbox 350 482 2093 574">
|
||||
<span class='ocr_line' id='line_1_5' title="bbox 350 482 2093 527; baseline 0 -9; x_size 43; x_descenders 7; x_ascenders 11"><span class='ocrx_word' id='word_1_37' title='bbox 350 490 368 508; x_wconf 68'><strong>0</strong></span> <span class='ocrx_word' id='word_1_38' title='bbox 383 482 585 526; x_wconf 88'>Operation</span> <span class='ocrx_word' id='word_1_39' title='bbox 598 482 627 518; x_wconf 89'>is</span> <span class='ocrx_word' id='word_1_40' title='bbox 641 482 776 518; x_wconf 88'>similar</span> <span class='ocrx_word' id='word_1_41' title='bbox 789 488 829 518; x_wconf 88'>to</span> <span class='ocrx_word' id='word_1_42' title='bbox 843 482 1062 519; x_wconf 86'>multi—track</span> <span class='ocrx_word' id='word_1_43' title='bbox 1076 488 1160 527; x_wconf 92'>tape</span> <span class='ocrx_word' id='word_1_44' title='bbox 1173 483 1336 519; x_wconf 88'>recorder</span> <span class='ocrx_word' id='word_1_45' title='bbox 1350 482 1436 518; x_wconf 87'>with</span> <span class='ocrx_word' id='word_1_46' title='bbox 1451 483 1580 525; x_wconf 90'>PLAY,</span> <span class='ocrx_word' id='word_1_47' title='bbox 1598 483 1724 525; x_wconf 90'>STOP,</span> <span class='ocrx_word' id='word_1_48' title='bbox 1741 483 1957 525; x_wconf 89'>RECORD,</span> <span class='ocrx_word' id='word_1_49' title='bbox 1974 483 2093 518; x_wconf 88'>FAST</span>
|
||||
</span>
|
||||
<span class='ocr_line' id='line_1_6' title="bbox 383 532 1345 574; baseline 0.001 -7; x_size 43; x_descenders 7; x_ascenders 11"><span class='ocrx_word' id='word_1_50' title='bbox 383 532 635 574; x_wconf 88'>FORWARD,</span> <span class='ocrx_word' id='word_1_51' title='bbox 652 532 865 574; x_wconf 89'>REWIND,</span> <span class='ocrx_word' id='word_1_52' title='bbox 882 532 956 568; x_wconf 91'>and</span> <span class='ocrx_word' id='word_1_53' title='bbox 971 532 1163 568; x_wconf 90'>LOCATE</span> <span class='ocrx_word' id='word_1_54' title='bbox 1177 532 1345 568; x_wconf 87'>controls.</span>
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
<div class='ocr_carea' id='block_1_3' title="bbox 349 589 2136 685">
|
||||
<p class='ocr_par' id='par_1_5' lang='eng' title="bbox 349 589 2136 685">
|
||||
<span class='ocr_line' id='line_1_7' title="bbox 349 589 2136 634; baseline 0.001 -9; x_size 44; x_descenders 8; x_ascenders 11"><span class='ocrx_word' id='word_1_55' title='bbox 349 597 368 615; x_wconf 67'><strong>0</strong></span> <span class='ocrx_word' id='word_1_56' title='bbox 383 590 482 625; x_wconf 90'>Each</span> <span class='ocrx_word' id='word_1_57' title='bbox 496 589 539 625; x_wconf 87'>of</span> <span class='ocrx_word' id='word_1_58' title='bbox 549 590 611 626; x_wconf 92'>the</span> <span class='ocrx_word' id='word_1_59' title='bbox 625 590 686 625; x_wconf 91'>100</span> <span class='ocrx_word' id='word_1_60' title='bbox 700 601 895 634; x_wconf 89'>sequences</span> <span class='ocrx_word' id='word_1_61' title='bbox 909 590 1075 626; x_wconf 88'>contains</span> <span class='ocrx_word' id='word_1_62' title='bbox 1090 591 1135 626; x_wconf 89'>32</span> <span class='ocrx_word' id='word_1_63' title='bbox 1149 590 1418 633; x_wconf 87'>simultaneous,</span> <span class='ocrx_word' id='word_1_64' title='bbox 1435 590 1661 634; x_wconf 89'>polyphonic</span> <span class='ocrx_word' id='word_1_65' title='bbox 1674 590 1802 626; x_wconf 85'>tracks.</span> <span class='ocrx_word' id='word_1_66' title='bbox 1819 590 1921 626; x_wconf 89'>Each</span> <span class='ocrx_word' id='word_1_67' title='bbox 1934 590 2035 626; x_wconf 88'>track</span> <span class='ocrx_word' id='word_1_68' title='bbox 2050 600 2136 634; x_wconf 89'>may</span>
|
||||
</span>
|
||||
<span class='ocr_line' id='line_1_8' title="bbox 383 639 2022 685; baseline 0.001 -10; x_size 44; x_descenders 8; x_ascenders 11"><span class='ocrx_word' id='word_1_69' title='bbox 383 639 428 675; x_wconf 95'>be</span> <span class='ocrx_word' id='word_1_70' title='bbox 442 639 607 684; x_wconf 88'>assigned</span> <span class='ocrx_word' id='word_1_71' title='bbox 621 645 659 676; x_wconf 92'>to</span> <span class='ocrx_word' id='word_1_72' title='bbox 674 650 745 676; x_wconf 91'>one</span> <span class='ocrx_word' id='word_1_73' title='bbox 759 640 801 676; x_wconf 84'>of</span> <span class='ocrx_word' id='word_1_74' title='bbox 813 641 851 676; x_wconf 92'>16</span> <span class='ocrx_word' id='word_1_75' title='bbox 864 641 980 675; x_wconf 90'>MIDI</span> <span class='ocrx_word' id='word_1_76' title='bbox 996 640 1176 676; x_wconf 88'>channels.</span> <span class='ocrx_word' id='word_1_77' title='bbox 1194 640 1498 684; x_wconf 90'>Simultaneously</span> <span class='ocrx_word' id='word_1_78' title='bbox 1510 640 1609 685; x_wconf 90'>plays</span> <span class='ocrx_word' id='word_1_79' title='bbox 1624 651 1674 684; x_wconf 91'>up</span> <span class='ocrx_word' id='word_1_80' title='bbox 1688 645 1727 676; x_wconf 90'>to</span> <span class='ocrx_word' id='word_1_81' title='bbox 1742 641 1780 676; x_wconf 94'>16</span> <span class='ocrx_word' id='word_1_82' title='bbox 1794 640 2022 684; x_wconf 87'>polyphonic</span>
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
<div class='ocr_carea' id='block_1_4' title="bbox 384 689 632 734">
|
||||
<p class='ocr_par' id='par_1_6' lang='eng' title="bbox 384 689 632 734">
|
||||
<span class='ocr_line' id='line_1_9' title="bbox 384 689 632 734; baseline 0.004 -9; x_size 46; x_descenders 9; x_ascenders 12"><span class='ocrx_word' id='word_1_83' title='bbox 384 689 618 734; x_wconf 84'>synthesizers</span> <span class='ocrx_word' id='word_1_84' title='bbox 625 690 632 726; x_wconf 85'><strong>!</strong></span>
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
<div class='ocr_carea' id='block_1_5' title="bbox 349 748 2117 793">
|
||||
<p class='ocr_par' id='par_1_7' lang='eng' title="bbox 349 748 2117 793">
|
||||
<span class='ocr_line' id='line_1_10' title="bbox 349 748 2117 793; baseline 0 -9; x_size 45; x_descenders 9; x_ascenders 11"><span class='ocrx_word' id='word_1_85' title='bbox 349 755 367 774; x_wconf 66'><strong>0</strong></span> <span class='ocrx_word' id='word_1_86' title='bbox 383 748 573 784; x_wconf 87'>Ultra—fast</span> <span class='ocrx_word' id='word_1_87' title='bbox 588 749 606 784; x_wconf 90'>3</span> <span class='ocrx_word' id='word_1_88' title='bbox 616 749 652 784; x_wconf 86'>1/2</span> <span class='ocrx_word' id='word_1_89' title='bbox 663 749 677 764; x_wconf 87'><em>”</em></span> <span class='ocrx_word' id='word_1_90' title='bbox 694 748 775 784; x_wconf 91'>disk</span> <span class='ocrx_word' id='word_1_91' title='bbox 790 748 887 784; x_wconf 89'>drive</span> <span class='ocrx_word' id='word_1_92' title='bbox 901 754 1012 785; x_wconf 85'>stores</span> <span class='ocrx_word' id='word_1_93' title='bbox 1027 748 1194 793; x_wconf 87'>complex</span> <span class='ocrx_word' id='word_1_94' title='bbox 1208 760 1316 793; x_wconf 87'>songs</span> <span class='ocrx_word' id='word_1_95' title='bbox 1330 748 1368 784; x_wconf 87'>in</span> <span class='ocrx_word' id='word_1_96' title='bbox 1382 748 1535 785; x_wconf 87'>seconds</span> <span class='ocrx_word' id='word_1_97' title='bbox 1550 748 1624 784; x_wconf 89'>and</span> <span class='ocrx_word' id='word_1_98' title='bbox 1638 748 1746 784; x_wconf 87'>holds</span> <span class='ocrx_word' id='word_1_99' title='bbox 1761 759 1844 784; x_wconf 85'>over</span> <span class='ocrx_word' id='word_1_100' title='bbox 1859 749 2000 791; x_wconf 88'>110,000</span> <span class='ocrx_word' id='word_1_101' title='bbox 2013 753 2117 784; x_wconf 89'>notes</span>
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
<div class='ocr_carea' id='block_1_6' title="bbox 383 797 554 842">
|
||||
<p class='ocr_par' id='par_1_8' lang='eng' title="bbox 383 797 554 842">
|
||||
<span class='ocr_line' id='line_1_11' title="bbox 383 797 554 842; baseline 0 -8; x_size 45; x_descenders 8; x_ascenders 12"><span class='ocrx_word' id='word_1_102' title='bbox 383 808 446 842; x_wconf 82'>per</span> <span class='ocrx_word' id='word_1_103' title='bbox 459 797 554 834; x_wconf 86'>disk!</span>
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
<div class='ocr_carea' id='block_1_7' title="bbox 349 855 2030 1016">
|
||||
<p class='ocr_par' id='par_1_9' lang='eng' title="bbox 349 855 2030 1016">
|
||||
<span class='ocr_line' id='line_1_12' title="bbox 350 855 1638 900; baseline 0.001 -9; x_size 45; x_descenders 9; x_ascenders 11"><span class='ocrx_word' id='word_1_104' title='bbox 350 863 367 881; x_wconf 71'><strong>0</strong></span> <span class='ocrx_word' id='word_1_105' title='bbox 383 856 464 891; x_wconf 90'>One</span> <span class='ocrx_word' id='word_1_106' title='bbox 478 866 520 891; x_wconf 87'>or</span> <span class='ocrx_word' id='word_1_107' title='bbox 534 855 580 891; x_wconf 88'>all</span> <span class='ocrx_word' id='word_1_108' title='bbox 594 856 712 892; x_wconf 89'>tracks</span> <span class='ocrx_word' id='word_1_109' title='bbox 726 867 811 900; x_wconf 90'>may</span> <span class='ocrx_word' id='word_1_110' title='bbox 823 856 869 892; x_wconf 88'>be</span> <span class='ocrx_word' id='word_1_111' title='bbox 882 856 1212 892; x_wconf 90'>TRANSPOSED</span> <span class='ocrx_word' id='word_1_112' title='bbox 1227 861 1264 892; x_wconf 90'>at</span> <span class='ocrx_word' id='word_1_113' title='bbox 1277 856 1338 892; x_wconf 85'>the</span> <span class='ocrx_word' id='word_1_114' title='bbox 1351 856 1463 892; x_wconf 90'>touch</span> <span class='ocrx_word' id='word_1_115' title='bbox 1477 856 1520 892; x_wconf 89'>of</span> <span class='ocrx_word' id='word_1_116' title='bbox 1531 867 1554 892; x_wconf 90'>a</span> <span class='ocrx_word' id='word_1_117' title='bbox 1568 856 1638 900; x_wconf 89'>key.</span>
|
||||
</span>
|
||||
<span class='ocr_line' id='line_1_13' title="bbox 350 913 1535 958; baseline 0.001 -9; x_size 44; x_descenders 8; x_ascenders 11"><span class='ocrx_word' id='word_1_118' title='bbox 350 921 367 939; x_wconf 70'><strong>0</strong></span> <span class='ocrx_word' id='word_1_119' title='bbox 383 913 568 950; x_wconf 84'>Exclusive</span> <span class='ocrx_word' id='word_1_120' title='bbox 581 913 756 950; x_wconf 87'>real—time</span> <span class='ocrx_word' id='word_1_121' title='bbox 769 914 929 950; x_wconf 91'>ERASE</span> <span class='ocrx_word' id='word_1_122' title='bbox 944 914 1114 950; x_wconf 87'>function</span> <span class='ocrx_word' id='word_1_123' title='bbox 1128 914 1251 950; x_wconf 88'>makes</span> <span class='ocrx_word' id='word_1_124' title='bbox 1266 914 1400 958; x_wconf 87'>editing</span> <span class='ocrx_word' id='word_1_125' title='bbox 1414 915 1535 950; x_wconf 91'>FAST.</span>
|
||||
</span>
|
||||
<span class='ocr_line' id='line_1_14' title="bbox 349 971 2030 1016; baseline 0.001 -10; x_size 44; x_descenders 8; x_ascenders 11"><span class='ocrx_word' id='word_1_126' title='bbox 349 979 367 997; x_wconf 67'><strong>0</strong></span> <span class='ocrx_word' id='word_1_127' title='bbox 382 971 568 1007; x_wconf 83'>Exclusive</span> <span class='ocrx_word' id='word_1_128' title='bbox 582 972 773 1007; x_wconf 87'>REPEAT</span> <span class='ocrx_word' id='word_1_129' title='bbox 787 972 958 1008; x_wconf 86'>function</span> <span class='ocrx_word' id='word_1_130' title='bbox 971 972 1245 1016; x_wconf 89'>automatically</span> <span class='ocrx_word' id='word_1_131' title='bbox 1258 977 1396 1016; x_wconf 90'>repeats</span> <span class='ocrx_word' id='word_1_132' title='bbox 1410 983 1481 1016; x_wconf 88'>any</span> <span class='ocrx_word' id='word_1_133' title='bbox 1493 972 1578 1008; x_wconf 91'>held</span> <span class='ocrx_word' id='word_1_134' title='bbox 1592 977 1694 1008; x_wconf 91'>notes</span> <span class='ocrx_word' id='word_1_135' title='bbox 1709 977 1746 1008; x_wconf 85'>at</span> <span class='ocrx_word' id='word_1_136' title='bbox 1760 982 1783 1008; x_wconf 89'>a</span> <span class='ocrx_word' id='word_1_137' title='bbox 1796 972 2030 1016; x_wconf 87'>pre-selected</span>
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
<div class='ocr_carea' id='block_1_8' title="bbox 382 1021 689 1065">
|
||||
<p class='ocr_par' id='par_1_10' lang='eng' title="bbox 382 1021 689 1065">
|
||||
<span class='ocr_line' id='line_1_15' title="bbox 382 1021 689 1065; baseline 0.003 -8; x_size 45; x_descenders 8; x_ascenders 12"><span class='ocrx_word' id='word_1_138' title='bbox 382 1021 564 1065; x_wconf 87'>rhythmic</span> <span class='ocrx_word' id='word_1_139' title='bbox 577 1021 689 1058; x_wconf 86'>value.</span>
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
<div class='ocr_carea' id='block_1_9' title="bbox 349 1080 2174 1125">
|
||||
<p class='ocr_par' id='par_1_11' lang='eng' title="bbox 349 1080 2174 1125">
|
||||
<span class='ocr_line' id='line_1_16' title="bbox 349 1080 2174 1125; baseline 0.001 -11; x_size 45; x_descenders 9; x_ascenders 11"><span class='ocrx_word' id='word_1_140' title='bbox 349 1087 367 1105; x_wconf 73'><strong>0</strong></span> <span class='ocrx_word' id='word_1_141' title='bbox 382 1080 567 1115; x_wconf 87'>TIMING</span> <span class='ocrx_word' id='word_1_142' title='bbox 582 1080 908 1116; x_wconf 90'>CORRECTION</span> <span class='ocrx_word' id='word_1_143' title='bbox 921 1080 1041 1116; x_wconf 90'>works</span> <span class='ocrx_word' id='word_1_144' title='bbox 1056 1080 1186 1124; x_wconf 86'>during</span> <span class='ocrx_word' id='word_1_145' title='bbox 1199 1080 1378 1124; x_wconf 89'>playback</span> <span class='ocrx_word' id='word_1_146' title='bbox 1392 1080 1466 1116; x_wconf 90'>and</span> <span class='ocrx_word' id='word_1_147' title='bbox 1480 1085 1644 1124; x_wconf 87'>operates</span> <span class='ocrx_word' id='word_1_148' title='bbox 1658 1080 1814 1116; x_wconf 91'>without</span> <span class='ocrx_word' id='word_1_149' title='bbox 1831 1080 2044 1125; x_wconf 87'>‘chopping’</span> <span class='ocrx_word' id='word_1_150' title='bbox 2061 1085 2174 1116; x_wconf 88'>notes.</span>
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
<div class='ocr_carea' id='block_1_10' title="bbox 349 1137 1287 1182">
|
||||
<p class='ocr_par' id='par_1_12' lang='eng' title="bbox 349 1137 1287 1182">
|
||||
<span class='ocr_line' id='line_1_17' title="bbox 349 1137 1287 1182; baseline 0.001 -9; x_size 45; x_descenders 9; x_ascenders 11"><span class='ocrx_word' id='word_1_151' title='bbox 349 1145 367 1163; x_wconf 73'><strong>0</strong></span> <span class='ocrx_word' id='word_1_152' title='bbox 382 1137 560 1182; x_wconf 85'>Optional</span> <span class='ocrx_word' id='word_1_153' title='bbox 575 1138 739 1174; x_wconf 89'>SMPTE</span> <span class='ocrx_word' id='word_1_154' title='bbox 752 1138 839 1174; x_wconf 89'>time</span> <span class='ocrx_word' id='word_1_155' title='bbox 853 1138 945 1174; x_wconf 89'>code</span> <span class='ocrx_word' id='word_1_156' title='bbox 959 1138 1287 1182; x_wconf 88'>synchronization.</span>
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
<div class='ocr_carea' id='block_1_11' title="bbox 349 1195 874 1240">
|
||||
<p class='ocr_par' id='par_1_13' lang='eng' title="bbox 349 1195 874 1240">
|
||||
<span class='ocr_line' id='line_1_18' title="bbox 349 1195 874 1240; baseline 0 -8; x_size 45; x_descenders 8; x_ascenders 12"><span class='ocrx_word' id='word_1_157' title='bbox 349 1203 367 1222; x_wconf 70'><strong>0</strong></span> <span class='ocrx_word' id='word_1_158' title='bbox 382 1195 560 1240; x_wconf 87'>Optional</span> <span class='ocrx_word' id='word_1_159' title='bbox 573 1201 709 1233; x_wconf 86'>remote</span> <span class='ocrx_word' id='word_1_160' title='bbox 723 1196 874 1233; x_wconf 87'>control.</span>
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
<div class='ocr_carea' id='block_1_12' title="bbox 346 1288 1239 1491">
|
||||
<p class='ocr_par' id='par_1_14' lang='eng' title="bbox 346 1288 749 1329">
|
||||
<span class='ocr_line' id='line_1_19' title="bbox 346 1288 749 1329; baseline 0.002 -9; x_size 42; x_descenders 9; x_ascenders 10"><span class='ocrx_word' id='word_1_161' title='bbox 346 1288 535 1329; x_wconf 82'>Recording</span> <span class='ocrx_word' id='word_1_162' title='bbox 547 1298 567 1321; x_wconf 73'>3</span> <span class='ocrx_word' id='word_1_163' title='bbox 579 1288 749 1328; x_wconf 86'>Sequence</span>
|
||||
</span>
|
||||
</p>
|
||||
|
||||
<p class='ocr_par' id='par_1_15' lang='eng' title="bbox 346 1339 1239 1491">
|
||||
<span class='ocr_line' id='line_1_20' title="bbox 383 1339 1239 1373; baseline 0 -7; x_size 33; x_descenders 7; x_ascenders 8"><span class='ocrx_word' id='word_1_164' title='bbox 383 1340 420 1366; x_wconf 87'>To</span> <span class='ocrx_word' id='word_1_165' title='bbox 430 1339 524 1366; x_wconf 85'>record</span> <span class='ocrx_word' id='word_1_166' title='bbox 535 1347 551 1366; x_wconf 87'>a</span> <span class='ocrx_word' id='word_1_167' title='bbox 562 1347 704 1373; x_wconf 80'>sequence,</span> <span class='ocrx_word' id='word_1_168' title='bbox 716 1340 815 1373; x_wconf 91'>simply</span> <span class='ocrx_word' id='word_1_169' title='bbox 825 1348 898 1373; x_wconf 88'>press</span> <span class='ocrx_word' id='word_1_170' title='bbox 910 1340 1065 1367; x_wconf 90'>RECORD</span> <span class='ocrx_word' id='word_1_171' title='bbox 1075 1340 1131 1367; x_wconf 87'>and</span> <span class='ocrx_word' id='word_1_172' title='bbox 1142 1341 1239 1372; x_wconf 87'>PLAY,</span>
|
||||
</span>
|
||||
<span class='ocr_line' id='line_1_21' title="bbox 346 1378 1205 1412; baseline 0.001 -7; x_size 34; x_descenders 7; x_ascenders 8"><span class='ocrx_word' id='word_1_173' title='bbox 346 1379 411 1406; x_wconf 91'>then</span> <span class='ocrx_word' id='word_1_174' title='bbox 422 1378 483 1412; x_wconf 89'>play</span> <span class='ocrx_word' id='word_1_175' title='bbox 493 1387 562 1412; x_wconf 87'>your</span> <span class='ocrx_word' id='word_1_176' title='bbox 572 1379 659 1405; x_wconf 89'>MIDI</span> <span class='ocrx_word' id='word_1_177' title='bbox 671 1379 810 1412; x_wconf 86'>keyboard</span> <span class='ocrx_word' id='word_1_178' title='bbox 821 1379 848 1406; x_wconf 90'>in</span> <span class='ocrx_word' id='word_1_179' title='bbox 858 1379 923 1406; x_wconf 90'>time</span> <span class='ocrx_word' id='word_1_180' title='bbox 934 1384 963 1406; x_wconf 90'>to</span> <span class='ocrx_word' id='word_1_181' title='bbox 974 1379 1019 1406; x_wconf 92'>the</span> <span class='ocrx_word' id='word_1_182' title='bbox 1030 1379 1205 1412; x_wconf 88'>Sequencer’s</span>
|
||||
</span>
|
||||
<span class='ocr_line' id='line_1_22' title="bbox 347 1417 1232 1452; baseline 0.002 -8; x_size 34; x_descenders 7; x_ascenders 8"><span class='ocrx_word' id='word_1_183' title='bbox 347 1417 414 1445; x_wconf 86'>click</span> <span class='ocrx_word' id='word_1_184' title='bbox 425 1418 506 1445; x_wconf 84'>track.</span> <span class='ocrx_word' id='word_1_185' title='bbox 519 1418 609 1445; x_wconf 85'>When</span> <span class='ocrx_word' id='word_1_186' title='bbox 620 1419 665 1445; x_wconf 89'>the</span> <span class='ocrx_word' id='word_1_187' title='bbox 676 1426 810 1452; x_wconf 86'>sequence</span> <span class='ocrx_word' id='word_1_188' title='bbox 821 1419 901 1452; x_wconf 88'>loops</span> <span class='ocrx_word' id='word_1_189' title='bbox 912 1419 983 1446; x_wconf 86'>back</span> <span class='ocrx_word' id='word_1_190' title='bbox 995 1419 1101 1446; x_wconf 90'>around</span> <span class='ocrx_word' id='word_1_191' title='bbox 1112 1423 1141 1446; x_wconf 91'>to</span> <span class='ocrx_word' id='word_1_192' title='bbox 1152 1419 1201 1446; x_wconf 87'>bar</span> <span class='ocrx_word' id='word_1_193' title='bbox 1213 1419 1232 1450; x_wconf 88'>1,</span>
|
||||
</span>
|
||||
<span class='ocr_line' id='line_1_23' title="bbox 346 1457 1223 1491; baseline 0.001 -7; x_size 34; x_descenders 7; x_ascenders 8"><span class='ocrx_word' id='word_1_194' title='bbox 346 1457 430 1490; x_wconf 84'>you’ll</span> <span class='ocrx_word' id='word_1_195' title='bbox 441 1457 506 1485; x_wconf 93'>hear</span> <span class='ocrx_word' id='word_1_196' title='bbox 517 1458 590 1485; x_wconf 79'>what</span> <span class='ocrx_word' id='word_1_197' title='bbox 600 1466 654 1491; x_wconf 88'>you</span> <span class='ocrx_word' id='word_1_198' title='bbox 666 1458 865 1491; x_wconf 77'>played—only</span> <span class='ocrx_word' id='word_1_199' title='bbox 876 1458 910 1485; x_wconf 90'>all</span> <span class='ocrx_word' id='word_1_200' title='bbox 921 1458 1018 1491; x_wconf 84'>timing</span> <span class='ocrx_word' id='word_1_201' title='bbox 1029 1466 1115 1485; x_wconf 84'>errors</span> <span class='ocrx_word' id='word_1_202' title='bbox 1126 1458 1179 1485; x_wconf 91'>will</span> <span class='ocrx_word' id='word_1_203' title='bbox 1189 1458 1223 1485; x_wconf 91'>be</span>
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
<div class='ocr_carea' id='block_1_13' title="bbox 346 1497 1245 1531">
|
||||
<p class='ocr_par' id='par_1_16' lang='eng' title="bbox 346 1497 1245 1531">
|
||||
<span class='ocr_line' id='line_1_24' title="bbox 346 1497 1245 1531; baseline 0.001 -7; x_size 35; x_descenders 7; x_ascenders 9"><span class='ocrx_word' id='word_1_204' title='bbox 346 1497 494 1524; x_wconf 86'>corrected!</span> <span class='ocrx_word' id='word_1_205' title='bbox 508 1497 628 1530; x_wconf 85'>(Timing</span> <span class='ocrx_word' id='word_1_206' title='bbox 638 1497 791 1525; x_wconf 82'>correction</span> <span class='ocrx_word' id='word_1_207' title='bbox 802 1506 864 1531; x_wconf 88'>may</span> <span class='ocrx_word' id='word_1_208' title='bbox 875 1498 909 1525; x_wconf 91'>be</span> <span class='ocrx_word' id='word_1_209' title='bbox 920 1497 1047 1531; x_wconf 81'>adjusted</span> <span class='ocrx_word' id='word_1_210' title='bbox 1058 1505 1089 1525; x_wconf 92'>or</span> <span class='ocrx_word' id='word_1_211' title='bbox 1099 1497 1245 1531; x_wconf 87'>defeated).</span>
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
<div class='ocr_carea' id='block_1_14' title="bbox 346 1536 1205 1965">
|
||||
<p class='ocr_par' id='par_1_17' lang='eng' title="bbox 346 1536 1186 1610">
|
||||
<span class='ocr_line' id='line_1_25' title="bbox 346 1536 1186 1570; baseline 0.001 -7; x_size 34; x_descenders 7; x_ascenders 8"><span class='ocrx_word' id='word_1_212' title='bbox 346 1537 409 1569; x_wconf 90'>Any</span> <span class='ocrx_word' id='word_1_213' title='bbox 419 1536 571 1563; x_wconf 86'>additional</span> <span class='ocrx_word' id='word_1_214' title='bbox 582 1541 659 1564; x_wconf 85'>notes</span> <span class='ocrx_word' id='word_1_215' title='bbox 670 1537 766 1570; x_wconf 87'>played</span> <span class='ocrx_word' id='word_1_216' title='bbox 777 1537 830 1563; x_wconf 88'>will</span> <span class='ocrx_word' id='word_1_217' title='bbox 840 1537 874 1564; x_wconf 92'>be</span> <span class='ocrx_word' id='word_1_218' title='bbox 885 1537 976 1564; x_wconf 88'>added</span> <span class='ocrx_word' id='word_1_219' title='bbox 986 1537 1045 1564; x_wconf 89'>into</span> <span class='ocrx_word' id='word_1_220' title='bbox 1055 1537 1101 1564; x_wconf 89'>the</span> <span class='ocrx_word' id='word_1_221' title='bbox 1111 1537 1186 1564; x_wconf 82'>track</span>
|
||||
</span>
|
||||
<span class='ocr_line' id='line_1_26' title="bbox 347 1575 1052 1610; baseline 0.001 -8; x_size 34; x_descenders 7; x_ascenders 8"><span class='ocrx_word' id='word_1_222' title='bbox 347 1575 495 1609; x_wconf 86'>—existing</span> <span class='ocrx_word' id='word_1_223' title='bbox 505 1580 582 1603; x_wconf 89'>notes</span> <span class='ocrx_word' id='word_1_224' title='bbox 593 1584 637 1603; x_wconf 90'>are</span> <span class='ocrx_word' id='word_1_225' title='bbox 648 1580 696 1603; x_wconf 88'>not</span> <span class='ocrx_word' id='word_1_226' title='bbox 707 1576 800 1603; x_wconf 90'>erased</span> <span class='ocrx_word' id='word_1_227' title='bbox 811 1576 890 1603; x_wconf 87'>while</span> <span class='ocrx_word' id='word_1_228' title='bbox 900 1576 1052 1610; x_wconf 87'>recording!</span>
|
||||
</span>
|
||||
</p>
|
||||
|
||||
<p class='ocr_par' id='par_1_18' lang='eng' title="bbox 346 1616 1205 1965">
|
||||
<span class='ocr_line' id='line_1_27' title="bbox 384 1616 1199 1648; baseline 0.001 -6; x_size 32; x_descenders 5; x_ascenders 8"><span class='ocrx_word' id='word_1_229' title='bbox 384 1616 471 1642; x_wconf 88'>FAST</span> <span class='ocrx_word' id='word_1_230' title='bbox 481 1616 671 1648; x_wconf 88'>FORWARD,</span> <span class='ocrx_word' id='word_1_231' title='bbox 684 1617 844 1648; x_wconf 87'>REWIND,</span> <span class='ocrx_word' id='word_1_232' title='bbox 857 1616 912 1643; x_wconf 89'>and</span> <span class='ocrx_word' id='word_1_233' title='bbox 924 1616 1068 1643; x_wconf 78'>LOCATE</span> <span class='ocrx_word' id='word_1_234' title='bbox 1079 1616 1199 1643; x_wconf 87'>controls</span>
|
||||
</span>
|
||||
<span class='ocr_line' id='line_1_28' title="bbox 346 1655 1202 1689; baseline 0 -7; x_size 34; x_descenders 6; x_ascenders 9"><span class='ocrx_word' id='word_1_235' title='bbox 346 1663 409 1688; x_wconf 89'>may</span> <span class='ocrx_word' id='word_1_236' title='bbox 419 1655 453 1682; x_wconf 94'>be</span> <span class='ocrx_word' id='word_1_237' title='bbox 463 1655 530 1682; x_wconf 90'>used</span> <span class='ocrx_word' id='word_1_238' title='bbox 541 1659 569 1682; x_wconf 90'>at</span> <span class='ocrx_word' id='word_1_239' title='bbox 580 1663 632 1688; x_wconf 86'>any</span> <span class='ocrx_word' id='word_1_240' title='bbox 642 1655 707 1683; x_wconf 88'>time</span> <span class='ocrx_word' id='word_1_241' title='bbox 717 1659 746 1683; x_wconf 88'>to</span> <span class='ocrx_word' id='word_1_242' title='bbox 757 1655 867 1689; x_wconf 88'>quickly</span> <span class='ocrx_word' id='word_1_243' title='bbox 878 1664 968 1683; x_wconf 87'>access</span> <span class='ocrx_word' id='word_1_244' title='bbox 979 1664 1032 1689; x_wconf 87'>any</span> <span class='ocrx_word' id='word_1_245' title='bbox 1042 1655 1164 1683; x_wconf 90'>location</span> <span class='ocrx_word' id='word_1_246' title='bbox 1174 1655 1202 1682; x_wconf 94'>in</span>
|
||||
</span>
|
||||
<span class='ocr_line' id='line_1_29' title="bbox 346 1694 1204 1728; baseline 0.001 -7; x_size 33; x_descenders 6; x_ascenders 8"><span class='ocrx_word' id='word_1_247' title='bbox 346 1702 414 1727; x_wconf 88'>your</span> <span class='ocrx_word' id='word_1_248' title='bbox 424 1702 558 1727; x_wconf 87'>sequence</span> <span class='ocrx_word' id='word_1_249' title='bbox 570 1694 612 1721; x_wconf 84'>for</span> <span class='ocrx_word' id='word_1_250' title='bbox 623 1695 847 1728; x_wconf 84'>spot—recording.</span> <span class='ocrx_word' id='word_1_251' title='bbox 860 1696 897 1722; x_wconf 89'>To</span> <span class='ocrx_word' id='word_1_252' title='bbox 908 1695 1028 1722; x_wconf 82'>overdub</span> <span class='ocrx_word' id='word_1_253' title='bbox 1039 1703 1056 1722; x_wconf 91'>a</span> <span class='ocrx_word' id='word_1_254' title='bbox 1066 1703 1125 1722; x_wconf 89'>new</span> <span class='ocrx_word' id='word_1_255' title='bbox 1135 1699 1204 1728; x_wconf 88'>part,</span>
|
||||
</span>
|
||||
<span class='ocr_line' id='line_1_30' title="bbox 347 1733 1150 1768; baseline 0.001 -8; x_size 35; x_descenders 7; x_ascenders 9"><span class='ocrx_word' id='word_1_256' title='bbox 347 1733 426 1761; x_wconf 88'>select</span> <span class='ocrx_word' id='word_1_257' title='bbox 437 1741 453 1761; x_wconf 88'>a</span> <span class='ocrx_word' id='word_1_258' title='bbox 463 1733 589 1761; x_wconf 86'>different</span> <span class='ocrx_word' id='word_1_259' title='bbox 599 1734 674 1761; x_wconf 85'>track</span> <span class='ocrx_word' id='word_1_260' title='bbox 685 1734 741 1761; x_wconf 87'>and</span> <span class='ocrx_word' id='word_1_261' title='bbox 752 1738 818 1761; x_wconf 83'>start</span> <span class='ocrx_word' id='word_1_262' title='bbox 828 1734 1086 1768; x_wconf 63'>recording~while</span> <span class='ocrx_word' id='word_1_263' title='bbox 1096 1742 1150 1767; x_wconf 89'>you</span>
|
||||
</span>
|
||||
<span class='ocr_line' id='line_1_31' title="bbox 346 1773 1203 1808; baseline 0.001 -8; x_size 33; x_descenders 6; x_ascenders 8"><span class='ocrx_word' id='word_1_264' title='bbox 346 1774 448 1806; x_wconf 86'>record,</span> <span class='ocrx_word' id='word_1_265' title='bbox 460 1774 506 1801; x_wconf 87'>the</span> <span class='ocrx_word' id='word_1_266' title='bbox 517 1773 662 1801; x_wconf 64'>first‘track</span> <span class='ocrx_word' id='word_1_267' title='bbox 673 1774 726 1801; x_wconf 91'>will</span> <span class='ocrx_word' id='word_1_268' title='bbox 736 1774 799 1807; x_wconf 89'>play</span> <span class='ocrx_word' id='word_1_269' title='bbox 809 1774 836 1801; x_wconf 91'>in</span> <span class='ocrx_word' id='word_1_270' title='bbox 847 1774 949 1808; x_wconf 84'>perfect</span> <span class='ocrx_word' id='word_1_271' title='bbox 961 1782 1026 1808; x_wconf 87'>sync</span> <span class='ocrx_word' id='word_1_272' title='bbox 1037 1774 1137 1808; x_wconf 89'>(unless</span> <span class='ocrx_word' id='word_1_273' title='bbox 1148 1782 1203 1807; x_wconf 93'>you</span>
|
||||
</span>
|
||||
<span class='ocr_line' id='line_1_32' title="bbox 346 1813 1191 1847; baseline 0.002 -8; x_size 33; x_descenders 5; x_ascenders 9"><span class='ocrx_word' id='word_1_274' title='bbox 346 1813 454 1840; x_wconf 86'>MUTE</span> <span class='ocrx_word' id='word_1_275' title='bbox 464 1813 492 1845; x_wconf 88'>it,</span> <span class='ocrx_word' id='word_1_276' title='bbox 505 1821 537 1840; x_wconf 84'>or</span> <span class='ocrx_word' id='word_1_277' title='bbox 547 1813 642 1840; x_wconf 88'>SOLO</span> <span class='ocrx_word' id='word_1_278' title='bbox 653 1814 769 1841; x_wconf 87'>another</span> <span class='ocrx_word' id='word_1_279' title='bbox 779 1814 875 1847; x_wconf 86'>track).</span> <span class='ocrx_word' id='word_1_280' title='bbox 889 1814 920 1840; x_wconf 86'>In</span> <span class='ocrx_word' id='word_1_281' title='bbox 930 1813 984 1841; x_wconf 86'>this</span> <span class='ocrx_word' id='word_1_282' title='bbox 995 1822 1057 1847; x_wconf 87'>way,</span> <span class='ocrx_word' id='word_1_283' title='bbox 1069 1822 1106 1847; x_wconf 88'>up</span> <span class='ocrx_word' id='word_1_284' title='bbox 1117 1818 1146 1841; x_wconf 77'>to</span> <span class='ocrx_word' id='word_1_285' title='bbox 1158 1814 1191 1841; x_wconf 90'>32</span>
|
||||
</span>
|
||||
<span class='ocr_line' id='line_1_33' title="bbox 346 1852 1205 1885; baseline 0.001 -6; x_size 33; x_descenders 6; x_ascenders 8"><span class='ocrx_word' id='word_1_286' title='bbox 346 1852 434 1879; x_wconf 84'>tracks</span> <span class='ocrx_word' id='word_1_287' title='bbox 445 1860 508 1885; x_wconf 90'>may</span> <span class='ocrx_word' id='word_1_288' title='bbox 518 1853 552 1879; x_wconf 93'>be</span> <span class='ocrx_word' id='word_1_289' title='bbox 562 1853 748 1880; x_wconf 90'>overdubbed!</span> <span class='ocrx_word' id='word_1_290' title='bbox 761 1853 808 1880; x_wconf 92'>All</span> <span class='ocrx_word' id='word_1_291' title='bbox 819 1854 905 1880; x_wconf 81'>MIDI</span> <span class='ocrx_word' id='word_1_292' title='bbox 917 1853 1011 1880; x_wconf 81'>effects</span> <span class='ocrx_word' id='word_1_293' title='bbox 1022 1861 1067 1880; x_wconf 86'>are</span> <span class='ocrx_word' id='word_1_294' title='bbox 1076 1853 1205 1880; x_wconf 87'>recorded</span>
|
||||
</span>
|
||||
<span class='ocr_line' id='line_1_34' title="bbox 346 1891 1168 1926; baseline 0.002 -8; x_size 34; x_descenders 7; x_ascenders 8"><span class='ocrx_word' id='word_1_295' title='bbox 346 1891 485 1925; x_wconf 84'>including</span> <span class='ocrx_word' id='word_1_296' title='bbox 495 1891 570 1925; x_wconf 87'>pitch</span> <span class='ocrx_word' id='word_1_297' title='bbox 580 1892 663 1924; x_wconf 84'>bend,</span> <span class='ocrx_word' id='word_1_298' title='bbox 675 1892 859 1924; x_wconf 86'>modulation,</span> <span class='ocrx_word' id='word_1_299' title='bbox 872 1892 991 1926; x_wconf 83'>velocity,</span> <span class='ocrx_word' id='word_1_300' title='bbox 1004 1892 1168 1924; x_wconf 85'>aftertouch,</span>
|
||||
</span>
|
||||
<span class='ocr_line' id='line_1_35' title="bbox 346 1931 895 1965; baseline 0.002 -7; x_size 33; x_descenders 6; x_ascenders 8"><span class='ocrx_word' id='word_1_301' title='bbox 346 1931 448 1958; x_wconf 88'>sustain</span> <span class='ocrx_word' id='word_1_302' title='bbox 459 1931 549 1965; x_wconf 88'>pedal,</span> <span class='ocrx_word' id='word_1_303' title='bbox 561 1932 617 1959; x_wconf 90'>and</span> <span class='ocrx_word' id='word_1_304' title='bbox 628 1940 756 1965; x_wconf 88'>program</span> <span class='ocrx_word' id='word_1_305' title='bbox 766 1932 895 1965; x_wconf 87'>changes!</span>
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
<div class='ocr_carea' id='block_1_15' title="bbox 346 1998 1212 2163">
|
||||
<p class='ocr_par' id='par_1_19' lang='eng' title="bbox 346 1998 479 2040">
|
||||
<span class='ocr_line' id='line_1_36' title="bbox 346 1998 479 2040; baseline -0.008 -9; x_size 43; x_descenders 10; x_ascenders 11"><span class='ocrx_word' id='word_1_306' title='bbox 346 1998 479 2040; x_wconf 87'>Editing</span>
|
||||
</span>
|
||||
</p>
|
||||
|
||||
<p class='ocr_par' id='par_1_20' lang='eng' title="bbox 346 2050 1212 2163">
|
||||
<span class='ocr_line' id='line_1_37' title="bbox 383 2050 1186 2084; baseline 0.001 -8; x_size 34; x_descenders 7; x_ascenders 8"><span class='ocrx_word' id='word_1_307' title='bbox 383 2050 419 2076; x_wconf 89'>To</span> <span class='ocrx_word' id='word_1_308' title='bbox 430 2057 503 2076; x_wconf 87'>erase</span> <span class='ocrx_word' id='word_1_309' title='bbox 514 2058 530 2077; x_wconf 91'>a</span> <span class='ocrx_word' id='word_1_310' title='bbox 540 2058 634 2083; x_wconf 88'>wrong</span> <span class='ocrx_word' id='word_1_311' title='bbox 644 2054 717 2082; x_wconf 84'>note,</span> <span class='ocrx_word' id='word_1_312' title='bbox 729 2050 829 2083; x_wconf 89'>simply</span> <span class='ocrx_word' id='word_1_313' title='bbox 839 2050 905 2077; x_wconf 88'>hold</span> <span class='ocrx_word' id='word_1_314' title='bbox 916 2051 1037 2077; x_wconf 85'>ERASE</span> <span class='ocrx_word' id='word_1_315' title='bbox 1048 2050 1103 2077; x_wconf 89'>and</span> <span class='ocrx_word' id='word_1_316' title='bbox 1113 2059 1186 2084; x_wconf 89'>press</span>
|
||||
</span>
|
||||
<span class='ocr_line' id='line_1_38' title="bbox 346 2089 1212 2124; baseline 0.002 -8; x_size 33; x_descenders 6; x_ascenders 8"><span class='ocrx_word' id='word_1_317' title='bbox 346 2089 391 2116; x_wconf 86'>the</span> <span class='ocrx_word' id='word_1_318' title='bbox 402 2094 465 2117; x_wconf 86'>note</span> <span class='ocrx_word' id='word_1_319' title='bbox 475 2094 504 2117; x_wconf 86'>to</span> <span class='ocrx_word' id='word_1_320' title='bbox 515 2090 549 2117; x_wconf 93'>be</span> <span class='ocrx_word' id='word_1_321' title='bbox 559 2090 652 2117; x_wconf 89'>erased</span> <span class='ocrx_word' id='word_1_322' title='bbox 661 2090 718 2123; x_wconf 91'>just</span> <span class='ocrx_word' id='word_1_323' title='bbox 729 2090 822 2117; x_wconf 85'>before</span> <span class='ocrx_word' id='word_1_324' title='bbox 833 2090 852 2117; x_wconf 89'>it</span> <span class='ocrx_word' id='word_1_325' title='bbox 862 2090 937 2124; x_wconf 87'>plays</span> <span class='ocrx_word' id='word_1_326' title='bbox 947 2090 975 2117; x_wconf 92'>in</span> <span class='ocrx_word' id='word_1_327' title='bbox 986 2090 1032 2118; x_wconf 87'>the</span> <span class='ocrx_word' id='word_1_328' title='bbox 1043 2098 1212 2124; x_wconf 78'>sequence—</span>
|
||||
</span>
|
||||
<span class='ocr_line' id='line_1_39' title="bbox 346 2129 1134 2163; baseline 0.003 -8; x_size 34; x_descenders 7; x_ascenders 8"><span class='ocrx_word' id='word_1_329' title='bbox 346 2129 425 2156; x_wconf 92'>when</span> <span class='ocrx_word' id='word_1_330' title='bbox 435 2129 531 2162; x_wconf 91'>played</span> <span class='ocrx_word' id='word_1_331' title='bbox 542 2129 621 2161; x_wconf 82'>back,</span> <span class='ocrx_word' id='word_1_332' title='bbox 633 2129 652 2156; x_wconf 84'>it</span> <span class='ocrx_word' id='word_1_333' title='bbox 663 2129 716 2156; x_wconf 89'>will</span> <span class='ocrx_word' id='word_1_334' title='bbox 726 2130 760 2157; x_wconf 88'>be</span> <span class='ocrx_word' id='word_1_335' title='bbox 771 2138 849 2163; x_wconf 86'>gone.</span> <span class='ocrx_word' id='word_1_336' title='bbox 861 2131 947 2157; x_wconf 86'>Notes</span> <span class='ocrx_word' id='word_1_337' title='bbox 958 2138 1021 2163; x_wconf 88'>may</span> <span class='ocrx_word' id='word_1_338' title='bbox 1031 2130 1089 2157; x_wconf 87'>also</span> <span class='ocrx_word' id='word_1_339' title='bbox 1100 2130 1134 2157; x_wconf 91'>be</span>
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
<div class='ocr_carea' id='block_1_16' title="bbox 345 2168 1228 2242">
|
||||
<p class='ocr_par' id='par_1_21' lang='eng' title="bbox 345 2168 1228 2242">
|
||||
<span class='ocr_line' id='line_1_40' title="bbox 346 2168 1220 2203; baseline 0.001 -8; x_size 34; x_descenders 7; x_ascenders 8"><span class='ocrx_word' id='word_1_340' title='bbox 346 2168 445 2200; x_wconf 86'>added,</span> <span class='ocrx_word' id='word_1_341' title='bbox 457 2168 560 2200; x_wconf 87'>erased,</span> <span class='ocrx_word' id='word_1_342' title='bbox 572 2177 604 2196; x_wconf 93'>or</span> <span class='ocrx_word' id='word_1_343' title='bbox 614 2169 739 2202; x_wconf 82'>changed</span> <span class='ocrx_word' id='word_1_344' title='bbox 749 2169 829 2203; x_wconf 86'>using</span> <span class='ocrx_word' id='word_1_345' title='bbox 839 2169 885 2196; x_wconf 85'>the</span> <span class='ocrx_word' id='word_1_346' title='bbox 896 2170 1031 2196; x_wconf 89'>SINGLE</span> <span class='ocrx_word' id='word_1_347' title='bbox 1042 2170 1131 2196; x_wconf 87'>STEP</span> <span class='ocrx_word' id='word_1_348' title='bbox 1143 2169 1220 2196; x_wconf 82'>func-</span>
|
||||
</span>
|
||||
<span class='ocr_line' id='line_1_41' title="bbox 345 2207 1228 2242; baseline 0.002 -8; x_size 35; x_descenders 7; x_ascenders 9"><span class='ocrx_word' id='word_1_349' title='bbox 345 2207 412 2234; x_wconf 87'>tion.</span> <span class='ocrx_word' id='word_1_350' title='bbox 424 2208 461 2235; x_wconf 88'>To</span> <span class='ocrx_word' id='word_1_351' title='bbox 472 2208 592 2235; x_wconf 88'>overdub</span> <span class='ocrx_word' id='word_1_352' title='bbox 603 2212 680 2235; x_wconf 84'>notes</span> <span class='ocrx_word' id='word_1_353' title='bbox 691 2212 718 2235; x_wconf 89'>at</span> <span class='ocrx_word' id='word_1_354' title='bbox 729 2208 841 2242; x_wconf 83'>specific</span> <span class='ocrx_word' id='word_1_355' title='bbox 851 2209 943 2242; x_wconf 89'>points</span> <span class='ocrx_word' id='word_1_356' title='bbox 955 2208 1049 2236; x_wconf 87'>within</span> <span class='ocrx_word' id='word_1_357' title='bbox 1060 2217 1076 2236; x_wconf 87'>a</span> <span class='ocrx_word' id='word_1_358' title='bbox 1086 2216 1228 2242; x_wconf 86'>sequence,</span>
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
<div class='ocr_carea' id='block_1_17' title="bbox 345 2293 705 2326">
|
||||
<p class='ocr_par' id='par_1_22' lang='eng' title="bbox 345 2293 705 2326">
|
||||
<span class='ocr_line' id='line_1_42' title="bbox 345 2293 705 2326; baseline 0.003 -1; x_size 38.38298; x_descenders 5.3829789; x_ascenders 10"><span class='ocrx_word' id='word_1_359' title='bbox 345 2293 541 2326; x_wconf 86'>Additional</span> <span class='ocrx_word' id='word_1_360' title='bbox 553 2293 705 2326; x_wconf 83'>Features</span>
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
<div class='ocr_carea' id='block_1_18' title="bbox 1295 1289 2165 1593">
|
||||
<p class='ocr_par' id='par_1_23' lang='eng' title="bbox 1296 1289 2165 1362">
|
||||
<span class='ocr_line' id='line_1_43' title="bbox 1296 1289 2165 1322; baseline 0.001 -7; x_size 35.040108; x_descenders 6.9264708; x_ascenders 8.613636"><span class='ocrx_word' id='word_1_361' title='bbox 1296 1289 1394 1322; x_wconf 91'>simply</span> <span class='ocrx_word' id='word_1_362' title='bbox 1404 1297 1452 1316; x_wconf 87'>use</span> <span class='ocrx_word' id='word_1_363' title='bbox 1463 1290 1615 1321; x_wconf 86'>LOCATE,</span> <span class='ocrx_word' id='word_1_364' title='bbox 1628 1290 1716 1316; x_wconf 88'>FAST</span> <span class='ocrx_word' id='word_1_365' title='bbox 1726 1289 1917 1321; x_wconf 86'>FORWARD,</span> <span class='ocrx_word' id='word_1_366' title='bbox 1929 1297 1960 1317; x_wconf 92'>or</span> <span class='ocrx_word' id='word_1_367' title='bbox 1972 1290 2126 1316; x_wconf 91'>REWIND</span> <span class='ocrx_word' id='word_1_368' title='bbox 2136 1294 2165 1317; x_wconf 82'>to</span>
|
||||
</span>
|
||||
<span class='ocr_line' id='line_1_44' title="bbox 1297 1328 2033 1362; baseline 0.001 -7; x_size 32; x_descenders 5; x_ascenders 8"><span class='ocrx_word' id='word_1_369' title='bbox 1297 1328 1356 1355; x_wconf 77'>find</span> <span class='ocrx_word' id='word_1_370' title='bbox 1366 1329 1412 1355; x_wconf 89'>the</span> <span class='ocrx_word' id='word_1_371' title='bbox 1423 1328 1527 1356; x_wconf 85'>desired</span> <span class='ocrx_word' id='word_1_372' title='bbox 1537 1329 1587 1356; x_wconf 88'>bar</span> <span class='ocrx_word' id='word_1_373' title='bbox 1598 1329 1720 1361; x_wconf 86'>number,</span> <span class='ocrx_word' id='word_1_374' title='bbox 1732 1329 1798 1356; x_wconf 78'>then</span> <span class='ocrx_word' id='word_1_375' title='bbox 1809 1333 1874 1356; x_wconf 87'>start</span> <span class='ocrx_word' id='word_1_376' title='bbox 1885 1329 2033 1362; x_wconf 85'>recording.</span>
|
||||
</span>
|
||||
</p>
|
||||
|
||||
<p class='ocr_par' id='par_1_24' lang='eng' title="bbox 1295 1368 2160 1593">
|
||||
<span class='ocr_line' id='line_1_45' title="bbox 1332 1368 2160 1402; baseline 0.002 -8; x_size 34; x_descenders 7; x_ascenders 8"><span class='ocrx_word' id='word_1_377' title='bbox 1332 1368 1391 1395; x_wconf 90'>The</span> <span class='ocrx_word' id='word_1_378' title='bbox 1402 1368 1650 1395; x_wconf 86'>INSERT/COPY</span> <span class='ocrx_word' id='word_1_379' title='bbox 1662 1368 1789 1395; x_wconf 81'>function</span> <span class='ocrx_word' id='word_1_380' title='bbox 1800 1368 1893 1395; x_wconf 90'>allows</span> <span class='ocrx_word' id='word_1_381' title='bbox 1904 1376 1958 1402; x_wconf 91'>you</span> <span class='ocrx_word' id='word_1_382' title='bbox 1968 1373 1997 1395; x_wconf 91'>to</span> <span class='ocrx_word' id='word_1_383' title='bbox 2008 1377 2087 1396; x_wconf 91'>move</span> <span class='ocrx_word' id='word_1_384' title='bbox 2097 1369 2160 1396; x_wconf 89'>bars</span>
|
||||
</span>
|
||||
<span class='ocr_line' id='line_1_46' title="bbox 1297 1407 2151 1441; baseline 0.002 -8; x_size 33; x_descenders 6; x_ascenders 8"><span class='ocrx_word' id='word_1_385' title='bbox 1297 1407 1369 1434; x_wconf 86'>from</span> <span class='ocrx_word' id='word_1_386' title='bbox 1380 1415 1433 1434; x_wconf 88'>one</span> <span class='ocrx_word' id='word_1_387' title='bbox 1443 1407 1565 1435; x_wconf 85'>location</span> <span class='ocrx_word' id='word_1_388' title='bbox 1576 1411 1605 1434; x_wconf 89'>to</span> <span class='ocrx_word' id='word_1_389' title='bbox 1616 1407 1796 1435; x_wconf 85'>another—in</span> <span class='ocrx_word' id='word_1_390' title='bbox 1806 1408 1852 1435; x_wconf 88'>the</span> <span class='ocrx_word' id='word_1_391' title='bbox 1863 1416 1937 1435; x_wconf 90'>same</span> <span class='ocrx_word' id='word_1_392' title='bbox 1948 1416 2083 1441; x_wconf 88'>sequence</span> <span class='ocrx_word' id='word_1_393' title='bbox 2093 1416 2125 1435; x_wconf 90'>or</span> <span class='ocrx_word' id='word_1_394' title='bbox 2135 1416 2151 1435; x_wconf 88'>a</span>
|
||||
</span>
|
||||
<span class='ocr_line' id='line_1_47' title="bbox 1296 1447 2160 1481; baseline 0.001 -7; x_size 34; x_descenders 7; x_ascenders 8"><span class='ocrx_word' id='word_1_395' title='bbox 1296 1447 1421 1474; x_wconf 81'>different</span> <span class='ocrx_word' id='word_1_396' title='bbox 1431 1455 1491 1474; x_wconf 89'>one.</span> <span class='ocrx_word' id='word_1_397' title='bbox 1504 1448 1555 1474; x_wconf 87'>For</span> <span class='ocrx_word' id='word_1_398' title='bbox 1565 1448 1698 1481; x_wconf 84'>example,</span> <span class='ocrx_word' id='word_1_399' title='bbox 1710 1456 1764 1481; x_wconf 91'>you</span> <span class='ocrx_word' id='word_1_400' title='bbox 1775 1448 1863 1481; x_wconf 84'>might</span> <span class='ocrx_word' id='word_1_401' title='bbox 1873 1448 1955 1475; x_wconf 86'>insert</span> <span class='ocrx_word' id='word_1_402' title='bbox 1966 1456 1983 1475; x_wconf 92'>a</span> <span class='ocrx_word' id='word_1_403' title='bbox 1993 1456 2064 1481; x_wconf 88'>copy</span> <span class='ocrx_word' id='word_1_404' title='bbox 2074 1448 2106 1475; x_wconf 90'>of</span> <span class='ocrx_word' id='word_1_405' title='bbox 2115 1448 2160 1475; x_wconf 90'>the</span>
|
||||
</span>
|
||||
<span class='ocr_line' id='line_1_48' title="bbox 1297 1486 2087 1521; baseline 0 -7; x_size 35; x_descenders 7; x_ascenders 9"><span class='ocrx_word' id='word_1_406' title='bbox 1297 1486 1355 1514; x_wconf 82'>first</span> <span class='ocrx_word' id='word_1_407' title='bbox 1366 1495 1439 1514; x_wconf 89'>verse</span> <span class='ocrx_word' id='word_1_408' title='bbox 1449 1487 1571 1514; x_wconf 89'>between</span> <span class='ocrx_word' id='word_1_409' title='bbox 1582 1487 1628 1514; x_wconf 88'>the</span> <span class='ocrx_word' id='word_1_410' title='bbox 1638 1487 1740 1514; x_wconf 87'>second</span> <span class='ocrx_word' id='word_1_411' title='bbox 1751 1487 1852 1514; x_wconf 83'>chorus</span> <span class='ocrx_word' id='word_1_412' title='bbox 1863 1487 1919 1514; x_wconf 90'>and</span> <span class='ocrx_word' id='word_1_413' title='bbox 1929 1487 1975 1514; x_wconf 88'>the</span> <span class='ocrx_word' id='word_1_414' title='bbox 1985 1487 2087 1521; x_wconf 85'>bridge.</span>
|
||||
</span>
|
||||
<span class='ocr_line' id='line_1_49' title="bbox 1296 1527 2047 1560; baseline 0.003 -8; x_size 32; x_descenders 6; x_ascenders 7"><span class='ocrx_word' id='word_1_415' title='bbox 1296 1527 1441 1553; x_wconf 88'>DELETE</span> <span class='ocrx_word' id='word_1_416' title='bbox 1453 1527 1546 1553; x_wconf 90'>BARS</span> <span class='ocrx_word' id='word_1_417' title='bbox 1557 1531 1681 1559; x_wconf 84'>operates</span> <span class='ocrx_word' id='word_1_418' title='bbox 1691 1527 1737 1553; x_wconf 86'>the</span> <span class='ocrx_word' id='word_1_419' title='bbox 1748 1535 1823 1554; x_wconf 90'>same</span> <span class='ocrx_word' id='word_1_420' title='bbox 1833 1535 1891 1560; x_wconf 93'>way</span> <span class='ocrx_word' id='word_1_421' title='bbox 1901 1531 1930 1554; x_wconf 91'>to</span> <span class='ocrx_word' id='word_1_422' title='bbox 1940 1535 2047 1554; x_wconf 90'>remove</span>
|
||||
</span>
|
||||
<span class='ocr_line' id='line_1_50' title="bbox 1295 1565 1577 1593; baseline 0.004 -1; x_size 34.748871; x_descenders 6.7488689; x_ascenders 9"><span class='ocrx_word' id='word_1_423' title='bbox 1295 1565 1441 1592; x_wconf 88'>unwanted</span> <span class='ocrx_word' id='word_1_424' title='bbox 1452 1565 1577 1593; x_wconf 84'>sections.</span>
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
<div class='ocr_carea' id='block_1_19' title="bbox 1295 1638 2215 1960">
|
||||
<p class='ocr_par' id='par_1_25' lang='eng' title="bbox 1296 1638 1589 1680">
|
||||
<span class='ocr_line' id='line_1_51' title="bbox 1296 1638 1589 1680; baseline 0 -9; x_size 42; x_descenders 9; x_ascenders 10"><span class='ocrx_word' id='word_1_425' title='bbox 1296 1638 1452 1680; x_wconf 86'>Creating</span> <span class='ocrx_word' id='word_1_426' title='bbox 1465 1648 1485 1671; x_wconf 85'>a</span> <span class='ocrx_word' id='word_1_427' title='bbox 1497 1639 1589 1680; x_wconf 87'>Song</span>
|
||||
</span>
|
||||
</p>
|
||||
|
||||
<p class='ocr_par' id='par_1_26' lang='eng' title="bbox 1295 1690 2215 1960">
|
||||
<span class='ocr_line' id='line_1_52' title="bbox 1333 1690 2146 1723; baseline 0 -6; x_size 33; x_descenders 6; x_ascenders 8"><span class='ocrx_word' id='word_1_428' title='bbox 1333 1690 1394 1717; x_wconf 88'>One</span> <span class='ocrx_word' id='word_1_429' title='bbox 1404 1698 1462 1723; x_wconf 93'>way</span> <span class='ocrx_word' id='word_1_430' title='bbox 1472 1694 1500 1717; x_wconf 89'>to</span> <span class='ocrx_word' id='word_1_431' title='bbox 1511 1694 1598 1717; x_wconf 88'>create</span> <span class='ocrx_word' id='word_1_432' title='bbox 1608 1698 1625 1717; x_wconf 88'>a</span> <span class='ocrx_word' id='word_1_433' title='bbox 1635 1698 1704 1723; x_wconf 83'>song</span> <span class='ocrx_word' id='word_1_434' title='bbox 1715 1690 1736 1717; x_wconf 90'>is</span> <span class='ocrx_word' id='word_1_435' title='bbox 1747 1694 1776 1717; x_wconf 89'>to</span> <span class='ocrx_word' id='word_1_436' title='bbox 1787 1690 1880 1717; x_wconf 86'>record</span> <span class='ocrx_word' id='word_1_437' title='bbox 1891 1690 1958 1717; x_wconf 89'>each</span> <span class='ocrx_word' id='word_1_438' title='bbox 1969 1690 2044 1717; x_wconf 87'>track</span> <span class='ocrx_word' id='word_1_439' title='bbox 2056 1690 2090 1717; x_wconf 89'>all</span> <span class='ocrx_word' id='word_1_440' title='bbox 2101 1690 2146 1717; x_wconf 88'>the</span>
|
||||
</span>
|
||||
<span class='ocr_line' id='line_1_53' title="bbox 1295 1729 2121 1762; baseline 0.001 -6; x_size 33; x_descenders 6; x_ascenders 8"><span class='ocrx_word' id='word_1_441' title='bbox 1295 1737 1353 1762; x_wconf 87'>way</span> <span class='ocrx_word' id='word_1_442' title='bbox 1362 1729 1481 1762; x_wconf 83'>through</span> <span class='ocrx_word' id='word_1_443' title='bbox 1493 1729 1541 1762; x_wconf 90'>(up</span> <span class='ocrx_word' id='word_1_444' title='bbox 1552 1733 1581 1756; x_wconf 89'>to</span> <span class='ocrx_word' id='word_1_445' title='bbox 1592 1730 1644 1756; x_wconf 89'>999</span> <span class='ocrx_word' id='word_1_446' title='bbox 1654 1729 1738 1762; x_wconf 90'>bars).</span> <span class='ocrx_word' id='word_1_447' title='bbox 1751 1729 1878 1757; x_wconf 89'>Another</span> <span class='ocrx_word' id='word_1_448' title='bbox 1888 1737 1945 1762; x_wconf 89'>way</span> <span class='ocrx_word' id='word_1_449' title='bbox 1956 1729 1977 1757; x_wconf 90'>is</span> <span class='ocrx_word' id='word_1_450' title='bbox 1987 1733 2016 1757; x_wconf 89'>to</span> <span class='ocrx_word' id='word_1_451' title='bbox 2027 1729 2121 1757; x_wconf 86'>record</span>
|
||||
</span>
|
||||
<span class='ocr_line' id='line_1_54' title="bbox 1296 1768 2066 1802; baseline 0 -6; x_size 33; x_descenders 5; x_ascenders 9"><span class='ocrx_word' id='word_1_452' title='bbox 1296 1768 1362 1796; x_wconf 86'>each</span> <span class='ocrx_word' id='word_1_453' title='bbox 1373 1768 1448 1796; x_wconf 87'>basic</span> <span class='ocrx_word' id='word_1_454' title='bbox 1458 1768 1562 1796; x_wconf 83'>section</span> <span class='ocrx_word' id='word_1_455' title='bbox 1574 1769 1666 1802; x_wconf 89'>(verse,</span> <span class='ocrx_word' id='word_1_456' title='bbox 1679 1769 1788 1801; x_wconf 86'>chorus,</span> <span class='ocrx_word' id='word_1_457' title='bbox 1800 1769 1865 1802; x_wconf 83'>etc.)</span> <span class='ocrx_word' id='word_1_458' title='bbox 1876 1768 1904 1795; x_wconf 91'>in</span> <span class='ocrx_word' id='word_1_459' title='bbox 1914 1768 2066 1796; x_wconf 86'>individual</span>
|
||||
</span>
|
||||
<span class='ocr_line' id='line_1_55' title="bbox 1296 1808 2215 1841; baseline 0 -6; x_size 32; x_descenders 5; x_ascenders 8"><span class='ocrx_word' id='word_1_460' title='bbox 1296 1816 1451 1841; x_wconf 85'>sequences,</span> <span class='ocrx_word' id='word_1_461' title='bbox 1463 1808 1528 1835; x_wconf 86'>then</span> <span class='ocrx_word' id='word_1_462' title='bbox 1538 1816 1587 1835; x_wconf 90'>use</span> <span class='ocrx_word' id='word_1_463' title='bbox 1597 1808 1643 1835; x_wconf 89'>the</span> <span class='ocrx_word' id='word_1_464' title='bbox 1653 1809 1799 1835; x_wconf 89'>CREATE</span> <span class='ocrx_word' id='word_1_465' title='bbox 1810 1808 1911 1835; x_wconf 89'>SONG</span> <span class='ocrx_word' id='word_1_466' title='bbox 1923 1808 2050 1836; x_wconf 85'>function</span> <span class='ocrx_word' id='word_1_467' title='bbox 2060 1812 2089 1835; x_wconf 89'>to</span> <span class='ocrx_word' id='word_1_468' title='bbox 2103 1808 2215 1836; x_wconf 87'>“chain”</span>
|
||||
</span>
|
||||
<span class='ocr_line' id='line_1_56' title="bbox 1295 1847 2135 1881; baseline 0.001 -7; x_size 34; x_descenders 7; x_ascenders 8"><span class='ocrx_word' id='word_1_469' title='bbox 1295 1848 1370 1874; x_wconf 91'>them</span> <span class='ocrx_word' id='word_1_470' title='bbox 1381 1848 1508 1881; x_wconf 83'>together.</span> <span class='ocrx_word' id='word_1_471' title='bbox 1521 1848 1667 1875; x_wconf 87'>CREATE</span> <span class='ocrx_word' id='word_1_472' title='bbox 1678 1848 1779 1875; x_wconf 91'>SONG</span> <span class='ocrx_word' id='word_1_473' title='bbox 1789 1847 1842 1874; x_wconf 92'>will</span> <span class='ocrx_word' id='word_1_474' title='bbox 1853 1848 1918 1875; x_wconf 86'>then</span> <span class='ocrx_word' id='word_1_475' title='bbox 1929 1848 2135 1881; x_wconf 81'>automatically</span>
|
||||
</span>
|
||||
<span class='ocr_line' id='line_1_57' title="bbox 1296 1887 2162 1920; baseline 0 -6; x_size 33; x_descenders 6; x_ascenders 8"><span class='ocrx_word' id='word_1_476' title='bbox 1296 1895 1366 1920; x_wconf 89'>copy</span> <span class='ocrx_word' id='word_1_477' title='bbox 1377 1887 1412 1914; x_wconf 88'>all</span> <span class='ocrx_word' id='word_1_478' title='bbox 1422 1887 1468 1914; x_wconf 85'>the</span> <span class='ocrx_word' id='word_1_479' title='bbox 1478 1891 1552 1920; x_wconf 86'>parts</span> <span class='ocrx_word' id='word_1_480' title='bbox 1563 1887 1621 1914; x_wconf 86'>into</span> <span class='ocrx_word' id='word_1_481' title='bbox 1632 1895 1649 1914; x_wconf 91'>a</span> <span class='ocrx_word' id='word_1_482' title='bbox 1659 1895 1718 1914; x_wconf 91'>new</span> <span class='ocrx_word' id='word_1_483' title='bbox 1729 1895 1870 1920; x_wconf 83'>sequence.</span> <span class='ocrx_word' id='word_1_484' title='bbox 1884 1887 1911 1914; x_wconf 84'>If</span> <span class='ocrx_word' id='word_1_485' title='bbox 1919 1887 2033 1919; x_wconf 89'>desired,</span> <span class='ocrx_word' id='word_1_486' title='bbox 2045 1895 2099 1920; x_wconf 92'>you</span> <span class='ocrx_word' id='word_1_487' title='bbox 2110 1895 2162 1914; x_wconf 85'>can</span>
|
||||
</span>
|
||||
<span class='ocr_line' id='line_1_58' title="bbox 1296 1926 2169 1960; baseline 0.001 -7; x_size 34; x_descenders 7; x_ascenders 9"><span class='ocrx_word' id='word_1_488' title='bbox 1296 1934 1361 1953; x_wconf 89'>even</span> <span class='ocrx_word' id='word_1_489' title='bbox 1372 1930 1411 1953; x_wconf 90'>set</span> <span class='ocrx_word' id='word_1_490' title='bbox 1422 1926 1468 1953; x_wconf 88'>the</span> <span class='ocrx_word' id='word_1_491' title='bbox 1478 1926 1528 1953; x_wconf 89'>last</span> <span class='ocrx_word' id='word_1_492' title='bbox 1540 1926 1590 1953; x_wconf 88'>few</span> <span class='ocrx_word' id='word_1_493' title='bbox 1601 1927 1664 1953; x_wconf 89'>bars</span> <span class='ocrx_word' id='word_1_494' title='bbox 1675 1931 1704 1954; x_wconf 85'>to</span> <span class='ocrx_word' id='word_1_495' title='bbox 1715 1931 1806 1960; x_wconf 89'>repeat</span> <span class='ocrx_word' id='word_1_496' title='bbox 1816 1926 1955 1960; x_wconf 84'>infinitely,</span> <span class='ocrx_word' id='word_1_497' title='bbox 1968 1926 2011 1954; x_wconf 86'>for</span> <span class='ocrx_word' id='word_1_498' title='bbox 2022 1935 2038 1954; x_wconf 92'>a</span> <span class='ocrx_word' id='word_1_499' title='bbox 2049 1927 2169 1954; x_wconf 83'>fadeout.</span>
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
<div class='ocr_carea' id='block_1_20' title="bbox 1293 2000 2179 2242">
|
||||
<p class='ocr_par' id='par_1_27' lang='eng' title="bbox 1294 2000 1948 2040">
|
||||
<span class='ocr_line' id='line_1_59' title="bbox 1294 2000 1948 2040; baseline 0.002 -8; x_size 40; x_descenders 8; x_ascenders 10"><span class='ocrx_word' id='word_1_500' title='bbox 1294 2000 1532 2040; x_wconf 84'>Composition</span> <span class='ocrx_word' id='word_1_501' title='bbox 1544 2000 1699 2033; x_wconf 85'>Without</span> <span class='ocrx_word' id='word_1_502' title='bbox 1711 2000 1948 2040; x_wconf 85'>Compromise</span>
|
||||
</span>
|
||||
</p>
|
||||
|
||||
<p class='ocr_par' id='par_1_28' lang='eng' title="bbox 1293 2051 2179 2242">
|
||||
<span class='ocr_line' id='line_1_60' title="bbox 1331 2051 2179 2085; baseline 0 -7; x_size 34; x_descenders 7; x_ascenders 9"><span class='ocrx_word' id='word_1_503' title='bbox 1331 2051 1389 2078; x_wconf 90'>The</span> <span class='ocrx_word' id='word_1_504' title='bbox 1399 2051 1563 2085; x_wconf 83'>technology</span> <span class='ocrx_word' id='word_1_505' title='bbox 1573 2059 1627 2084; x_wconf 92'>you</span> <span class='ocrx_word' id='word_1_506' title='bbox 1638 2060 1686 2079; x_wconf 86'>use</span> <span class='ocrx_word' id='word_1_507' title='bbox 1697 2051 1797 2078; x_wconf 89'>should</span> <span class='ocrx_word' id='word_1_508' title='bbox 1808 2059 1887 2078; x_wconf 87'>never</span> <span class='ocrx_word' id='word_1_509' title='bbox 1897 2052 1932 2079; x_wconf 91'>be</span> <span class='ocrx_word' id='word_1_510' title='bbox 1942 2059 1973 2079; x_wconf 89'>so</span> <span class='ocrx_word' id='word_1_511' title='bbox 1984 2051 2110 2085; x_wconf 85'>complex</span> <span class='ocrx_word' id='word_1_512' title='bbox 2120 2052 2179 2078; x_wconf 86'>that</span>
|
||||
</span>
|
||||
<span class='ocr_line' id='line_1_61' title="bbox 1294 2090 2157 2124; baseline 0 -6; x_size 34; x_descenders 7; x_ascenders 8"><span class='ocrx_word' id='word_1_513' title='bbox 1294 2090 1313 2118; x_wconf 86'>it</span> <span class='ocrx_word' id='word_1_514' title='bbox 1323 2091 1459 2118; x_wconf 87'>interferes</span> <span class='ocrx_word' id='word_1_515' title='bbox 1470 2091 1535 2118; x_wconf 84'>with</span> <span class='ocrx_word' id='word_1_516' title='bbox 1545 2091 1591 2118; x_wconf 88'>the</span> <span class='ocrx_word' id='word_1_517' title='bbox 1602 2091 1715 2118; x_wconf 90'>creative</span> <span class='ocrx_word' id='word_1_518' title='bbox 1725 2099 1841 2124; x_wconf 83'>process.</span> <span class='ocrx_word' id='word_1_519' title='bbox 1854 2091 1947 2118; x_wconf 78'>That’s</span> <span class='ocrx_word' id='word_1_520' title='bbox 1957 2091 2086 2124; x_wconf 86'>precisely</span> <span class='ocrx_word' id='word_1_521' title='bbox 2096 2091 2157 2124; x_wconf 89'>why</span>
|
||||
</span>
|
||||
<span class='ocr_line' id='line_1_62' title="bbox 1293 2130 2156 2164; baseline 0 -7; x_size 34; x_descenders 7; x_ascenders 8"><span class='ocrx_word' id='word_1_522' title='bbox 1293 2130 1339 2157; x_wconf 90'>the</span> <span class='ocrx_word' id='word_1_523' title='bbox 1350 2130 1576 2164; x_wconf 80'>LinnSequencer</span> <span class='ocrx_word' id='word_1_524' title='bbox 1586 2130 1607 2157; x_wconf 89'>is</span> <span class='ocrx_word' id='word_1_525' title='bbox 1619 2130 1747 2164; x_wconf 87'>designed</span> <span class='ocrx_word' id='word_1_526' title='bbox 1758 2134 1787 2157; x_wconf 87'>to</span> <span class='ocrx_word' id='word_1_527' title='bbox 1798 2130 1834 2157; x_wconf 89'>let</span> <span class='ocrx_word' id='word_1_528' title='bbox 1844 2138 1899 2163; x_wconf 93'>you</span> <span class='ocrx_word' id='word_1_529' title='bbox 1910 2138 2051 2164; x_wconf 88'>compose,</span> <span class='ocrx_word' id='word_1_530' title='bbox 2063 2130 2156 2157; x_wconf 87'>record</span>
|
||||
</span>
|
||||
<span class='ocr_line' id='line_1_63' title="bbox 1294 2169 2145 2203; baseline 0 -6; x_size 33; x_descenders 6; x_ascenders 8"><span class='ocrx_word' id='word_1_531' title='bbox 1294 2170 1349 2197; x_wconf 90'>and</span> <span class='ocrx_word' id='word_1_532' title='bbox 1360 2169 1414 2197; x_wconf 83'>edit</span> <span class='ocrx_word' id='word_1_533' title='bbox 1425 2170 1503 2197; x_wconf 89'>while</span> <span class='ocrx_word' id='word_1_534' title='bbox 1514 2170 1643 2203; x_wconf 90'>devoting</span> <span class='ocrx_word' id='word_1_535' title='bbox 1653 2178 1721 2203; x_wconf 92'>your</span> <span class='ocrx_word' id='word_1_536' title='bbox 1731 2170 1882 2197; x_wconf 88'>undivided</span> <span class='ocrx_word' id='word_1_537' title='bbox 1893 2170 2027 2197; x_wconf 86'>attention</span> <span class='ocrx_word' id='word_1_538' title='bbox 2037 2174 2067 2197; x_wconf 91'>to</span> <span class='ocrx_word' id='word_1_539' title='bbox 2077 2178 2145 2203; x_wconf 90'>your</span>
|
||||
</span>
|
||||
<span class='ocr_line' id='line_1_64' title="bbox 1294 2209 2126 2242; baseline 0 -6; x_size 33; x_descenders 6; x_ascenders 8"><span class='ocrx_word' id='word_1_540' title='bbox 1294 2209 1388 2236; x_wconf 88'>music.</span> <span class='ocrx_word' id='word_1_541' title='bbox 1402 2209 1451 2236; x_wconf 89'>See</span> <span class='ocrx_word' id='word_1_542' title='bbox 1460 2217 1529 2242; x_wconf 92'>your</span> <span class='ocrx_word' id='word_1_543' title='bbox 1540 2209 1611 2236; x_wconf 87'>Linn</span> <span class='ocrx_word' id='word_1_544' title='bbox 1621 2209 1712 2236; x_wconf 86'>dealer</span> <span class='ocrx_word' id='word_1_545' title='bbox 1722 2209 1806 2242; x_wconf 85'>today</span> <span class='ocrx_word' id='word_1_546' title='bbox 1817 2209 1859 2236; x_wconf 87'>for</span> <span class='ocrx_word' id='word_1_547' title='bbox 1870 2217 1887 2236; x_wconf 88'>a</span> <span class='ocrx_word' id='word_1_548' title='bbox 1897 2209 2126 2236; x_wconf 76'>demonstration!</span>
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
<div class='ocr_carea' id='block_1_21' title="bbox 347 2343 2171 2378">
|
||||
<p class='ocr_par' id='par_1_29' lang='eng' title="bbox 347 2343 2171 2378">
|
||||
<span class='ocr_line' id='line_1_65' title="bbox 347 2343 2171 2378; baseline 0.001 -8; x_size 34; x_descenders 7; x_ascenders 8"><span class='ocrx_word' id='word_1_549' title='bbox 347 2350 361 2363; x_wconf 69'><strong>0</strong></span> <span class='ocrx_word' id='word_1_550' title='bbox 373 2343 483 2377; x_wconf 83'>Simple,</span> <span class='ocrx_word' id='word_1_551' title='bbox 495 2352 559 2377; x_wconf 89'>easy</span> <span class='ocrx_word' id='word_1_552' title='bbox 569 2348 598 2371; x_wconf 91'>to</span> <span class='ocrx_word' id='word_1_553' title='bbox 609 2344 683 2371; x_wconf 89'>learn</span> <span class='ocrx_word' id='word_1_554' title='bbox 694 2344 922 2378; x_wconf 80'>operation—the</span> <span class='ocrx_word' id='word_1_555' title='bbox 934 2345 967 2372; x_wconf 88'>32</span> <span class='ocrx_word' id='word_1_556' title='bbox 978 2345 1116 2372; x_wconf 86'>character</span> <span class='ocrx_word' id='word_1_557' title='bbox 1126 2345 1200 2372; x_wconf 92'>LCD</span> <span class='ocrx_word' id='word_1_558' title='bbox 1211 2345 1316 2378; x_wconf 90'>display</span> <span class='ocrx_word' id='word_1_559' title='bbox 1326 2345 1424 2378; x_wconf 88'>clearly</span> <span class='ocrx_word' id='word_1_560' title='bbox 1434 2345 1528 2378; x_wconf 86'>guides</span> <span class='ocrx_word' id='word_1_561' title='bbox 1539 2353 1594 2378; x_wconf 91'>you</span> <span class='ocrx_word' id='word_1_562' title='bbox 1604 2345 1724 2378; x_wconf 87'>through</span> <span class='ocrx_word' id='word_1_563' title='bbox 1735 2344 1770 2371; x_wconf 88'>all</span> <span class='ocrx_word' id='word_1_564' title='bbox 1781 2344 1947 2377; x_wconf 86'>operations.</span> <span class='ocrx_word' id='word_1_565' title='bbox 1961 2344 1989 2371; x_wconf 88'>If</span> <span class='ocrx_word' id='word_1_566' title='bbox 1997 2344 2112 2376; x_wconf 88'>needed,</span> <span class='ocrx_word' id='word_1_567' title='bbox 2125 2345 2171 2371; x_wconf 88'>the</span>
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
<div class='ocr_carea' id='block_1_22' title="bbox 373 2381 1083 2415">
|
||||
<p class='ocr_par' id='par_1_30' lang='eng' title="bbox 373 2381 1083 2415">
|
||||
<span class='ocr_line' id='line_1_66' title="bbox 373 2381 1083 2415; baseline 0.003 -8; x_size 34; x_descenders 7; x_ascenders 8"><span class='ocrx_word' id='word_1_568' title='bbox 373 2381 472 2407; x_wconf 85'>HELP</span> <span class='ocrx_word' id='word_1_569' title='bbox 483 2381 583 2408; x_wconf 85'>button</span> <span class='ocrx_word' id='word_1_570' title='bbox 594 2381 711 2415; x_wconf 87'>displays</span> <span class='ocrx_word' id='word_1_571' title='bbox 722 2382 875 2409; x_wconf 89'>additional</span> <span class='ocrx_word' id='word_1_572' title='bbox 886 2382 1083 2415; x_wconf 87'>explanations.</span>
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
<div class='ocr_carea' id='block_1_23' title="bbox 347 2427 2145 2507">
|
||||
<p class='ocr_par' id='par_1_31' lang='eng' title="bbox 347 2427 2145 2507">
|
||||
<span class='ocr_line' id='line_1_67' title="bbox 347 2427 1468 2461; baseline 0.002 -8; x_size 34; x_descenders 7; x_ascenders 8"><span class='ocrx_word' id='word_1_573' title='bbox 347 2432 361 2446; x_wconf 69'><strong>0</strong></span> <span class='ocrx_word' id='word_1_574' title='bbox 373 2427 612 2454; x_wconf 88'>Non-destructive</span> <span class='ocrx_word' id='word_1_575' title='bbox 622 2427 914 2461; x_wconf 85'>recording—existing</span> <span class='ocrx_word' id='word_1_576' title='bbox 924 2432 1002 2455; x_wconf 90'>notes</span> <span class='ocrx_word' id='word_1_577' title='bbox 1013 2436 1057 2455; x_wconf 88'>are</span> <span class='ocrx_word' id='word_1_578' title='bbox 1068 2432 1116 2455; x_wconf 84'>not</span> <span class='ocrx_word' id='word_1_579' title='bbox 1127 2428 1220 2455; x_wconf 87'>erased</span> <span class='ocrx_word' id='word_1_580' title='bbox 1231 2428 1309 2455; x_wconf 91'>while</span> <span class='ocrx_word' id='word_1_581' title='bbox 1319 2428 1468 2461; x_wconf 87'>recording.</span>
|
||||
</span>
|
||||
<span class='ocr_line' id='line_1_68' title="bbox 347 2473 2145 2507; baseline 0.001 -8; x_size 35; x_descenders 7; x_ascenders 9"><span class='ocrx_word' id='word_1_582' title='bbox 347 2478 361 2492; x_wconf 71'><strong>0</strong></span> <span class='ocrx_word' id='word_1_583' title='bbox 372 2473 433 2500; x_wconf 90'>Two</span> <span class='ocrx_word' id='word_1_584' title='bbox 444 2473 689 2500; x_wconf 89'>FOOTSWITCH</span> <span class='ocrx_word' id='word_1_585' title='bbox 701 2474 837 2501; x_wconf 79'>INPUTS</span> <span class='ocrx_word' id='word_1_586' title='bbox 848 2481 910 2507; x_wconf 89'>may</span> <span class='ocrx_word' id='word_1_587' title='bbox 921 2473 955 2500; x_wconf 91'>be</span> <span class='ocrx_word' id='word_1_588' title='bbox 966 2473 1091 2507; x_wconf 85'>assigned</span> <span class='ocrx_word' id='word_1_589' title='bbox 1101 2478 1130 2501; x_wconf 81'>to</span> <span class='ocrx_word' id='word_1_590' title='bbox 1141 2474 1271 2507; x_wconf 84'>remotely</span> <span class='ocrx_word' id='word_1_591' title='bbox 1281 2473 1387 2501; x_wconf 86'>control</span> <span class='ocrx_word' id='word_1_592' title='bbox 1398 2482 1481 2507; x_wconf 86'>many</span> <span class='ocrx_word' id='word_1_593' title='bbox 1491 2473 1523 2501; x_wconf 90'>of</span> <span class='ocrx_word' id='word_1_594' title='bbox 1531 2474 1578 2501; x_wconf 89'>the</span> <span class='ocrx_word' id='word_1_595' title='bbox 1588 2473 1750 2506; x_wconf 82'>commonly</span> <span class='ocrx_word' id='word_1_596' title='bbox 1760 2473 1827 2500; x_wconf 88'>used</span> <span class='ocrx_word' id='word_1_597' title='bbox 1840 2473 1991 2505; x_wconf 77'>functions,</span> <span class='ocrx_word' id='word_1_598' title='bbox 2003 2473 2145 2507; x_wconf 84'>including</span>
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
<div class='ocr_carea' id='block_1_24' title="bbox 372 2510 1090 2543">
|
||||
<p class='ocr_par' id='par_1_32' lang='eng' title="bbox 372 2510 1090 2543">
|
||||
<span class='ocr_line' id='line_1_69' title="bbox 372 2510 1090 2543; baseline 0.001 -6; x_size 35.625; x_descenders 8.90625; x_ascenders 8.90625"><span class='ocrx_word' id='word_1_599' title='bbox 372 2510 500 2542; x_wconf 88'>ERASE,</span> <span class='ocrx_word' id='word_1_600' title='bbox 513 2511 660 2542; x_wconf 86'>REPEAT,</span> <span class='ocrx_word' id='word_1_601' title='bbox 673 2511 883 2543; x_wconf 80'>PLAY/STOP,</span> <span class='ocrx_word' id='word_1_602' title='bbox 896 2519 927 2538; x_wconf 90'>or</span> <span class='ocrx_word' id='word_1_603' title='bbox 939 2511 1090 2538; x_wconf 83'>LOCATE.</span>
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
<div class='ocr_carea' id='block_1_25' title="bbox 347 2556 1768 2590">
|
||||
<p class='ocr_par' id='par_1_33' lang='eng' title="bbox 347 2556 1768 2590">
|
||||
<span class='ocr_line' id='line_1_70' title="bbox 347 2556 1768 2590; baseline 0.001 -8; x_size 34; x_descenders 7; x_ascenders 8"><span class='ocrx_word' id='word_1_604' title='bbox 347 2561 361 2575; x_wconf 71'><strong>0</strong></span> <span class='ocrx_word' id='word_1_605' title='bbox 372 2556 433 2583; x_wconf 91'>Two</span> <span class='ocrx_word' id='word_1_606' title='bbox 443 2556 612 2583; x_wconf 83'>TRIGGER</span> <span class='ocrx_word' id='word_1_607' title='bbox 623 2556 797 2584; x_wconf 84'>OUTPUTS</span> <span class='ocrx_word' id='word_1_608' title='bbox 808 2565 871 2590; x_wconf 89'>may</span> <span class='ocrx_word' id='word_1_609' title='bbox 881 2557 915 2584; x_wconf 91'>be</span> <span class='ocrx_word' id='word_1_610' title='bbox 925 2557 1119 2590; x_wconf 84'>programmed</span> <span class='ocrx_word' id='word_1_611' title='bbox 1129 2561 1158 2584; x_wconf 93'>to</span> <span class='ocrx_word' id='word_1_612' title='bbox 1169 2561 1270 2590; x_wconf 87'>output</span> <span class='ocrx_word' id='word_1_613' title='bbox 1281 2557 1370 2590; x_wconf 88'>pulses</span> <span class='ocrx_word' id='word_1_614' title='bbox 1381 2561 1409 2584; x_wconf 92'>at</span> <span class='ocrx_word' id='word_1_615' title='bbox 1419 2565 1472 2590; x_wconf 90'>any</span> <span class='ocrx_word' id='word_1_616' title='bbox 1483 2557 1598 2584; x_wconf 86'>selected</span> <span class='ocrx_word' id='word_1_617' title='bbox 1608 2561 1673 2584; x_wconf 89'>note</span> <span class='ocrx_word' id='word_1_618' title='bbox 1683 2556 1768 2583; x_wconf 89'>value.</span>
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
<div class='ocr_carea' id='block_1_26' title="bbox 347 2601 1226 2635">
|
||||
<p class='ocr_par' id='par_1_34' lang='eng' title="bbox 347 2601 1226 2635">
|
||||
<span class='ocr_line' id='line_1_71' title="bbox 347 2601 1226 2635; baseline 0.001 -7; x_size 33; x_descenders 6; x_ascenders 8"><span class='ocrx_word' id='word_1_619' title='bbox 347 2607 361 2620; x_wconf 65'><strong>0</strong></span> <span class='ocrx_word' id='word_1_620' title='bbox 372 2601 434 2628; x_wconf 88'>Will</span> <span class='ocrx_word' id='word_1_621' title='bbox 445 2609 510 2634; x_wconf 89'>sync</span> <span class='ocrx_word' id='word_1_622' title='bbox 521 2605 549 2628; x_wconf 84'>to</span> <span class='ocrx_word' id='word_1_623' title='bbox 561 2602 690 2629; x_wconf 88'>standard</span> <span class='ocrx_word' id='word_1_624' title='bbox 701 2602 864 2629; x_wconf 86'>LinnDrum</span> <span class='ocrx_word' id='word_1_625' title='bbox 875 2610 907 2629; x_wconf 91'>or</span> <span class='ocrx_word' id='word_1_626' title='bbox 918 2602 989 2629; x_wconf 89'>Linn</span> <span class='ocrx_word' id='word_1_627' title='bbox 1000 2603 1069 2629; x_wconf 90'>9000</span> <span class='ocrx_word' id='word_1_628' title='bbox 1080 2610 1145 2635; x_wconf 87'>sync</span> <span class='ocrx_word' id='word_1_629' title='bbox 1155 2607 1226 2630; x_wconf 89'>tone.</span>
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
<div class='ocr_carea' id='block_1_27' title="bbox 347 2648 2100 2727">
|
||||
<p class='ocr_par' id='par_1_35' lang='eng' title="bbox 347 2648 2100 2727">
|
||||
<span class='ocr_line' id='line_1_72' title="bbox 347 2648 1664 2682; baseline 0.001 -7; x_size 33; x_descenders 6; x_ascenders 8"><span class='ocrx_word' id='word_1_630' title='bbox 347 2654 360 2667; x_wconf 75'>'</span> <span class='ocrx_word' id='word_1_631' title='bbox 372 2648 483 2675; x_wconf 89'>Utilizes</span> <span class='ocrx_word' id='word_1_632' title='bbox 493 2648 564 2680; x_wconf 75'>ultra</span> <span class='ocrx_word' id='word_1_633' title='bbox 573 2648 744 2682; x_wconf 86'>high—speed,</span> <span class='ocrx_word' id='word_1_634' title='bbox 757 2649 772 2676; x_wconf 91'>8</span> <span class='ocrx_word' id='word_1_635' title='bbox 783 2649 862 2675; x_wconf 89'>MHz</span> <span class='ocrx_word' id='word_1_636' title='bbox 873 2649 954 2676; x_wconf 88'>80186</span> <span class='ocrx_word' id='word_1_637' title='bbox 965 2649 994 2676; x_wconf 91'>16</span> <span class='ocrx_word' id='word_1_638' title='bbox 1004 2648 1043 2676; x_wconf 90'>bit</span> <span class='ocrx_word' id='word_1_639' title='bbox 1054 2653 1197 2682; x_wconf 88'>computer</span> <span class='ocrx_word' id='word_1_640' title='bbox 1208 2649 1350 2682; x_wconf 90'>internally</span> <span class='ocrx_word' id='word_1_641' title='bbox 1361 2649 1403 2676; x_wconf 87'>for</span> <span class='ocrx_word' id='word_1_642' title='bbox 1414 2649 1502 2676; x_wconf 87'>FAST</span> <span class='ocrx_word' id='word_1_643' title='bbox 1512 2648 1664 2682; x_wconf 81'>operation.</span>
|
||||
</span>
|
||||
<span class='ocr_line' id='line_1_73' title="bbox 347 2694 2100 2727; baseline 0.001 -7; x_size 33; x_descenders 6; x_ascenders 8"><span class='ocrx_word' id='word_1_644' title='bbox 347 2699 361 2713; x_wconf 70'><strong>0</strong></span> <span class='ocrx_word' id='word_1_645' title='bbox 372 2694 504 2721; x_wconf 88'>TEMPO</span> <span class='ocrx_word' id='word_1_646' title='bbox 515 2702 578 2727; x_wconf 92'>may</span> <span class='ocrx_word' id='word_1_647' title='bbox 589 2694 623 2721; x_wconf 90'>be</span> <span class='ocrx_word' id='word_1_648' title='bbox 633 2694 764 2727; x_wconf 87'>specified</span> <span class='ocrx_word' id='word_1_649' title='bbox 774 2694 802 2721; x_wconf 89'>in</span> <span class='ocrx_word' id='word_1_650' title='bbox 814 2695 1172 2722; x_wconf 84'>BEATS-PER—MINUTE</span> <span class='ocrx_word' id='word_1_651' title='bbox 1183 2703 1215 2722; x_wconf 93'>or</span> <span class='ocrx_word' id='word_1_652' title='bbox 1225 2695 1567 2722; x_wconf 84'>FRAMES-PER—BEAT</span> <span class='ocrx_word' id='word_1_653' title='bbox 1577 2698 1605 2721; x_wconf 89'>at</span> <span class='ocrx_word' id='word_1_654' title='bbox 1616 2695 1659 2726; x_wconf 91'>24,</span> <span class='ocrx_word' id='word_1_655' title='bbox 1672 2695 1716 2726; x_wconf 88'>25,</span> <span class='ocrx_word' id='word_1_656' title='bbox 1728 2702 1760 2721; x_wconf 90'>or</span> <span class='ocrx_word' id='word_1_657' title='bbox 1772 2695 1806 2721; x_wconf 88'>30</span> <span class='ocrx_word' id='word_1_658' title='bbox 1817 2694 1917 2721; x_wconf 86'>frames</span> <span class='ocrx_word' id='word_1_659' title='bbox 1928 2702 1976 2727; x_wconf 89'>per</span> <span class='ocrx_word' id='word_1_660' title='bbox 1987 2694 2100 2726; x_wconf 87'>second,</span>
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
<div class='ocr_carea' id='block_1_28' title="bbox 373 2731 652 2765">
|
||||
<p class='ocr_par' id='par_1_36' lang='eng' title="bbox 373 2731 652 2765">
|
||||
<span class='ocr_line' id='line_1_74' title="bbox 373 2731 652 2765; baseline 0 -7; x_size 33; x_descenders 6; x_ascenders 8"><span class='ocrx_word' id='word_1_661' title='bbox 373 2731 449 2764; x_wconf 87'>(even</span> <span class='ocrx_word' id='word_1_662' title='bbox 460 2731 529 2765; x_wconf 88'>drop</span> <span class='ocrx_word' id='word_1_663' title='bbox 541 2731 652 2764; x_wconf 81'>frame!)</span>
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
<div class='ocr_carea' id='block_1_29' title="bbox 347 2777 2174 2811">
|
||||
<p class='ocr_par' id='par_1_37' lang='eng' title="bbox 347 2777 2174 2811">
|
||||
<span class='ocr_line' id='line_1_75' title="bbox 347 2777 2174 2811; baseline 0.001 -8; x_size 33; x_descenders 5; x_ascenders 9"><span class='ocrx_word' id='word_1_664' title='bbox 347 2782 360 2796; x_wconf 72'><strong>0</strong></span> <span class='ocrx_word' id='word_1_665' title='bbox 372 2777 504 2804; x_wconf 82'>TEMPO</span> <span class='ocrx_word' id='word_1_666' title='bbox 515 2785 578 2810; x_wconf 91'>may</span> <span class='ocrx_word' id='word_1_667' title='bbox 588 2777 622 2804; x_wconf 92'>be</span> <span class='ocrx_word' id='word_1_668' title='bbox 633 2778 741 2804; x_wconf 84'>entered</span> <span class='ocrx_word' id='word_1_669' title='bbox 751 2777 934 2811; x_wconf 80'>numerically,</span> <span class='ocrx_word' id='word_1_670' title='bbox 946 2777 1101 2811; x_wconf 85'>adjustable</span> <span class='ocrx_word' id='word_1_671' title='bbox 1111 2777 1139 2804; x_wconf 92'>in</span> <span class='ocrx_word' id='word_1_672' title='bbox 1149 2778 1239 2805; x_wconf 88'>tenths</span> <span class='ocrx_word' id='word_1_673' title='bbox 1250 2778 1282 2805; x_wconf 85'>of</span> <span class='ocrx_word' id='word_1_674' title='bbox 1290 2786 1307 2805; x_wconf 94'>a</span> <span class='ocrx_word' id='word_1_675' title='bbox 1317 2777 1567 2805; x_wconf 85'>Beat-Per-Minute</span> <span class='ocrx_word' id='word_1_676' title='bbox 1577 2777 1748 2809; x_wconf 85'>increments,</span> <span class='ocrx_word' id='word_1_677' title='bbox 1760 2785 1792 2804; x_wconf 87'>or</span> <span class='ocrx_word' id='word_1_678' title='bbox 1803 2777 1839 2810; x_wconf 94'>by</span> <span class='ocrx_word' id='word_1_679' title='bbox 1849 2777 1964 2811; x_wconf 84'>tapping</span> <span class='ocrx_word' id='word_1_680' title='bbox 1975 2781 2086 2810; x_wconf 85'>quarter</span> <span class='ocrx_word' id='word_1_681' title='bbox 2097 2781 2174 2804; x_wconf 85'>notes</span>
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
<div class='ocr_carea' id='block_1_30' title="bbox 372 2815 808 2842">
|
||||
<p class='ocr_par' id='par_1_38' lang='eng' title="bbox 372 2815 808 2842">
|
||||
<span class='ocr_line' id='line_1_76' title="bbox 372 2815 808 2842; baseline 0.002 -1; x_size 32.351353; x_descenders 5.3513513; x_ascenders 9"><span class='ocrx_word' id='word_1_682' title='bbox 372 2822 410 2841; x_wconf 93'>on</span> <span class='ocrx_word' id='word_1_683' title='bbox 420 2815 466 2842; x_wconf 86'>the</span> <span class='ocrx_word' id='word_1_684' title='bbox 476 2815 545 2841; x_wconf 91'>TAP</span> <span class='ocrx_word' id='word_1_685' title='bbox 556 2815 689 2842; x_wconf 85'>TEMPO</span> <span class='ocrx_word' id='word_1_686' title='bbox 699 2815 808 2842; x_wconf 83'>button.</span>
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
<div class='ocr_carea' id='block_1_31' title="bbox 347 2861 1792 2940">
|
||||
<p class='ocr_par' id='par_1_39' lang='eng' title="bbox 347 2861 1792 2940">
|
||||
<span class='ocr_line' id='line_1_77' title="bbox 347 2861 1792 2895; baseline 0.001 -8; x_size 33; x_descenders 6; x_ascenders 8"><span class='ocrx_word' id='word_1_687' title='bbox 347 2866 360 2880; x_wconf 68'><strong>0</strong></span> <span class='ocrx_word' id='word_1_688' title='bbox 372 2861 504 2887; x_wconf 87'>TEMPO</span> <span class='ocrx_word' id='word_1_689' title='bbox 515 2861 696 2888; x_wconf 86'>CHANGES</span> <span class='ocrx_word' id='word_1_690' title='bbox 707 2869 771 2894; x_wconf 92'>may</span> <span class='ocrx_word' id='word_1_691' title='bbox 781 2861 815 2888; x_wconf 92'>be</span> <span class='ocrx_word' id='word_1_692' title='bbox 825 2861 1019 2894; x_wconf 85'>programmed</span> <span class='ocrx_word' id='word_1_693' title='bbox 1030 2861 1087 2888; x_wconf 88'>into</span> <span class='ocrx_word' id='word_1_694' title='bbox 1099 2869 1115 2888; x_wconf 87'>a</span> <span class='ocrx_word' id='word_1_695' title='bbox 1126 2870 1268 2895; x_wconf 87'>sequence,</span> <span class='ocrx_word' id='word_1_696' title='bbox 1280 2861 1344 2888; x_wconf 89'>with</span> <span class='ocrx_word' id='word_1_697' title='bbox 1356 2862 1467 2888; x_wconf 88'>smooth</span> <span class='ocrx_word' id='word_1_698' title='bbox 1478 2861 1635 2888; x_wconf 85'>transitions</span> <span class='ocrx_word' id='word_1_699' title='bbox 1646 2861 1670 2887; x_wconf 90'>if</span> <span class='ocrx_word' id='word_1_700' title='bbox 1679 2861 1792 2888; x_wconf 89'>desired.</span>
|
||||
</span>
|
||||
<span class='ocr_line' id='line_1_78' title="bbox 347 2906 1507 2940; baseline 0.002 -8; x_size 33; x_descenders 7; x_ascenders 8"><span class='ocrx_word' id='word_1_701' title='bbox 347 2911 360 2925; x_wconf 74'><strong><em>°</em></strong></span> <span class='ocrx_word' id='word_1_702' title='bbox 371 2906 434 2938; x_wconf 92'>Any</span> <span class='ocrx_word' id='word_1_703' title='bbox 444 2906 539 2932; x_wconf 85'>TIME</span> <span class='ocrx_word' id='word_1_704' title='bbox 550 2906 763 2933; x_wconf 88'>SIGNATURE</span> <span class='ocrx_word' id='word_1_705' title='bbox 773 2915 836 2939; x_wconf 88'>may</span> <span class='ocrx_word' id='word_1_706' title='bbox 846 2907 880 2933; x_wconf 91'>be</span> <span class='ocrx_word' id='word_1_707' title='bbox 891 2907 968 2938; x_wconf 89'>used,</span> <span class='ocrx_word' id='word_1_708' title='bbox 980 2907 1036 2934; x_wconf 89'>and</span> <span class='ocrx_word' id='word_1_709' title='bbox 1046 2915 1109 2940; x_wconf 91'>may</span> <span class='ocrx_word' id='word_1_710' title='bbox 1120 2907 1154 2934; x_wconf 90'>be</span> <span class='ocrx_word' id='word_1_711' title='bbox 1164 2907 1288 2940; x_wconf 84'>changed</span> <span class='ocrx_word' id='word_1_712' title='bbox 1299 2907 1393 2934; x_wconf 83'>within</span> <span class='ocrx_word' id='word_1_713' title='bbox 1404 2915 1420 2934; x_wconf 89'>a</span> <span class='ocrx_word' id='word_1_714' title='bbox 1431 2915 1507 2940; x_wconf 87'>song.</span>
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
<div class='ocr_carea' id='block_1_32' title="bbox 1540 2970 1878 3140">
|
||||
<p class='ocr_par' id='par_1_40' lang='eng' title="bbox 1540 2970 1878 3140">
|
||||
<span class='ocr_line' id='line_1_79' title="bbox 1540 2970 1800 3089; baseline 0 -14; x_size 100.5; x_descenders 16.5; x_ascenders 28.499998"><span class='ocrx_word' id='word_1_715' title='bbox 1540 2970 1800 3089; x_wconf 74'>E1111</span>
|
||||
</span>
|
||||
<span class='ocr_line' id='line_1_80' title="bbox 1554 3108 1878 3140; baseline 0 -5; x_size 32; x_descenders 5; x_ascenders 9"><span class='ocrx_word' id='word_1_716' title='bbox 1554 3108 1624 3135; x_wconf 91'>Linn</span> <span class='ocrx_word' id='word_1_717' title='bbox 1635 3108 1808 3140; x_wconf 87'>Electronics,</span> <span class='ocrx_word' id='word_1_718' title='bbox 1822 3109 1878 3136; x_wconf 84'>Inc.</span>
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
<div class='ocr_carea' id='block_1_33' title="bbox 1554 3150 2188 3226">
|
||||
<p class='ocr_par' id='par_1_41' lang='eng' title="bbox 1554 3150 2188 3226">
|
||||
<span class='ocr_line' id='line_1_81' title="bbox 1557 3150 2163 3182; baseline 0 -5; x_size 32; x_descenders 5; x_ascenders 8"><span class='ocrx_word' id='word_1_719' title='bbox 1557 3150 1638 3177; x_wconf 88'>18720</span> <span class='ocrx_word' id='word_1_720' title='bbox 1648 3150 1761 3177; x_wconf 89'>Oxnard</span> <span class='ocrx_word' id='word_1_721' title='bbox 1772 3150 1866 3182; x_wconf 81'>Street,</span> <span class='ocrx_word' id='word_1_722' title='bbox 1878 3150 2006 3182; x_wconf 86'>Tarzana,</span> <span class='ocrx_word' id='word_1_723' title='bbox 2019 3150 2071 3177; x_wconf 93'>CA</span> <span class='ocrx_word' id='word_1_724' title='bbox 2082 3150 2163 3177; x_wconf 88'>91356</span>
|
||||
</span>
|
||||
<span class='ocr_line' id='line_1_82' title="bbox 1554 3192 2188 3226; baseline 0 -7; x_size 33.5; x_descenders 5.5; x_ascenders 8.5"><span class='ocrx_word' id='word_1_725' title='bbox 1554 3193 1622 3226; x_wconf 89'>(818)</span> <span class='ocrx_word' id='word_1_726' title='bbox 1633 3193 1755 3219; x_wconf 60'>7088131</span> <span class='ocrx_word' id='word_1_727' title='bbox 1765 3193 1788 3219; x_wconf 91'>T</span> <span class='ocrx_word' id='word_1_728' title='bbox 1789 3193 1888 3219; x_wconf 87'>ELEX</span> <span class='ocrx_word' id='word_1_729' title='bbox 1899 3192 2022 3219; x_wconf 82'>#298949</span> <span class='ocrx_word' id='word_1_730' title='bbox 2033 3193 2125 3219; x_wconf 88'>LINN</span> <span class='ocrx_word' id='word_1_731' title='bbox 2135 3193 2188 3219; x_wconf 89'>UR</span>
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1 @@
|
||||
Tesseract Open Source OCR Engine v3.05.01 with Leptonica
|
||||
@@ -0,0 +1,123 @@
|
||||
The LinnSequencer
|
||||
32 Track MIDI Sequence Recorder
|
||||
|
||||
The LinnSequencer is a state—of—the-art composition and performance tool for the professional musician. It is
|
||||
|
||||
extremely powerful, yet amazingly simple to learn and use. It’s many remarkable features include:
|
||||
|
||||
0 Operation is similar to multi—track tape recorder with PLAY, STOP, RECORD, FAST
|
||||
FORWARD, REWIND, and LOCATE controls.
|
||||
|
||||
0 Each of the 100 sequences contains 32 simultaneous, polyphonic tracks. Each track may
|
||||
be assigned to one of 16 MIDI channels. Simultaneously plays up to 16 polyphonic
|
||||
|
||||
synthesizers !
|
||||
|
||||
0 Ultra—fast 3 1/2 ” disk drive stores complex songs in seconds and holds over 110,000 notes
|
||||
|
||||
per disk!
|
||||
|
||||
0 One or all tracks may be TRANSPOSED at the touch of a key.
|
||||
0 Exclusive real—time ERASE function makes editing FAST.
|
||||
0 Exclusive REPEAT function automatically repeats any held notes at a pre-selected
|
||||
|
||||
rhythmic value.
|
||||
|
||||
0 TIMING CORRECTION works during playback and operates without ‘chopping’ notes.
|
||||
|
||||
0 Optional SMPTE time code synchronization.
|
||||
|
||||
0 Optional remote control.
|
||||
|
||||
Recording 3 Sequence
|
||||
|
||||
To record a sequence, simply press RECORD and PLAY,
|
||||
then play your MIDI keyboard in time to the Sequencer’s
|
||||
click track. When the sequence loops back around to bar 1,
|
||||
you’ll hear what you played—only all timing errors will be
|
||||
|
||||
corrected! (Timing correction may be adjusted or defeated).
|
||||
|
||||
Any additional notes played will be added into the track
|
||||
—existing notes are not erased while recording!
|
||||
|
||||
FAST FORWARD, REWIND, and LOCATE controls
|
||||
may be used at any time to quickly access any location in
|
||||
your sequence for spot—recording. To overdub a new part,
|
||||
select a different track and start recording~while you
|
||||
record, the first‘track will play in perfect sync (unless you
|
||||
MUTE it, or SOLO another track). In this way, up to 32
|
||||
tracks may be overdubbed! All MIDI effects are recorded
|
||||
including pitch bend, modulation, velocity, aftertouch,
|
||||
sustain pedal, and program changes!
|
||||
|
||||
Editing
|
||||
|
||||
To erase a wrong note, simply hold ERASE and press
|
||||
the note to be erased just before it plays in the sequence—
|
||||
when played back, it will be gone. Notes may also be
|
||||
|
||||
added, erased, or changed using the SINGLE STEP func-
|
||||
tion. To overdub notes at specific points within a sequence,
|
||||
|
||||
Additional Features
|
||||
|
||||
simply use LOCATE, FAST FORWARD, or REWIND to
|
||||
find the desired bar number, then start recording.
|
||||
|
||||
The INSERT/COPY function allows you to move bars
|
||||
from one location to another—in the same sequence or a
|
||||
different one. For example, you might insert a copy of the
|
||||
first verse between the second chorus and the bridge.
|
||||
DELETE BARS operates the same way to remove
|
||||
unwanted sections.
|
||||
|
||||
Creating a Song
|
||||
|
||||
One way to create a song is to record each track all the
|
||||
way through (up to 999 bars). Another way is to record
|
||||
each basic section (verse, chorus, etc.) in individual
|
||||
sequences, then use the CREATE SONG function to “chain”
|
||||
them together. CREATE SONG will then automatically
|
||||
copy all the parts into a new sequence. If desired, you can
|
||||
even set the last few bars to repeat infinitely, for a fadeout.
|
||||
|
||||
Composition Without Compromise
|
||||
|
||||
The technology you use should never be so complex that
|
||||
it interferes with the creative process. That’s precisely why
|
||||
the LinnSequencer is designed to let you compose, record
|
||||
and edit while devoting your undivided attention to your
|
||||
music. See your Linn dealer today for a demonstration!
|
||||
|
||||
0 Simple, easy to learn operation—the 32 character LCD display clearly guides you through all operations. If needed, the
|
||||
|
||||
HELP button displays additional explanations.
|
||||
|
||||
0 Non-destructive recording—existing notes are not erased while recording.
|
||||
0 Two FOOTSWITCH INPUTS may be assigned to remotely control many of the commonly used functions, including
|
||||
|
||||
ERASE, REPEAT, PLAY/STOP, or LOCATE.
|
||||
|
||||
0 Two TRIGGER OUTPUTS may be programmed to output pulses at any selected note value.
|
||||
|
||||
0 Will sync to standard LinnDrum or Linn 9000 sync tone.
|
||||
|
||||
' Utilizes ultra high—speed, 8 MHz 80186 16 bit computer internally for FAST operation.
|
||||
0 TEMPO may be specified in BEATS-PER—MINUTE or FRAMES-PER—BEAT at 24, 25, or 30 frames per second,
|
||||
|
||||
(even drop frame!)
|
||||
|
||||
0 TEMPO may be entered numerically, adjustable in tenths of a Beat-Per-Minute increments, or by tapping quarter notes
|
||||
|
||||
on the TAP TEMPO button.
|
||||
|
||||
0 TEMPO CHANGES may be programmed into a sequence, with smooth transitions if desired.
|
||||
° Any TIME SIGNATURE may be used, and may be changed within a song.
|
||||
|
||||
E1111
|
||||
Linn Electronics, Inc.
|
||||
|
||||
18720 Oxnard Street, Tarzana, CA 91356
|
||||
(818) 7088131 T ELEX #298949 LINN UR
|
||||
|
||||
BIN
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user