diff --git a/borb/io/read/any_object_transformer.py b/borb/io/read/any_object_transformer.py index 7c122a4a8..ab19e10ed 100644 --- a/borb/io/read/any_object_transformer.py +++ b/borb/io/read/any_object_transformer.py @@ -29,9 +29,9 @@ from borb.io.read.page.root_dictionary_transformer import RootDictionaryTransformer from borb.io.read.primitive.number_transformer import NumberTransformer from borb.io.read.primitive.string_transformer import StringTransformer -from borb.io.read.transformer import Transformer, ReadTransformerState from borb.io.read.reference.reference_transformer import ReferenceTransformer from borb.io.read.reference.xref_transformer import XREFTransformer +from borb.io.read.transformer import Transformer, ReadTransformerState from borb.io.read.types import AnyPDFType from borb.pdf.canvas.event.event_listener import EventListener diff --git a/borb/io/read/encryption/__init__.py b/borb/io/read/encryption/__init__.py new file mode 100644 index 000000000..bcf77caad --- /dev/null +++ b/borb/io/read/encryption/__init__.py @@ -0,0 +1,43 @@ +""" + This file is part of the borb (R) project. + Copyright (c) 2020-2040 borb Group NV + Authors: Joris Schellekens, et al. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License version 3 + as published by the Free Software Foundation with the addition of the + following permission added to Section 15 as permitted in Section 7(a): + FOR ANY PART OF THE COVERED WORK IN WHICH THE COPYRIGHT IS OWNED BY + BORB GROUP. BORB GROUP DISCLAIMS THE WARRANTY OF NON INFRINGEMENT + OF THIRD PARTY RIGHTS + + 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 Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program; if not, see http://www.gnu.org/licenses or write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA, 02110-1301 USA. + + The interactive user interfaces in modified source and object code versions + of this program must display Appropriate Legal Notices, as required under + Section 5 of the GNU Affero General Public License. + In accordance with Section 7(b) of the GNU Affero General Public License, + a covered work must retain the producer line in every PDF that is created + or manipulated using borb. + + You can be released from the requirements of the license by purchasing + a commercial license. Buying such a license is mandatory as soon as you + develop commercial activities involving the borb software without + disclosing the source code of your own applications. + + These activities include: offering paid services to customers as an ASP, + serving PDFs on the fly in a web application, shipping borb with a closed + source product. + + For more information, please contact borb Software Corp. at this + address: joris.schellekens.1989@gmail.com +""" diff --git a/borb/io/read/encryption/rc4.py b/borb/io/read/encryption/rc4.py new file mode 100644 index 000000000..570496275 --- /dev/null +++ b/borb/io/read/encryption/rc4.py @@ -0,0 +1,58 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +""" + In cryptography, RC4 (Rivest Cipher 4 also known as ARC4 or ARCFOUR meaning Alleged RC4, see below) is a stream cipher. + While it is remarkable for its simplicity and speed in software, multiple vulnerabilities have been discovered in RC4, rendering it insecure. + It is especially vulnerable when the beginning of the output keystream is not discarded, or when nonrandom or related keys are used. + Particularly problematic uses of RC4 have led to very insecure protocols such as WEP. + + As of 2015, there is speculation that some state cryptologic agencies may possess the capability to break RC4 when used in the TLS protocol. + IETF has published RFC 7465 to prohibit the use of RC4 in TLS; Mozilla and Microsoft have issued similar recommendations. + + A number of attempts have been made to strengthen RC4, notably Spritz, RC4A, VMPC, and RC4+. +""" + + +class RC4: + """ + In cryptography, RC4 (Rivest Cipher 4 also known as ARC4 or ARCFOUR meaning Alleged RC4, see below) is a stream cipher. + While it is remarkable for its simplicity and speed in software, multiple vulnerabilities have been discovered in RC4, rendering it insecure. + It is especially vulnerable when the beginning of the output keystream is not discarded, or when nonrandom or related keys are used. + Particularly problematic uses of RC4 have led to very insecure protocols such as WEP. + + As of 2015, there is speculation that some state cryptologic agencies may possess the capability to break RC4 when used in the TLS protocol. + IETF has published RFC 7465 to prohibit the use of RC4 in TLS; Mozilla and Microsoft have issued similar recommendations. + + A number of attempts have been made to strengthen RC4, notably Spritz, RC4A, VMPC, and RC4+. + """ + + def __init__(self): + self._state = [n for n in range(256)] + self._p: int = 0 + self._q: int = 0 + + def set_key(self, key: bytes): + self._state = [n for n in range(256)] + self._p = 0 + self._q = 0 + j: int = 0 + for i in range(256): + if len(key) > 0: + j = (j + self._state[i] + key[i % len(key)]) % 256 + else: + j = (j + self._state[i]) % 256 + self._state[i], self._state[j] = self._state[j], self._state[i] + + def _byte_generator(self): + self._p = (self._p + 1) % 256 + self._q = (self._q + self._state[self._p]) % 256 + self._state[self._p], self._state[self._q] = ( + self._state[self._q], + self._state[self._p], + ) + return self._state[(self._state[self._p] + self._state[self._q]) % 256] + + def encrypt(self, key: bytes, input: bytes): + self.set_key(key) + return bytes([p ^ self._byte_generator() for p in input]) diff --git a/borb/io/read/encryption/standard_security_handler.py b/borb/io/read/encryption/standard_security_handler.py new file mode 100644 index 000000000..0d8e149b2 --- /dev/null +++ b/borb/io/read/encryption/standard_security_handler.py @@ -0,0 +1,421 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +""" +PDF’s standard security handler shall allow access permissions and up to two passwords to be specified for a +document: an owner password and a user password. An application’s decision to encrypt a document shall be +based on whether the user creating the document specifies any passwords or access restrictions. +""" +import hashlib +import typing +import zlib + +from borb.io.read.encryption.rc4 import RC4 +from borb.io.read.types import ( + String, + Decimal, + HexadecimalString, + Boolean, + AnyPDFType, + Reference, + Stream, + Name, +) + + +class StandardSecurityHandler: + """ + PDF’s standard security handler shall allow access permissions and up to two passwords to be specified for a + document: an owner password and a user password. An application’s decision to encrypt a document shall be + based on whether the user creating the document specifies any passwords or access restrictions. + """ + + def __init__( + self, + encryption_dictionary: dict, + user_password: typing.Optional[str] = None, + owner_password: typing.Optional[str] = None, + ): + + # (Optional) A code specifying the algorithm to be used in encrypting and + # decrypting the document: + # 0 An algorithm that is undocumented. This value shall not be used. + # 1 "Algorithm 1: Encryption of data using the RC4 or AES algorithms" in 7.6.2, + # "General Encryption Algorithm," with an encryption key length of 40 bits; see + # below. + # 2 (PDF 1.4) "Algorithm 1: Encryption of data using the RC4 or AES algorithms" + # in 7.6.2, "General Encryption Algorithm," but permitting encryption key lengths + # greater than 40 bits. + # 3 (PDF 1.4) An unpublished algorithm that permits encryption key lengths + # ranging from 40 to 128 bits. This value shall not appear in a conforming PDF + # file. + # 4 (PDF 1.5) The security handler defines the use of encryption and decryption + # in the document, using the rules specified by the CF, StmF, and StrF entries. + # The default value if this entry is omitted shall be 0, but when present should be a + # value of 1 or greater. + self._v = int(encryption_dictionary.get("V", Decimal(0))) + + # (Required) A 32-byte string, based on the user password, that shall be + # used in determining whether to prompt the user for a password and, if so, + # whether a valid user or owner password was entered. For more + # information, see 7.6.3.4, "Password Algorithms." + self._u: bytes = StandardSecurityHandler._str_to_bytes( + StandardSecurityHandler._unescape_pdf_syntax(encryption_dictionary.get("U")) + ) + assert len(self._u) == 32 + + # (Required) A 32-byte string, based on both the owner and user passwords, + # that shall be used in computing the encryption key and in determining + # whether a valid owner password was entered. For more information, see + # 7.6.3.3, "Encryption Key Algorithm," and 7.6.3.4, "Password Algorithms." + self._o: bytes = StandardSecurityHandler._str_to_bytes( + StandardSecurityHandler._unescape_pdf_syntax(encryption_dictionary.get("O")) + ) + assert len(self._o) == 32 + + # /ID + trailer: dict = encryption_dictionary.get_parent() + if "ID" in trailer: + self._document_id: bytes = trailer["ID"][0].get_content_bytes() + + # (Required) A set of flags specifying which operations shall be permitted + # when the document is opened with user access (see Table 22). + self._permissions: int = int(encryption_dictionary.get("P")) + + # (Optional; PDF 1.4; only if V is 2 or 3) The length of the encryption key, in bits. + # The value shall be a multiple of 8, in the range 40 to 128. Default value: 40. + self._key_length: int = int(encryption_dictionary.get("Length", Decimal(40))) + assert ( + self._key_length % 8 == 0 + ), "The length of the encryption key, in bits must be a multiple of 8." + + # (Required) A number specifying which revision of the standard security + # handler shall be used to interpret this dictionary + self._revision: int = int(encryption_dictionary.get("R", Decimal(0))) + + # (Optional; meaningful only when the value of V is 4; PDF 1.5) Indicates + # whether the document-level metadata stream (see 14.3.2, "Metadata + # Streams") shall be encrypted. Conforming products should respect this + # value. + # Default value: true. + self._encrypt_metadata: bool = encryption_dictionary.get( + "EncryptMetadata", Boolean(True) + ) + + # verify password(s) + password: typing.Optional[bytes] = None + if user_password is not None: + self._authenticate_user_password(bytes(user_password, encoding="charmap")) + password = bytes(user_password, encoding="charmap") + if owner_password is not None: + self._authenticate_owner_password(bytes(owner_password, encoding="charmap")) + password = bytes(owner_password, encoding="charmap") + + # calculate encryption_key + self._encryption_key: bytes = self._compute_encryption_key(password) + + def _encrypt_data(self, object: AnyPDFType) -> None: + # a) Obtain the object number and generation number from the object identifier of the string or stream to be + # encrypted (see 7.3.10, "Indirect Objects"). If the string is a direct object, use the identifier of the indirect + # object containing it. + reference: typing.Optional[Reference] = object.get_reference() + if reference is None: + reference = object.get_parent().get_reference() + object_number: int = reference.object_number + generation_number: int = reference.generation_number + + # b) For all strings and streams without crypt filter specifier; treating the object number and generation number + # as binary integers, extend the original n-byte encryption key to n + 5 bytes by appending the low-order 3 + # bytes of the object number and the low-order 2 bytes of the generation number in that order, low-order byte + # first. (n is 5 unless the value of V in the encryption dictionary is greater than 1, in which case n is the value + # of Length divided by 8.) + # If using the AES algorithm, extend the encryption key an additional 4 bytes by adding the value “sAlT”, + # which corresponds to the hexadecimal values 0x73, 0x41, 0x6C, 0x54. (This addition is done for backward + # compatibility and is not intended to provide additional security.) + encryption_key = ( + self._encryption_key + + object_number.to_bytes(3, byteorder="little", signed=False) + + generation_number.to_bytes(2, byteorder="little", signed=False) + ) + n: int = 5 + if self._v > 1: + n = int(self._key_length / 8) + + # c) Initialize the MD5 hash function and pass the result of step (b) as input to this function. + h = hashlib.md5() + h.update(encryption_key) + + # d) Use the first (n + 5) bytes, up to a maximum of 16, of the output from the MD5 hash as the key for the RC4 + # or AES symmetric key algorithms, along with the string or stream data to be encrypted. + # If using the AES algorithm, the Cipher Block Chaining (CBC) mode, which requires an initialization vector, + # is used. The block size parameter is set to 16 bytes, and the initialization vector is a 16-byte random + # number that is stored as the first 16 bytes of the encrypted stream or string. + # The output is the encrypted data to be stored in the PDF file. + n_plus_5: int = min(16, n + 5) + if isinstance(object, String): + new_content_bytes: bytes = RC4().encrypt( + h.digest()[0:n_plus_5], object.get_content_bytes() + ) + # TODO + if isinstance(object, HexadecimalString): + new_content_bytes: bytes = RC4().encrypt( + h.digest()[0:n_plus_5], object.get_content_bytes() + ) + # TODO + if isinstance(object, Stream): + new_content_bytes: bytes = RC4().encrypt( + h.digest()[0:n_plus_5], object["DecodedBytes"] + ) + object[Name("DecodedBytes")] = new_content_bytes + object[Name("Bytes")] = zlib.compress(object["DecodedBytes"], 9) + return object + + def _decrypt_data(self, object: AnyPDFType) -> None: + return self._encrypt_data(object) + + def _compute_encryption_key(self, password: bytes) -> bytes: + # a) Pad or truncate the password string to exactly 32 bytes. If the password string is more than 32 bytes long, + # use only its first 32 bytes; if it is less than 32 bytes long, pad it by appending the required number of + # additional bytes from the beginning of the following padding string: + # < 28 BF 4E 5E 4E 75 8A 41 64 00 4E 56 FF FA 01 08 + # 2E 2E 00 B6 D0 68 3E 80 2F 0C A9 FE 64 53 69 7A > + # That is, if the password string is n bytes long, append the first 32 - n bytes of the padding string to the end + # of the password string. If the password string is empty (zero-length), meaning there is no user password, + # substitute the entire padding string in its place. + + # b) Initialize the MD5 hash function and pass the result of step (a) as input to this function. + h = hashlib.md5() + h.update(StandardSecurityHandler._pad_or_truncate(password)) + + # c) Pass the value of the encryption dictionary’s O entry to the MD5 hash function. ("Algorithm 3: Computing + # the encryption dictionary’s O (owner password) value" shows how the O value is computed.) + h.update(self._o) + + # d) Convert the integer value of the P entry to a 32-bit unsigned binary number and pass these bytes to the + # MD5 hash function, low-order byte first. + h.update(self._permissions.to_bytes(length=4, byteorder="little", signed=True)) + + # e) Pass the first element of the file’s file identifier array (the value of the ID entry in the document’s trailer + # dictionary; see Table 15) to the MD5 hash function. + h.update(self._document_id) + + # f) (Security handlers of revision 4 or greater) If document metadata is not being encrypted, pass 4 bytes with + # the value 0xFFFFFFFF to the MD5 hash function. + if self._revision >= 4 and not self._encrypt_metadata: + h.update(bytes([255, 255, 255, 255])) + + # g) Finish the hash. + digest: bytes = h.digest() + + # h) (Security handlers of revision 3 or greater) Do the following 50 times: Take the output from the previous + # MD5 hash and pass the first n bytes of the output as input into a new MD5 hash, where n is the number of + # bytes of the encryption key as defined by the value of the encryption dictionary’s Length entry. + if self._revision >= 3: + # THIS IS WHERE THE ALGORITHM GOES WRONG + n: int = int(self._key_length / 8) + for _ in range(0, 50): + h2 = hashlib.md5() + h2.update(digest[0:n]) + digest = h2.digest() + + # i) Set the encryption key to the first n bytes of the output from the final MD5 hash, where n shall always be 5 + # for security handlers of revision 2 but, for security handlers of revision 3 or greater, shall depend on the + # value of the encryption dictionary’s Length entry. + n: int = 5 + if self._revision >= 3: + n = int(self._key_length / 8) + encryption_key: bytes = digest[0:n] + + return encryption_key + + def _compute_encryption_dictionary_o_value( + self, + owner_password: typing.Optional[bytes], + user_password: typing.Optional[bytes], + ) -> bytes: + """ + Algorithm 3: Computing the encryption dictionary’s O (owner password) value + """ + + # a) Pad or truncate the owner password string as described in step (a) of "Algorithm 2: Computing an + # encryption key". If there is no owner password, use the user password instead. + padded_owner_password: bytes = StandardSecurityHandler._pad_or_truncate( + owner_password + ) + + # b) Initialize the MD5 hash function and pass the result of step (a) as input to this function. + h = hashlib.md5() + h.update(padded_owner_password) + + # c) (Security handlers of revision 3 or greater) Do the following 50 times: Take the output from the previous + # MD5 hash and pass it as input into a new MD5 hash. + if self._revision >= 3: + prev_digest: bytes = h.digest()[0 : int(self._key_length / 8)] + for _ in range(0, 50): + h = hashlib.md5() + h.update(prev_digest) + prev_digest: bytes = h.digest()[0 : int(self._key_length / 8)] + + # d) Create an RC4 encryption key using the first n bytes of the output from the final MD5 hash, where n shall + # always be 5 for security handlers of revision 2 but, for security handlers of revision 3 or greater, shall + # depend on the value of the encryption dictionary’s Length entry. + key: bytes = h.digest()[0:5] + if self._revision >= 3: + key = h.digest()[0 : int(self._key_length / 8)] + + # e) Pad or truncate the user password string as described in step (a) of "Algorithm 2: Computing an encryption + # key". + padded_user_password: bytes = StandardSecurityHandler._pad_or_truncate( + user_password + ) + + # f) Encrypt the result of step (e), using an RC4 encryption function with the encryption key obtained in step + # (d). + rc4: RC4 = RC4() + owner_key: bytes = rc4.encrypt(key, padded_user_password) + + # g) (Security handlers of revision 3 or greater) Do the following 19 times: Take the output from the previous + # invocation of the RC4 function and pass it as input to a new invocation of the function; use an encryption + # key generated by taking each byte of the encryption key obtained in step (d) and performing an XOR + # (exclusive or) operation between that byte and the single-byte value of the iteration counter (from 1 to 19). + if self._revision >= 3: + for i in range(1, 20): + key2: bytes = bytes([b ^ i for b in key]) + owner_key = RC4().encrypt(key2, owner_key) + + # h) Store the output from the final invocation of the RC4 function as the value of the O entry in the encryption + # dictionary. + self._o = owner_key + return owner_key + + def _compute_encryption_dictionary_u_value(self, user_password_string: bytes): + """ + Algorithm 4: Computing the encryption dictionary’s U (user password) value (Security handlers of revision 2) + Algorithm 5: Computing the encryption dictionary’s U (user password) value (Security handlers of revision 3 or greater) + """ + if self._revision == 2: + # a) Create an encryption key based on the user password string, as described in "Algorithm 2: Computing an + # encryption key". + key: bytes = self._compute_encryption_key(user_password_string) + + # b) Encrypt the 32-byte padding string shown in step (a) of "Algorithm 2: Computing an encryption key", using + # an RC4 encryption function with the encryption key from the preceding step. + + # c) Store the result of step (b) as the value of the U entry in the encryption dictionary. + self._u = RC4().encrypt(key, StandardSecurityHandler._pad_or_truncate(None)) + + return self._u + if self._revision >= 3: + # a) Create an encryption key based on the user password string, as described in "Algorithm 2: Computing an + # encryption key". + key: bytes = self._compute_encryption_key(user_password_string) + + # b) Initialize the MD5 hash function and pass the 32-byte padding string shown in step (a) of "Algorithm 2: + # Computing an encryption key" as input to this function. + h = hashlib.md5() + h.update(StandardSecurityHandler._pad_or_truncate(None)) + + # c) Pass the first element of the file’s file identifier array (the value of the ID entry in the document’s trailer + # dictionary; see Table 15) to the hash function and finish the hash. + h.update(self._document_id) + digest: bytes = h.digest() + + # d) Encrypt the 16-byte result of the hash, using an RC4 encryption function with the encryption key from step + # (a). + digest = RC4().encrypt(key, digest) + + # e) Do the following 19 times: Take the output from the previous invocation of the RC4 function and pass it as + # input to a new invocation of the function; use an encryption key generated by taking each byte of the + # original encryption key obtained in step (a) and performing an XOR (exclusive or) operation between that + # byte and the single-byte value of the iteration counter (from 1 to 19). + if self._revision >= 3: + for i in range(1, 20): + key2: bytes = bytes([b ^ i for b in key]) + digest = RC4().encrypt(key2, digest) + + # f) Append 16 bytes of arbitrary padding to the output from the final invocation of the RC4 function and store + # the 32-byte result as the value of the U entry in the encryption dictionary. + digest += bytes( + [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53] + ) + self._u = digest + + def _authenticate_user_password(self, user_password: bytes) -> bool: + """ + Algorithm 6: Authenticating the user password + """ + # a) Perform all but the last step of "Algorithm 4: Computing the encryption dictionary’s U (user password) + # value (Security handlers of revision 2)" or "Algorithm 5: Computing the encryption dictionary’s U (user + # password) value (Security handlers of revision 3 or greater)" using the supplied password string. + previous_u_value: typing.Optional[bytes] = self._u + self._compute_encryption_dictionary_u_value(user_password) + u_value: bytes = self._u + self._u = previous_u_value + + # b)If the result of step (a) is equal to the value of the encryption dictionary’s U entry (comparing on the first 16 + # bytes in the case of security handlers of revision 3 or greater), the password supplied is the correct user + # password. The key obtained in step (a) (that is, in the first step of "Algorithm 4: Computing the encryption + # dictionary’s U (user password) value (Security handlers of revision 2)" or "Algorithm 5: Computing the + # encryption dictionary’s U (user password) value (Security handlers of revision 3 or greater)") shall be used + # to decrypt the document. + return self._u == u_value + + def _authenticate_owner_password(self, owner_password: bytes) -> bool: + """ + Algorithm 7: Authenticating the owner password + """ + # a) Compute an encryption key from the supplied password string, as described in steps (a) to (d) of + # "Algorithm 3: Computing the encryption dictionary’s O (owner password) value". + + # b) (Security handlers of revision 2 only) Decrypt the value of the encryption dictionary’s O entry, using an RC4 + # encryption function with the encryption key computed in step (a). + # (Security handlers of revision 3 or greater) Do the following 20 times: Decrypt the value of the encryption + # dictionary’s O entry (first iteration) or the output from the previous iteration (all subsequent iterations), + # using an RC4 encryption function with a different encryption key at each iteration. The key shall be + # generated by taking the original key (obtained in step (a)) and performing an XOR (exclusive or) operation + # between each byte of the key and the single-byte value of the iteration counter (from 19 to 0). + + # c) The result of step (b) purports to be the user password. Authenticate this user password using "Algorithm + # 6: Authenticating the user password". If it is correct, the password supplied is the correct owner password. + + return False + + # + # static utility methods + # + + @staticmethod + def _unescape_pdf_syntax( + s: typing.Union[str, String, None] + ) -> typing.Optional[str]: + # None + if s is None: + return None + # String + if isinstance(s, String): + return str(s.get_content_bytes(), encoding="utf8") + # str + return str(String(s).get_content_bytes(), encoding="utf8") + + @staticmethod + def _str_to_bytes(s: typing.Optional[str]) -> typing.Optional[bytes]: + if s is None: + return None + return bytes(s, encoding="charmap") + + @staticmethod + def _pad_or_truncate(b: typing.Optional[bytes]) -> bytes: + # fmt: off + padding: bytes = bytes([40, 191, 78, 94, 78, 117, 138, 65, + 100, 0, 78, 86, 255, 250, 1, 8, + 46, 46, 0, 182, 208, 104, 62, 128, + 47, 12, 169, 254, 100, 83, 105, 122]) + # fmt: on + if b is None: + return padding + if len(b) > 32: + return b[0:32] + if len(b) < 32: + b2: bytes = b + padding + return b2[0:32] + return b diff --git a/borb/io/read/font/font_dictionary_transformer.py b/borb/io/read/font/font_dictionary_transformer.py index e0026726a..2463e9d30 100644 --- a/borb/io/read/font/font_dictionary_transformer.py +++ b/borb/io/read/font/font_dictionary_transformer.py @@ -106,10 +106,6 @@ def transform( assert font_obj is not None font_obj.set_parent(parent_object) # type: ignore [union-attr] - # add listener(s) - for l in event_listeners: - font_obj.add_event_listener(l) # type: ignore [union-attr] - # convert key/value pair(s) assert isinstance(object_to_transform, Dictionary) for k, v in object_to_transform.items(): diff --git a/borb/io/read/function/function_dictionary_transformer.py b/borb/io/read/function/function_dictionary_transformer.py index 1156e6823..7c8b68cfe 100644 --- a/borb/io/read/function/function_dictionary_transformer.py +++ b/borb/io/read/function/function_dictionary_transformer.py @@ -62,10 +62,6 @@ def transform( "DecodedBytes" ] - # add listener(s) - for l in event_listeners: - transformed_object.add_event_listener(l) # type: ignore [attr-defined] - # resolve references in stream dictionary assert context is not None assert context.tokenizer is not None diff --git a/borb/io/read/image/ccitt_fax_image_transformer.py b/borb/io/read/image/ccitt_fax_image_transformer.py index f511fd596..9e8683fab 100644 --- a/borb/io/read/image/ccitt_fax_image_transformer.py +++ b/borb/io/read/image/ccitt_fax_image_transformer.py @@ -9,10 +9,11 @@ import typing from typing import Any, Optional, Union +from PIL import Image # type: ignore [import] + from borb.io.read.transformer import Transformer, ReadTransformerState from borb.io.read.types import AnyPDFType, Stream, add_base_methods from borb.pdf.canvas.event.event_listener import EventListener -from PIL import Image # type: ignore [import] logger = logging.getLogger(__name__) @@ -73,9 +74,5 @@ def transform( # set parent tmp.set_parent(parent_object) - # add event listeners - for l in event_listeners: - tmp.add_event_listener(l) - # return return tmp diff --git a/borb/io/read/image/compressed_jpeg_image_transformer.py b/borb/io/read/image/compressed_jpeg_image_transformer.py index c1f7e7b2a..35e43a401 100644 --- a/borb/io/read/image/compressed_jpeg_image_transformer.py +++ b/borb/io/read/image/compressed_jpeg_image_transformer.py @@ -9,11 +9,12 @@ import typing from typing import Any, Optional, Union +from PIL import Image # type: ignore [import] + from borb.io.filter.stream_decode_util import decode_stream from borb.io.read.transformer import Transformer, ReadTransformerState from borb.io.read.types import AnyPDFType, Name, Stream, add_base_methods from borb.pdf.canvas.event.event_listener import EventListener -from PIL import Image # type: ignore [import] logger = logging.getLogger(__name__) @@ -89,9 +90,5 @@ def transform( # set parent tmp.set_parent(parent_object) - # add event listeners - for l in event_listeners: - tmp.add_event_listener(l) - # return return tmp diff --git a/borb/io/read/image/grayscale_image_transformer.py b/borb/io/read/image/grayscale_image_transformer.py index 011b3b1fb..5b5cd0bcf 100644 --- a/borb/io/read/image/grayscale_image_transformer.py +++ b/borb/io/read/image/grayscale_image_transformer.py @@ -9,11 +9,12 @@ import typing from typing import Any, Optional, Union +from PIL import Image # type: ignore [import] + from borb.io.filter.stream_decode_util import decode_stream from borb.io.read.transformer import Transformer, ReadTransformerState from borb.io.read.types import AnyPDFType, Reference, Stream, add_base_methods from borb.pdf.canvas.event.event_listener import EventListener -from PIL import Image # type: ignore [import] logger = logging.getLogger(__name__) @@ -90,9 +91,5 @@ def transform( # set parent tmp.set_parent(parent_object) - # add event listeners - for l in event_listeners: - tmp.add_event_listener(l) - # return return tmp diff --git a/borb/io/read/image/jbig2_image_transformer.py b/borb/io/read/image/jbig2_image_transformer.py index cec5fc702..f7a0f8a75 100644 --- a/borb/io/read/image/jbig2_image_transformer.py +++ b/borb/io/read/image/jbig2_image_transformer.py @@ -9,10 +9,11 @@ import typing from typing import Any, Optional, Union +from PIL import Image # type: ignore [import] + from borb.io.read.transformer import Transformer, ReadTransformerState from borb.io.read.types import AnyPDFType, Stream, add_base_methods from borb.pdf.canvas.event.event_listener import EventListener -from PIL import Image # type: ignore [import] logger = logging.getLogger(__name__) @@ -76,9 +77,5 @@ def transform( # set parent tmp.set_parent(parent_object) - # add event listeners - for l in event_listeners: - tmp.add_event_listener(l) - # return return tmp diff --git a/borb/io/read/image/jpeg_2000_image_transformer.py b/borb/io/read/image/jpeg_2000_image_transformer.py index 6de0ab85c..e87378b83 100644 --- a/borb/io/read/image/jpeg_2000_image_transformer.py +++ b/borb/io/read/image/jpeg_2000_image_transformer.py @@ -9,10 +9,11 @@ import typing from typing import Any, Optional, Union +from PIL import Image # type: ignore [import] + from borb.io.read.transformer import Transformer, ReadTransformerState from borb.io.read.types import AnyPDFType, Stream, add_base_methods from borb.pdf.canvas.event.event_listener import EventListener -from PIL import Image # type: ignore [import] logger = logging.getLogger(__name__) @@ -74,9 +75,5 @@ def transform( # set parent tmp.set_parent(parent_object) - # add event listeners - for l in event_listeners: - tmp.add_event_listener(l) - # return return tmp diff --git a/borb/io/read/image/jpeg_image_transformer.py b/borb/io/read/image/jpeg_image_transformer.py index 101a8b97e..3c78d1ffc 100644 --- a/borb/io/read/image/jpeg_image_transformer.py +++ b/borb/io/read/image/jpeg_image_transformer.py @@ -9,10 +9,11 @@ import typing from typing import Any, Optional, Union +from PIL import Image # type: ignore [import] + from borb.io.read.transformer import Transformer, ReadTransformerState from borb.io.read.types import AnyPDFType, Stream, add_base_methods from borb.pdf.canvas.event.event_listener import EventListener -from PIL import Image # type: ignore [import] logger = logging.getLogger(__name__) @@ -77,9 +78,5 @@ def transform( # set parent tmp.set_parent(parent_object) - # add event listeners - for l in event_listeners: - tmp.add_event_listener(l) - # return return tmp diff --git a/borb/io/read/object/stream_transformer.py b/borb/io/read/object/stream_transformer.py index d09fd8354..fb43942d9 100644 --- a/borb/io/read/object/stream_transformer.py +++ b/borb/io/read/object/stream_transformer.py @@ -40,10 +40,6 @@ def transform( assert isinstance(object_to_transform, Stream) object_to_transform.set_parent(parent_object) # type: ignore [attr-defined] - # add listener(s) - for l in event_listeners: - object_to_transform.add_event_listener(l) # type: ignore [attr-defined] - # resolve references in stream dictionary assert context is not None assert context.tokenizer is not None diff --git a/borb/io/read/reference/xref_transformer.py b/borb/io/read/reference/xref_transformer.py index aefb4f890..802a95af2 100644 --- a/borb/io/read/reference/xref_transformer.py +++ b/borb/io/read/reference/xref_transformer.py @@ -10,8 +10,9 @@ from decimal import Decimal from typing import Any, Optional, Union -from borb.io.read.transformer import Transformer, ReadTransformerState +from borb.io.read.encryption.standard_security_handler import StandardSecurityHandler from borb.io.read.tokenize.high_level_tokenizer import HighLevelTokenizer +from borb.io.read.transformer import Transformer, ReadTransformerState from borb.io.read.types import AnyPDFType, Dictionary, Name from borb.pdf.canvas.event.event_listener import Event, EventListener from borb.pdf.document import Document @@ -95,7 +96,36 @@ def transform( # check for password protected PDF if "Trailer" in xref and "Encrypt" in xref["Trailer"]: - # TODO + + # transform \Encrypt dictionary + # fmt: off + xref["Trailer"][Name("Encrypt")] = self.get_root_transformer().transform(xref["Trailer"]["Encrypt"], xref["Trailer"], context, event_listeners) + # fmt: on + + # build encryption handler + v: int = int(xref["Trailer"]["Encrypt"].get("V", Decimal(0))) + if v == 0: + assert False, ( + "V is 0. An algorithm that is undocumented. " + "This value shall not be used." + ) + if v == 1: + context.security_handler = StandardSecurityHandler( + xref["Trailer"]["Encrypt"], context.password + ) + if v == 2: + context.security_handler = StandardSecurityHandler( + xref["Trailer"]["Encrypt"], context.password + ) + if v == 3: + assert False, ( + "V is 3. (PDF 1.4) An unpublished algorithm that permits encryption key lengths ranging from 40 to 128 bits. " + "This value shall not appear in a conforming PDF file." + ) + if v == 4: + assert False, "V is 4. Currently unsupported encryption dictionary." + + # raise error raise NotImplementedError( "password-protected PDFs are currently not supported" ) diff --git a/borb/io/read/transformer.py b/borb/io/read/transformer.py index c46ab73fa..21d73873d 100644 --- a/borb/io/read/transformer.py +++ b/borb/io/read/transformer.py @@ -29,11 +29,14 @@ def __init__( source: Optional[Union[io.BufferedIOBase, io.RawIOBase, io.BytesIO]] = None, tokenizer: Optional[HighLevelTokenizer] = None, root_object: Optional[Any] = None, + password: typing.Optional[str] = None, ): self.source = source self.tokenizer = tokenizer self.root_object = root_object self.indirect_reference_chain: typing.Set[Reference] = set() + self.password: typing.Optional[str] = password + self.security_handler: typing.Optional[typing.Any] = None class Transformer: diff --git a/borb/io/read/types.py b/borb/io/read/types.py index 34e6b4a76..9df417801 100644 --- a/borb/io/read/types.py +++ b/borb/io/read/types.py @@ -13,10 +13,10 @@ from math import ceil, floor from typing import Optional, Union -from borb.io.read.postfix.postfix_eval import PostScriptEval -from borb.pdf.canvas.event.event_listener import EventListener from PIL.Image import Image # type: ignore [import] +from borb.io.read.postfix.postfix_eval import PostScriptEval + def add_base_methods(object: typing.Any) -> typing.Any: """ diff --git a/borb/io/write/any_object_transformer.py b/borb/io/write/any_object_transformer.py index 8c2e18f65..e2634e08d 100644 --- a/borb/io/write/any_object_transformer.py +++ b/borb/io/write/any_object_transformer.py @@ -10,6 +10,7 @@ from borb.io.read.types import AnyPDFType from borb.io.write.ascii_art.ascii_art_transformer import ASCIIArtTransformer +from borb.io.write.document.document_transformer import DocumentTransformer from borb.io.write.image.image_transformer import ImageTransformer from borb.io.write.object.array_transformer import ArrayTransformer from borb.io.write.object.dictionary_transformer import DictionaryTransformer @@ -26,7 +27,6 @@ Transformer, WriteTransformerState, ) -from borb.io.write.document.document_transformer import DocumentTransformer from borb.io.write.xmp.xmp_transformer import XMPTransformer diff --git a/borb/io/write/ascii_art/ascii_logo.txt b/borb/io/write/ascii_art/ascii_logo.txt index ba5084045..323392491 100644 --- a/borb/io/write/ascii_art/ascii_logo.txt +++ b/borb/io/write/ascii_art/ascii_logo.txt @@ -1,2 +1,2 @@ -borb version 2.0.10 +borb version 2.0.11 Joris Schellekens diff --git a/borb/io/write/image/image_transformer.py b/borb/io/write/image/image_transformer.py index 0abb9d106..4b6e40650 100644 --- a/borb/io/write/image/image_transformer.py +++ b/borb/io/write/image/image_transformer.py @@ -8,6 +8,8 @@ import typing from typing import Optional +from PIL import Image as PILImage # type: ignore [import] + from borb.io.read.types import AnyPDFType from borb.io.read.types import Decimal as pDecimal from borb.io.read.types import Name, Reference, Stream, add_base_methods @@ -15,7 +17,6 @@ Transformer, WriteTransformerState, ) -from PIL import Image as PILImage # type: ignore [import] class ImageTransformer(Transformer): diff --git a/borb/io/write/object/array_transformer.py b/borb/io/write/object/array_transformer.py index eb202ab9c..a23ba296a 100644 --- a/borb/io/write/object/array_transformer.py +++ b/borb/io/write/object/array_transformer.py @@ -8,12 +8,13 @@ import typing from typing import Optional +from PIL.Image import Image # type: ignore [import] + from borb.io.read.types import AnyPDFType, Dictionary, List, Reference, Stream from borb.io.write.transformer import ( Transformer, WriteTransformerState, ) -from PIL.Image import Image # type: ignore [import] logger = logging.getLogger(__name__) diff --git a/borb/io/write/object/dictionary_transformer.py b/borb/io/write/object/dictionary_transformer.py index efbc134d2..97f757655 100644 --- a/borb/io/write/object/dictionary_transformer.py +++ b/borb/io/write/object/dictionary_transformer.py @@ -8,12 +8,13 @@ import typing from typing import Optional +from PIL.Image import Image # type: ignore [import] + from borb.io.read.types import AnyPDFType, Dictionary, Element, List, Reference, Stream from borb.io.write.transformer import ( Transformer, WriteTransformerState, ) -from PIL.Image import Image # type: ignore [import] logger = logging.getLogger(__name__) diff --git a/borb/pdf/canvas/canvas_stream_processor.py b/borb/pdf/canvas/canvas_stream_processor.py index 69d433fa5..f48b2196d 100644 --- a/borb/pdf/canvas/canvas_stream_processor.py +++ b/borb/pdf/canvas/canvas_stream_processor.py @@ -226,8 +226,8 @@ def get_resource( def read( self, io_source: typing.Union[io.BytesIO, io.IOBase], - event_listeners: typing.List["EventListener"] = [], - ) -> "CanvasStreamProcessor": + event_listeners: typing.List["EventListener"] = [], # type: ignore [name-defined] + ) -> "CanvasStreamProcessor": # type: ignore [name-defined] """ This method reads a byte stream of canvas operators, and processes them, returning this Canvas afterwards """ diff --git a/borb/pdf/canvas/event/image_render_event.py b/borb/pdf/canvas/event/image_render_event.py index 78a0fc23d..206e1465c 100644 --- a/borb/pdf/canvas/event/image_render_event.py +++ b/borb/pdf/canvas/event/image_render_event.py @@ -6,9 +6,10 @@ """ from decimal import Decimal +from PIL import Image as PILImage # type: ignore [import] + from borb.pdf.canvas.canvas_graphics_state import CanvasGraphicsState from borb.pdf.canvas.event.event_listener import Event -from PIL import Image as PILImage # type: ignore [import] class ImageRenderEvent(Event): diff --git a/borb/pdf/canvas/font/simple_font/font_type_1.py b/borb/pdf/canvas/font/simple_font/font_type_1.py index 95cba31d6..97397c11d 100644 --- a/borb/pdf/canvas/font/simple_font/font_type_1.py +++ b/borb/pdf/canvas/font/simple_font/font_type_1.py @@ -11,6 +11,10 @@ import typing from pathlib import Path +from fontTools.afmLib import AFM # type: ignore [import] +from fontTools.agl import toUnicode # type: ignore [import] +from fontTools.cffLib import CFFFontSet, TopDict # type: ignore [import] + from borb.io.read.types import Decimal as pDecimal from borb.io.read.types import Dictionary, Name from borb.pdf.canvas.font.adobe_standard_encoding import ( @@ -20,9 +24,6 @@ from borb.pdf.canvas.font.font import Font from borb.pdf.canvas.font.simple_font.simple_font import SimpleFont from borb.pdf.canvas.font.symbol_encoding import symbol_decode, zapfdingbats_decode -from fontTools.afmLib import AFM # type: ignore [import] -from fontTools.agl import toUnicode # type: ignore [import] -from fontTools.cffLib import CFFFontSet, TopDict # type: ignore [import] logger = logging.getLogger(__name__) diff --git a/borb/pdf/canvas/font/simple_font/true_type_font.py b/borb/pdf/canvas/font/simple_font/true_type_font.py index c0b6112c2..20d7f4e50 100644 --- a/borb/pdf/canvas/font/simple_font/true_type_font.py +++ b/borb/pdf/canvas/font/simple_font/true_type_font.py @@ -11,14 +11,15 @@ from decimal import Decimal from pathlib import Path +from fontTools.agl import toUnicode # type: ignore [import] +from fontTools.pens.boundsPen import BoundsPen # type: ignore [import] +from fontTools.ttLib import TTFont # type: ignore [import] + from borb.io.read.types import Decimal as pDecimal from borb.io.read.types import Dictionary, List, Name, Stream, String from borb.pdf.canvas.font.composite_font.cid_font_type_2 import CIDType2Font from borb.pdf.canvas.font.composite_font.font_type_0 import Type0Font from borb.pdf.canvas.font.simple_font.font_type_1 import Type1Font -from fontTools.agl import toUnicode # type: ignore [import] -from fontTools.pens.boundsPen import BoundsPen # type: ignore [import] -from fontTools.ttLib import TTFont # type: ignore [import] class TrueTypeFont(Type1Font): diff --git a/borb/pdf/canvas/layout/emoji/emoji.py b/borb/pdf/canvas/layout/emoji/emoji.py index 857ac55a5..3a82489db 100644 --- a/borb/pdf/canvas/layout/emoji/emoji.py +++ b/borb/pdf/canvas/layout/emoji/emoji.py @@ -17,7 +17,6 @@ from borb.pdf.canvas.geometry.rectangle import Rectangle from borb.pdf.canvas.layout.image.image import Image -from borb.pdf.canvas.layout.layout_element import Alignment from borb.pdf.page.page import Page @@ -77,6 +76,7 @@ def _do_layout_without_padding( # determine leading leading: Decimal = Decimal(0) + assert self._font_size is not None assert self._multiplied_leading is not None or self._fixed_leading is not None if self._multiplied_leading is not None: leading = self._font_size * (self._multiplied_leading - Decimal(1)) diff --git a/borb/pdf/canvas/layout/forms/check_box.py b/borb/pdf/canvas/layout/forms/check_box.py index 74f261ced..4bda08590 100644 --- a/borb/pdf/canvas/layout/forms/check_box.py +++ b/borb/pdf/canvas/layout/forms/check_box.py @@ -5,10 +5,10 @@ This implementation of FormField represents a text field. """ import copy -import zlib - import typing +import zlib +from borb.io.read.types import Decimal as bDecimal from borb.io.read.types import ( Dictionary, Name, @@ -18,7 +18,6 @@ Stream, Boolean, ) -from borb.io.read.types import Decimal as bDecimal from borb.pdf.canvas.color.color import Color, HexColor, RGBColor from borb.pdf.canvas.font.simple_font.font_type_1 import StandardType1Font from borb.pdf.canvas.geometry.rectangle import Rectangle diff --git a/borb/pdf/canvas/layout/forms/drop_down_list.py b/borb/pdf/canvas/layout/forms/drop_down_list.py index d14ef25b0..51ba76453 100644 --- a/borb/pdf/canvas/layout/forms/drop_down_list.py +++ b/borb/pdf/canvas/layout/forms/drop_down_list.py @@ -4,10 +4,10 @@ """ This implementation of FormField represents a drop down list. """ -import zlib - import typing +import zlib +from borb.io.read.types import Decimal as bDecimal from borb.io.read.types import ( Dictionary, Name, @@ -17,7 +17,6 @@ Stream, Boolean, ) -from borb.io.read.types import Decimal as bDecimal from borb.pdf.canvas.color.color import Color, HexColor, RGBColor from borb.pdf.canvas.font.simple_font.font_type_1 import StandardType1Font from borb.pdf.canvas.geometry.rectangle import Rectangle diff --git a/borb/pdf/canvas/layout/forms/text_area.py b/borb/pdf/canvas/layout/forms/text_area.py index f05596051..6d4b6e81b 100644 --- a/borb/pdf/canvas/layout/forms/text_area.py +++ b/borb/pdf/canvas/layout/forms/text_area.py @@ -4,10 +4,10 @@ """ This implementation of FormField represents a text area. """ -import zlib - import typing +import zlib +from borb.io.read.types import Decimal as bDecimal from borb.io.read.types import ( Dictionary, Name, @@ -17,7 +17,6 @@ Stream, Boolean, ) -from borb.io.read.types import Decimal as bDecimal from borb.pdf.canvas.color.color import Color, HexColor, RGBColor from borb.pdf.canvas.font.simple_font.font_type_1 import StandardType1Font from borb.pdf.canvas.geometry.rectangle import Rectangle diff --git a/borb/pdf/canvas/layout/forms/text_field.py b/borb/pdf/canvas/layout/forms/text_field.py index 80ea9b464..71abe19a8 100644 --- a/borb/pdf/canvas/layout/forms/text_field.py +++ b/borb/pdf/canvas/layout/forms/text_field.py @@ -4,10 +4,10 @@ """ This implementation of FormField represents a text field. """ -import zlib - import typing +import zlib +from borb.io.read.types import Decimal as bDecimal from borb.io.read.types import ( Dictionary, Name, @@ -17,7 +17,6 @@ Stream, Boolean, ) -from borb.io.read.types import Decimal as bDecimal from borb.pdf.canvas.color.color import Color, HexColor, RGBColor from borb.pdf.canvas.font.simple_font.font_type_1 import StandardType1Font from borb.pdf.canvas.geometry.rectangle import Rectangle diff --git a/borb/pdf/canvas/layout/free_space_finder.py b/borb/pdf/canvas/layout/free_space_finder.py index 2a030f729..e73a273ca 100644 --- a/borb/pdf/canvas/layout/free_space_finder.py +++ b/borb/pdf/canvas/layout/free_space_finder.py @@ -9,7 +9,6 @@ from math import ceil from pathlib import Path - from borb.pdf.canvas.event.begin_page_event import BeginPageEvent from borb.pdf.canvas.event.chunk_of_text_render_event import ChunkOfTextRenderEvent from borb.pdf.canvas.event.event_listener import Event, EventListener diff --git a/borb/pdf/canvas/layout/image/barcode.py b/borb/pdf/canvas/layout/image/barcode.py index 918e4bc9f..8e625e5ed 100644 --- a/borb/pdf/canvas/layout/image/barcode.py +++ b/borb/pdf/canvas/layout/image/barcode.py @@ -10,11 +10,12 @@ import barcode # type: ignore [import] import qrcode # type: ignore [import] +from PIL import Image as PILImage # type: ignore [import] from barcode.writer import ImageWriter as BarcodeImageWriter # type: ignore [import] -from borb.pdf.canvas.color.color import Color, HexColor, X11Color + +from borb.pdf.canvas.color.color import Color, HexColor from borb.pdf.canvas.layout.image.image import Image from borb.pdf.canvas.layout.layout_element import Alignment -from PIL import Image as PILImage # type: ignore [import] class BarcodeType(Enum): diff --git a/borb/pdf/canvas/layout/image/chart.py b/borb/pdf/canvas/layout/image/chart.py index 8f4cca052..2765ad1c4 100644 --- a/borb/pdf/canvas/layout/image/chart.py +++ b/borb/pdf/canvas/layout/image/chart.py @@ -10,9 +10,10 @@ from typing import Optional import matplotlib.pyplot as MatPlotLibPlot # type: ignore [import] +from PIL import Image as PILImage # type: ignore [import] + from borb.pdf.canvas.layout.image.image import Image from borb.pdf.canvas.layout.layout_element import Alignment -from PIL import Image as PILImage # type: ignore [import] class Chart(Image): diff --git a/borb/pdf/canvas/layout/image/image.py b/borb/pdf/canvas/layout/image/image.py index 8e01f77ac..2e83b6902 100644 --- a/borb/pdf/canvas/layout/image/image.py +++ b/borb/pdf/canvas/layout/image/image.py @@ -10,11 +10,12 @@ from typing import Optional import requests +from PIL import Image as PILImage # type: ignore [import] + from borb.io.read.types import Dictionary, Name, add_base_methods from borb.pdf.canvas.geometry.rectangle import Rectangle from borb.pdf.canvas.layout.layout_element import Alignment, LayoutElement from borb.pdf.page.page import Page -from PIL import Image as PILImage # type: ignore [import] class Image(LayoutElement): diff --git a/borb/pdf/canvas/layout/layout_element.py b/borb/pdf/canvas/layout/layout_element.py index b53717131..237cc665d 100644 --- a/borb/pdf/canvas/layout/layout_element.py +++ b/borb/pdf/canvas/layout/layout_element.py @@ -12,7 +12,7 @@ from borb.io.read.types import Decimal as pDecimal from borb.io.read.types import Name, Stream -from borb.pdf.canvas.color.color import Color, HexColor, X11Color +from borb.pdf.canvas.color.color import Color, HexColor from borb.pdf.canvas.geometry.rectangle import Rectangle diff --git a/borb/pdf/canvas/layout/list/ordered_list.py b/borb/pdf/canvas/layout/list/ordered_list.py index 04ae25c20..007bb4611 100644 --- a/borb/pdf/canvas/layout/list/ordered_list.py +++ b/borb/pdf/canvas/layout/list/ordered_list.py @@ -8,11 +8,9 @@ from decimal import Decimal from borb.pdf.canvas.color.color import Color, HexColor, X11Color -from borb.pdf.canvas.geometry.rectangle import Rectangle from borb.pdf.canvas.layout.layout_element import LayoutElement from borb.pdf.canvas.layout.list.list import List from borb.pdf.canvas.layout.text.chunk_of_text import ChunkOfText -from borb.pdf.page.page import Page class OrderedList(List): diff --git a/borb/pdf/canvas/layout/list/roman_list.py b/borb/pdf/canvas/layout/list/roman_list.py index 87061d6d3..dc7efda4c 100644 --- a/borb/pdf/canvas/layout/list/roman_list.py +++ b/borb/pdf/canvas/layout/list/roman_list.py @@ -5,14 +5,11 @@ This implementation of LayoutElement represents an ordered (that is to say numbered) list. For this list, roman numerals are used. """ -from decimal import Decimal from borb.pdf.canvas.color.color import X11Color -from borb.pdf.canvas.geometry.rectangle import Rectangle from borb.pdf.canvas.layout.layout_element import LayoutElement from borb.pdf.canvas.layout.list.ordered_list import OrderedList from borb.pdf.canvas.layout.text.chunk_of_text import ChunkOfText -from borb.pdf.page.page import Page class RomanNumeralOrderedList(OrderedList): diff --git a/borb/pdf/canvas/layout/list/unordered_list.py b/borb/pdf/canvas/layout/list/unordered_list.py index 2305787a4..59cfac886 100644 --- a/borb/pdf/canvas/layout/list/unordered_list.py +++ b/borb/pdf/canvas/layout/list/unordered_list.py @@ -8,11 +8,9 @@ from decimal import Decimal from borb.pdf.canvas.color.color import Color, HexColor, X11Color -from borb.pdf.canvas.geometry.rectangle import Rectangle from borb.pdf.canvas.layout.layout_element import LayoutElement from borb.pdf.canvas.layout.list.list import List from borb.pdf.canvas.layout.text.chunk_of_text import ChunkOfText -from borb.pdf.page.page import Page class UnorderedList(List): diff --git a/borb/pdf/canvas/layout/page_layout/browser_layout.py b/borb/pdf/canvas/layout/page_layout/browser_layout.py index c0979400e..cf6cbd1d5 100644 --- a/borb/pdf/canvas/layout/page_layout/browser_layout.py +++ b/borb/pdf/canvas/layout/page_layout/browser_layout.py @@ -19,7 +19,6 @@ from borb.pdf.canvas.layout.page_layout.page_layout import PageLayout from borb.pdf.canvas.layout.table.table import Table from borb.pdf.canvas.layout.text.chunk_of_text import ChunkOfText -from borb.pdf.canvas.layout.text.chunks_of_text import HeterogeneousParagraph from borb.pdf.canvas.layout.text.heading import Heading from borb.pdf.canvas.layout.text.paragraph import Paragraph from borb.pdf.document import Document diff --git a/borb/pdf/canvas/layout/table/fixed_column_width_table.py b/borb/pdf/canvas/layout/table/fixed_column_width_table.py index f6d422d7d..744fe7b05 100644 --- a/borb/pdf/canvas/layout/table/fixed_column_width_table.py +++ b/borb/pdf/canvas/layout/table/fixed_column_width_table.py @@ -10,7 +10,7 @@ from math import floor from borb.io.read.types import Name -from borb.pdf.canvas.color.color import Color, HexColor, X11Color +from borb.pdf.canvas.color.color import Color, HexColor from borb.pdf.canvas.geometry.rectangle import Rectangle from borb.pdf.canvas.layout.layout_element import Alignment from borb.pdf.canvas.layout.table.table import Table diff --git a/borb/pdf/canvas/layout/table/flexible_column_width_table.py b/borb/pdf/canvas/layout/table/flexible_column_width_table.py index d8caafd08..0749e0d56 100644 --- a/borb/pdf/canvas/layout/table/flexible_column_width_table.py +++ b/borb/pdf/canvas/layout/table/flexible_column_width_table.py @@ -9,10 +9,10 @@ import typing import zlib from decimal import Decimal -from math import ceil, floor +from math import floor from borb.io.read.types import Name -from borb.pdf.canvas.color.color import Color, HexColor, X11Color +from borb.pdf.canvas.color.color import Color, HexColor from borb.pdf.canvas.geometry.rectangle import Rectangle from borb.pdf.canvas.layout.layout_element import Alignment from borb.pdf.canvas.layout.table.table import Table, TableCell diff --git a/borb/pdf/canvas/layout/table/table.py b/borb/pdf/canvas/layout/table/table.py index 1a84de82e..14eeea5c2 100644 --- a/borb/pdf/canvas/layout/table/table.py +++ b/borb/pdf/canvas/layout/table/table.py @@ -9,7 +9,7 @@ from decimal import Decimal from math import ceil -from borb.pdf.canvas.color.color import Color, HexColor, X11Color +from borb.pdf.canvas.color.color import Color, HexColor from borb.pdf.canvas.geometry.rectangle import Rectangle from borb.pdf.canvas.layout.layout_element import Alignment, LayoutElement from borb.pdf.page.page import Page diff --git a/borb/pdf/canvas/layout/text/chunks_of_text.py b/borb/pdf/canvas/layout/text/chunks_of_text.py index dfea5f5ff..295ed7df5 100644 --- a/borb/pdf/canvas/layout/text/chunks_of_text.py +++ b/borb/pdf/canvas/layout/text/chunks_of_text.py @@ -50,7 +50,8 @@ def __init__( margin_right: typing.Optional[Decimal] = None, margin_bottom: typing.Optional[Decimal] = None, margin_left: typing.Optional[Decimal] = None, - line_height: Decimal = Decimal(1), + fixed_leading: typing.Optional[Decimal] = None, + multiplied_leading: typing.Optional[Decimal] = None, background_color: typing.Optional[Color] = None, parent: typing.Optional["LayoutElement"] = None, # type: ignore [name-defined] ): @@ -84,8 +85,10 @@ def __init__( # leading self._font_size: typing.Optional[Decimal] = None - assert line_height >= Decimal(1) - self._line_height: Decimal = line_height + if fixed_leading is None and multiplied_leading is None: + multiplied_leading = Decimal(1.2) + self._fixed_leading: typing.Optional[Decimal] = fixed_leading + self._multiplied_leading: typing.Optional[Decimal] = multiplied_leading # store chunks self._chunks_of_text: typing.List[ChunkOfText] = [] @@ -208,11 +211,18 @@ def _do_layout_without_padding(self, page: Page, bounding_box: Rectangle): max_x = max(r.x + r.width, max_x) max_y = max(r.y + r.height, max_y) - # update line_y - line_y -= ( - max([x.get_bounding_box().get_height() for x in line_of_chunks]) # type: ignore [union-attr] - * self._line_height + # line height + max_height: Decimal = max( + [x.get_bounding_box().get_height() for x in line_of_chunks] ) + line_height: Decimal = max_height + if self._fixed_leading is not None: + line_height += self._fixed_leading + if self._multiplied_leading is not None: + line_height *= self._multiplied_leading + + # update line_y + line_y -= line_height layout_rect = Rectangle(min_x, min_y, max_x - min_x, max_y - min_y) @@ -249,7 +259,8 @@ def __init__( margin_right: typing.Optional[Decimal] = None, margin_bottom: typing.Optional[Decimal] = None, margin_left: typing.Optional[Decimal] = None, - line_height: Decimal = Decimal(1), + fixed_leading: typing.Optional[Decimal] = None, + multiplied_leading: typing.Optional[Decimal] = None, background_color: typing.Optional[Color] = None, parent: typing.Optional["LayoutElement"] = None, # type: ignore [name-defined] ): @@ -271,7 +282,8 @@ def __init__( margin_right=margin_right, margin_bottom=margin_bottom, margin_left=margin_left, - line_height=line_height, + fixed_leading=fixed_leading, + multiplied_leading=multiplied_leading, background_color=background_color, parent=parent, ) diff --git a/borb/pdf/canvas/layout/text/line_of_text.py b/borb/pdf/canvas/layout/text/line_of_text.py index af3459a2c..d0d08a3f4 100644 --- a/borb/pdf/canvas/layout/text/line_of_text.py +++ b/borb/pdf/canvas/layout/text/line_of_text.py @@ -19,7 +19,7 @@ import typing from decimal import Decimal -from borb.pdf.canvas.color.color import Color, HexColor, X11Color +from borb.pdf.canvas.color.color import Color, HexColor from borb.pdf.canvas.font.font import Font from borb.pdf.canvas.layout.layout_element import Alignment from borb.pdf.canvas.layout.text.chunk_of_text import ChunkOfText diff --git a/borb/pdf/canvas/operator/canvas_operator.py b/borb/pdf/canvas/operator/canvas_operator.py index ff567595f..1ee894721 100644 --- a/borb/pdf/canvas/operator/canvas_operator.py +++ b/borb/pdf/canvas/operator/canvas_operator.py @@ -8,7 +8,6 @@ setting the active color and so on """ import typing -from typing import List from borb.io.read.types import AnyPDFType @@ -39,10 +38,10 @@ def get_number_of_operands(self) -> int: def invoke( self, - canvas_stream_processor: "CanvasStreamProcessor", + canvas_stream_processor: "CanvasStreamProcessor", # type: ignore [name-defined] operands: typing.List[AnyPDFType] = [], - event_listeners: typing.List["EventListener"] = [], - ) -> None: # type: ignore [name-defined] + event_listeners: typing.List["EventListener"] = [], # type: ignore [name-defined] + ) -> None: """ Invokes this CanvasOperator """ diff --git a/borb/pdf/canvas/operator/color/set_cmyk_non_stroking.py b/borb/pdf/canvas/operator/color/set_cmyk_non_stroking.py index 3bd6175ce..815e63a95 100644 --- a/borb/pdf/canvas/operator/color/set_cmyk_non_stroking.py +++ b/borb/pdf/canvas/operator/color/set_cmyk_non_stroking.py @@ -4,10 +4,8 @@ """ Same as K but used for nonstroking operations. """ -from decimal import Decimal -from typing import List - import typing +from decimal import Decimal from borb.io.read.types import AnyPDFType from borb.pdf.canvas.color.color import CMYKColor @@ -24,10 +22,10 @@ def __init__(self): def invoke( self, - canvas_stream_processor: "CanvasStreamProcessor", + canvas_stream_processor: "CanvasStreamProcessor", # type: ignore [name-defined] operands: typing.List[AnyPDFType] = [], - event_listeners: typing.List["EventListener"] = [], - ) -> None: # type: ignore [name-defined] + event_listeners: typing.List["EventListener"] = [], # type: ignore [name-defined] + ) -> None: """ Invoke the k operator """ diff --git a/borb/pdf/canvas/operator/color/set_cmyk_stroking.py b/borb/pdf/canvas/operator/color/set_cmyk_stroking.py index 672b246a4..d6524fe53 100644 --- a/borb/pdf/canvas/operator/color/set_cmyk_stroking.py +++ b/borb/pdf/canvas/operator/color/set_cmyk_stroking.py @@ -9,10 +9,8 @@ this operator is affected by the overprint mode (see 8.6.7, "Overprint Control"). """ -from decimal import Decimal -from typing import List - import typing +from decimal import Decimal from borb.io.read.types import AnyPDFType from borb.pdf.canvas.color.color import CMYKColor @@ -34,10 +32,10 @@ def __init__(self): def invoke( self, - canvas_stream_processor: "CanvasStreamProcessor", + canvas_stream_processor: "CanvasStreamProcessor", # type: ignore [name-defined] operands: typing.List[AnyPDFType] = [], - event_listeners: typing.List["EventListener"] = [], - ) -> None: # type: ignore [name-defined] + event_listeners: typing.List["EventListener"] = [], # type: ignore [name-defined] + ) -> None: """ Invoke the K operator """ diff --git a/borb/pdf/canvas/operator/color/set_color_non_stroking.py b/borb/pdf/canvas/operator/color/set_color_non_stroking.py index b3c0653bc..98c551085 100644 --- a/borb/pdf/canvas/operator/color/set_color_non_stroking.py +++ b/borb/pdf/canvas/operator/color/set_color_non_stroking.py @@ -4,11 +4,10 @@ """ (PDF 1.2) Same as SCN but used for nonstroking operations. """ +import typing from decimal import Decimal from typing import List -import typing - from borb.io.read.types import AnyPDFType from borb.pdf.canvas.color.color import CMYKColor, GrayColor, RGBColor, Separation from borb.pdf.canvas.operator.canvas_operator import CanvasOperator @@ -46,10 +45,10 @@ def get_number_of_operands(self) -> int: def invoke( self, - canvas_stream_processor: "CanvasStreamProcessor", + canvas_stream_processor: "CanvasStreamProcessor", # type: ignore [name-defined] operands: typing.List[AnyPDFType] = [], - event_listeners: typing.List["EventListener"] = [], - ) -> None: # type: ignore [name-defined] + event_listeners: typing.List["EventListener"] = [], # type: ignore [name-defined] + ) -> None: """ Invoke the scn operator """ diff --git a/borb/pdf/canvas/operator/color/set_color_space_non_stroking.py b/borb/pdf/canvas/operator/color/set_color_space_non_stroking.py index 53c5261fb..c62eb457e 100644 --- a/borb/pdf/canvas/operator/color/set_color_space_non_stroking.py +++ b/borb/pdf/canvas/operator/color/set_color_space_non_stroking.py @@ -4,11 +4,10 @@ """ (PDF 1.1) Same as CS but used for nonstroking operations. """ +import typing from decimal import Decimal from typing import List -import typing - from borb.io.read.types import AnyPDFType, Name from borb.pdf.canvas.color.color import CMYKColor, GrayColor, RGBColor, Separation from borb.pdf.canvas.operator.canvas_operator import CanvasOperator @@ -24,10 +23,10 @@ def __init__(self): def invoke( self, - canvas_stream_processor: "CanvasStreamProcessor", + canvas_stream_processor: "CanvasStreamProcessor", # type: ignore [name-defined] operands: typing.List[AnyPDFType] = [], - event_listeners: typing.List["EventListener"] = [], - ) -> None: # type: ignore [name-defined] + event_listeners: typing.List["EventListener"] = [], # type: ignore [name-defined] + ) -> None: """ Invoke the cs operator """ diff --git a/borb/pdf/canvas/operator/color/set_color_space_stroking.py b/borb/pdf/canvas/operator/color/set_color_space_stroking.py index 1d4fcfe7a..58f8e1dab 100644 --- a/borb/pdf/canvas/operator/color/set_color_space_stroking.py +++ b/borb/pdf/canvas/operator/color/set_color_space_stroking.py @@ -34,11 +34,10 @@ causes nothing to be painted. """ import logging +import typing from decimal import Decimal from typing import List -import typing - from borb.io.read.types import AnyPDFType, Name from borb.pdf.canvas.color.color import CMYKColor, GrayColor, RGBColor, Separation from borb.pdf.canvas.operator.canvas_operator import CanvasOperator @@ -84,10 +83,10 @@ def __init__(self): def invoke( self, - canvas_stream_processor: "CanvasStreamProcessor", + canvas_stream_processor: "CanvasStreamProcessor", # type: ignore [name-defined] operands: typing.List[AnyPDFType] = [], - event_listeners: typing.List["EventListener"] = [], - ) -> None: # type: ignore [name-defined] + event_listeners: typing.List["EventListener"] = [], # type: ignore [name-defined] + ) -> None: """ Invoke the CS operator """ diff --git a/borb/pdf/canvas/operator/color/set_color_stroking.py b/borb/pdf/canvas/operator/color/set_color_stroking.py index 8695df8a4..e59bf6f3a 100644 --- a/borb/pdf/canvas/operator/color/set_color_stroking.py +++ b/borb/pdf/canvas/operator/color/set_color_stroking.py @@ -5,11 +5,10 @@ (PDF 1.2) Same as SC but also supports Pattern, Separation, DeviceN and ICCBased colour spaces. """ +import typing from decimal import Decimal from typing import List -import typing - from borb.io.read.types import AnyPDFType from borb.pdf.canvas.color.color import CMYKColor, GrayColor, RGBColor, Separation from borb.pdf.canvas.operator.canvas_operator import CanvasOperator @@ -58,10 +57,10 @@ def get_number_of_operands(self) -> int: def invoke( self, - canvas_stream_processor: "CanvasStreamProcessor", + canvas_stream_processor: "CanvasStreamProcessor", # type: ignore [name-defined] operands: typing.List[AnyPDFType] = [], - event_listeners: typing.List["EventListener"] = [], - ) -> None: # type: ignore [name-defined] + event_listeners: typing.List["EventListener"] = [], # type: ignore [name-defined] + ) -> None: """ Invoke the SCN operator """ diff --git a/borb/pdf/canvas/operator/color/set_gray_non_stroking.py b/borb/pdf/canvas/operator/color/set_gray_non_stroking.py index 3f45915a9..7add6c8bb 100644 --- a/borb/pdf/canvas/operator/color/set_gray_non_stroking.py +++ b/borb/pdf/canvas/operator/color/set_gray_non_stroking.py @@ -4,10 +4,8 @@ """ Same as G but used for nonstroking operations. """ -from decimal import Decimal -from typing import List - import typing +from decimal import Decimal from borb.io.read.types import AnyPDFType from borb.pdf.canvas.color.color import GrayColor @@ -24,10 +22,10 @@ def __init__(self): def invoke( self, - canvas_stream_processor: "CanvasStreamProcessor", + canvas_stream_processor: "CanvasStreamProcessor", # type: ignore [name-defined] operands: typing.List[AnyPDFType] = [], - event_listeners: typing.List["EventListener"] = [], - ) -> None: # type: ignore [name-defined] + event_listeners: typing.List["EventListener"] = [], # type: ignore [name-defined] + ) -> None: """ Invoke the g operator """ diff --git a/borb/pdf/canvas/operator/color/set_gray_stroking.py b/borb/pdf/canvas/operator/color/set_gray_stroking.py index e619f193b..d0c25d5b4 100644 --- a/borb/pdf/canvas/operator/color/set_gray_stroking.py +++ b/borb/pdf/canvas/operator/color/set_gray_stroking.py @@ -7,10 +7,8 @@ for stroking operations. gray shall be a number between 0.0 (black) and 1.0 (white). """ -from decimal import Decimal -from typing import List - import typing +from decimal import Decimal from borb.io.read.types import AnyPDFType from borb.pdf.canvas.color.color import GrayColor @@ -30,10 +28,10 @@ def __init__(self): def invoke( self, - canvas_stream_processor: "CanvasStreamProcessor", + canvas_stream_processor: "CanvasStreamProcessor", # type: ignore [name-defined] operands: typing.List[AnyPDFType] = [], - event_listeners: typing.List["EventListener"] = [], - ) -> None: # type: ignore [name-defined] + event_listeners: typing.List["EventListener"] = [], # type: ignore [name-defined] + ) -> None: """ Invoke the G operator """ diff --git a/borb/pdf/canvas/operator/color/set_rgb_non_stroking.py b/borb/pdf/canvas/operator/color/set_rgb_non_stroking.py index 57396be04..d3a27a48d 100644 --- a/borb/pdf/canvas/operator/color/set_rgb_non_stroking.py +++ b/borb/pdf/canvas/operator/color/set_rgb_non_stroking.py @@ -4,10 +4,8 @@ """ Same as RG but used for nonstroking operations. """ -from decimal import Decimal -from typing import List - import typing +from decimal import Decimal from borb.io.read.types import AnyPDFType from borb.pdf.canvas.color.color import RGBColor @@ -24,10 +22,10 @@ def __init__(self): def invoke( self, - canvas_stream_processor: "CanvasStreamProcessor", + canvas_stream_processor: "CanvasStreamProcessor", # type: ignore [name-defined] operands: typing.List[AnyPDFType] = [], - event_listeners: typing.List["EventListener"] = [], - ) -> None: # type: ignore [name-defined] + event_listeners: typing.List["EventListener"] = [], # type: ignore [name-defined] + ) -> None: """ Invoke the rg operator """ diff --git a/borb/pdf/canvas/operator/color/set_rgb_stroking.py b/borb/pdf/canvas/operator/color/set_rgb_stroking.py index 2ca9ea400..1fa3ceb39 100644 --- a/borb/pdf/canvas/operator/color/set_rgb_stroking.py +++ b/borb/pdf/canvas/operator/color/set_rgb_stroking.py @@ -7,10 +7,8 @@ stroking operations. Each operand shall be a number between 0.0 (minimum intensity) and 1.0 (maximum intensity). """ -from decimal import Decimal -from typing import List - import typing +from decimal import Decimal from borb.io.read.types import AnyPDFType from borb.pdf.canvas.color.color import RGBColor @@ -30,10 +28,10 @@ def __init__(self): def invoke( self, - canvas_stream_processor: "CanvasStreamProcessor", + canvas_stream_processor: "CanvasStreamProcessor", # type: ignore [name-defined] operands: typing.List[AnyPDFType] = [], - event_listeners: typing.List["EventListener"] = [], - ) -> None: # type: ignore [name-defined] + event_listeners: typing.List["EventListener"] = [], # type: ignore [name-defined] + ) -> None: """ Invoke the RG operator """ diff --git a/borb/pdf/canvas/operator/compatibility/begin_compatibility_section.py b/borb/pdf/canvas/operator/compatibility/begin_compatibility_section.py index e72f75eb2..d538b844d 100644 --- a/borb/pdf/canvas/operator/compatibility/begin_compatibility_section.py +++ b/borb/pdf/canvas/operator/compatibility/begin_compatibility_section.py @@ -7,8 +7,6 @@ is encountered. """ -from typing import List - import typing from borb.io.read.types import AnyPDFType @@ -27,10 +25,10 @@ def __init__(self): def invoke( self, - canvas_stream_processor: "CanvasStreamProcessor", + canvas_stream_processor: "CanvasStreamProcessor", # type: ignore [name-defined] operands: typing.List[AnyPDFType] = [], - event_listeners: typing.List["EventListener"] = [], - ) -> None: # type: ignore [name-defined] + event_listeners: typing.List["EventListener"] = [], # type: ignore [name-defined] + ) -> None: """ Invoke the BX operator """ diff --git a/borb/pdf/canvas/operator/compatibility/end_compatibility_section.py b/borb/pdf/canvas/operator/compatibility/end_compatibility_section.py index eafc44d5f..94debfdfd 100644 --- a/borb/pdf/canvas/operator/compatibility/end_compatibility_section.py +++ b/borb/pdf/canvas/operator/compatibility/end_compatibility_section.py @@ -6,7 +6,6 @@ their operands) shall be ignored without error until the balancing EX operator is encountered. """ -from typing import List import typing @@ -26,10 +25,10 @@ def __init__(self): def invoke( self, - canvas_stream_processor: "CanvasStreamProcessor", + canvas_stream_processor: "CanvasStreamProcessor", # type: ignore [name-defined] operands: typing.List[AnyPDFType] = [], - event_listeners: typing.List["EventListener"] = [], - ) -> None: # type: ignore [name-defined] + event_listeners: typing.List["EventListener"] = [], # type: ignore [name-defined] + ) -> None: """ Invoke the EX operator """ diff --git a/borb/pdf/canvas/operator/marked_content/begin_marked_content.py b/borb/pdf/canvas/operator/marked_content/begin_marked_content.py index b6446bb39..671a05954 100644 --- a/borb/pdf/canvas/operator/marked_content/begin_marked_content.py +++ b/borb/pdf/canvas/operator/marked_content/begin_marked_content.py @@ -6,7 +6,6 @@ operator. tag shall be a name object indicating the role or significance of the sequence. """ -from typing import List import typing @@ -26,10 +25,10 @@ def __init__(self): def invoke( self, - canvas_stream_processor: "CanvasStreamProcessor", + canvas_stream_processor: "CanvasStreamProcessor", # type: ignore [name-defined] operands: typing.List[AnyPDFType] = [], - event_listeners: typing.List["EventListener"] = [], - ) -> None: # type: ignore [name-defined] + event_listeners: typing.List["EventListener"] = [], # type: ignore [name-defined] + ) -> None: """ Invoke the BMC operator """ diff --git a/borb/pdf/canvas/operator/marked_content/begin_marked_content_with_property_list.py b/borb/pdf/canvas/operator/marked_content/begin_marked_content_with_property_list.py index 42deb4087..0dae9215b 100644 --- a/borb/pdf/canvas/operator/marked_content/begin_marked_content_with_property_list.py +++ b/borb/pdf/canvas/operator/marked_content/begin_marked_content_with_property_list.py @@ -10,8 +10,6 @@ dictionary (see 14.6.2, “Property Lists”). """ -from typing import List - import typing from borb.io.read.types import AnyPDFType, Name @@ -33,10 +31,10 @@ def __init__(self): def invoke( self, - canvas_stream_processor: "CanvasStreamProcessor", + canvas_stream_processor: "CanvasStreamProcessor", # type: ignore [name-defined] operands: typing.List[AnyPDFType] = [], - event_listeners: typing.List["EventListener"] = [], - ) -> None: # type: ignore [name-defined] + event_listeners: typing.List["EventListener"] = [], # type: ignore [name-defined] + ) -> None: """ Invoke the BDC operator """ diff --git a/borb/pdf/canvas/operator/marked_content/end_marked_content.py b/borb/pdf/canvas/operator/marked_content/end_marked_content.py index 6577112e5..606ea7c7b 100644 --- a/borb/pdf/canvas/operator/marked_content/end_marked_content.py +++ b/borb/pdf/canvas/operator/marked_content/end_marked_content.py @@ -4,7 +4,6 @@ """ End a marked-content sequence begun by a BMC or BDC operator. """ -from typing import List import typing @@ -22,10 +21,10 @@ def __init__(self): def invoke( self, - canvas_stream_processor: "CanvasStreamProcessor", + canvas_stream_processor: "CanvasStreamProcessor", # type: ignore [name-defined] operands: typing.List[AnyPDFType] = [], - event_listeners: typing.List["EventListener"] = [], - ) -> None: # type: ignore [name-defined] + event_listeners: typing.List["EventListener"] = [], # type: ignore [name-defined] + ) -> None: """ Invoke the EMC operator """ diff --git a/borb/pdf/canvas/operator/path_construction/append_cubic_bezier.py b/borb/pdf/canvas/operator/path_construction/append_cubic_bezier.py index ec0791af9..657bf3e4c 100644 --- a/borb/pdf/canvas/operator/path_construction/append_cubic_bezier.py +++ b/borb/pdf/canvas/operator/path_construction/append_cubic_bezier.py @@ -12,7 +12,6 @@ import typing from decimal import Decimal -from typing import List from borb.io.read.types import AnyPDFType from borb.pdf.canvas.geometry.line_segment import LineSegment @@ -62,10 +61,10 @@ def __init__(self): def invoke( self, - canvas_stream_processor: "CanvasStreamProcessor", + canvas_stream_processor: "CanvasStreamProcessor", # type: ignore [name-defined] operands: typing.List[AnyPDFType] = [], - event_listeners: typing.List["EventListener"] = [], - ) -> None: # type: ignore [name-defined] + event_listeners: typing.List["EventListener"] = [], # type: ignore [name-defined] + ) -> None: """ Invokes the c operator """ @@ -120,10 +119,10 @@ def __init__(self): def invoke( self, - canvas_stream_processor: "CanvasStreamProcessor", + canvas_stream_processor: "CanvasStreamProcessor", # type: ignore [name-defined] operands: typing.List[AnyPDFType] = [], - event_listeners: typing.List["EventListener"] = [], - ) -> None: # type: ignore [name-defined] + event_listeners: typing.List["EventListener"] = [], # type: ignore [name-defined] + ) -> None: """ Invokes the v operator """ @@ -171,10 +170,10 @@ def __init__(self): def invoke( self, - canvas_stream_processor: "CanvasStreamProcessor", + canvas_stream_processor: "CanvasStreamProcessor", # type: ignore [name-defined] operands: typing.List[AnyPDFType] = [], - event_listeners: typing.List["EventListener"] = [], - ) -> None: # type: ignore [name-defined] + event_listeners: typing.List["EventListener"] = [], # type: ignore [name-defined] + ) -> None: """ Invokes the y operator """ diff --git a/borb/pdf/canvas/operator/path_construction/append_line_segment.py b/borb/pdf/canvas/operator/path_construction/append_line_segment.py index 2110f1731..b1799ad2f 100644 --- a/borb/pdf/canvas/operator/path_construction/append_line_segment.py +++ b/borb/pdf/canvas/operator/path_construction/append_line_segment.py @@ -6,10 +6,8 @@ point (x, y). The new current point shall be (x, y). """ -from decimal import Decimal -from typing import List - import typing +from decimal import Decimal from borb.io.read.types import AnyPDFType from borb.pdf.canvas.geometry.line_segment import LineSegment @@ -27,10 +25,10 @@ def __init__(self): def invoke( self, - canvas_stream_processor: "CanvasStreamProcessor", + canvas_stream_processor: "CanvasStreamProcessor", # type: ignore [name-defined] operands: typing.List[AnyPDFType] = [], - event_listeners: typing.List["EventListener"] = [], - ) -> None: # type: ignore [name-defined] + event_listeners: typing.List["EventListener"] = [], # type: ignore [name-defined] + ) -> None: """ Invokes the l operator """ diff --git a/borb/pdf/canvas/operator/path_construction/append_rectangle.py b/borb/pdf/canvas/operator/path_construction/append_rectangle.py index 3e664dd05..bb50469c9 100644 --- a/borb/pdf/canvas/operator/path_construction/append_rectangle.py +++ b/borb/pdf/canvas/operator/path_construction/append_rectangle.py @@ -13,7 +13,7 @@ h """ import typing -from typing import List +from decimal import Decimal from borb.io.read.types import AnyPDFType from borb.pdf.canvas.operator.canvas_operator import CanvasOperator @@ -38,21 +38,33 @@ def __init__(self): def invoke( self, - canvas_stream_processor: "CanvasStreamProcessor", + canvas_stream_processor: "CanvasStreamProcessor", # type: ignore [name-defined] operands: typing.List[AnyPDFType] = [], - event_listeners: typing.List["EventListener"] = [], - ) -> None: # type: ignore [name-defined] + event_listeners: typing.List["EventListener"] = [], # type: ignore [name-defined] + ) -> None: """ Invoke the s operator """ + x: Decimal = operands[0] + y: Decimal = operands[1] + width: Decimal = operands[2] + height: Decimal = operands[3] + moveto_op: typing.Optional[ CanvasOperator ] = canvas_stream_processor.get_operator("m") + moveto_op.invoke(canvas_stream_processor, [x, y], event_listeners) + line_to_op: typing.Optional[ CanvasOperator ] = canvas_stream_processor.get_operator("l") + line_to_op.invoke(canvas_stream_processor, [x + width, y], event_listeners) + line_to_op.invoke( + canvas_stream_processor, [x + width, y + height], event_listeners + ) + line_to_op.invoke(canvas_stream_processor, [x, y + height], event_listeners) + close_subpath_op: typing.Optional[ CanvasOperator ] = canvas_stream_processor.get_operator("h") - - # TODO + close_subpath_op.invoke(canvas_stream_processor, [], event_listeners) diff --git a/borb/pdf/canvas/operator/path_construction/begin_subpath.py b/borb/pdf/canvas/operator/path_construction/begin_subpath.py index 7d26c743c..288d0c2ff 100644 --- a/borb/pdf/canvas/operator/path_construction/begin_subpath.py +++ b/borb/pdf/canvas/operator/path_construction/begin_subpath.py @@ -8,10 +8,8 @@ was also m, the new m overrides it; no vestige of the previous m operation remains in the path. """ -from decimal import Decimal -from typing import List - import typing +from decimal import Decimal from borb.io.read.types import AnyPDFType from borb.pdf.canvas.geometry.line_segment import LineSegment @@ -32,10 +30,10 @@ def __init__(self): def invoke( self, - canvas_stream_processor: "CanvasStreamProcessor", + canvas_stream_processor: "CanvasStreamProcessor", # type: ignore [name-defined] operands: typing.List[AnyPDFType] = [], - event_listeners: typing.List["EventListener"] = [], - ) -> None: # type: ignore [name-defined] + event_listeners: typing.List["EventListener"] = [], # type: ignore [name-defined] + ) -> None: """ Invoke the m operator """ diff --git a/borb/pdf/canvas/operator/path_construction/close_subpath.py b/borb/pdf/canvas/operator/path_construction/close_subpath.py index 2f2ac55a0..6617576e4 100644 --- a/borb/pdf/canvas/operator/path_construction/close_subpath.py +++ b/borb/pdf/canvas/operator/path_construction/close_subpath.py @@ -7,7 +7,6 @@ subpath. If the current subpath is already closed, h shall do nothing. """ -from typing import List import typing @@ -34,10 +33,10 @@ def __init__(self): def invoke( self, - canvas_stream_processor: "CanvasStreamProcessor", + canvas_stream_processor: "CanvasStreamProcessor", # type: ignore [name-defined] operands: typing.List[AnyPDFType] = [], - event_listeners: typing.List["EventListener"] = [], - ) -> None: # type: ignore [name-defined] + event_listeners: typing.List["EventListener"] = [], # type: ignore [name-defined] + ) -> None: """ Invoke the h operator """ diff --git a/borb/pdf/canvas/operator/path_painting/close_and_stroke_path.py b/borb/pdf/canvas/operator/path_painting/close_and_stroke_path.py index 5eee43aee..2749e4d35 100644 --- a/borb/pdf/canvas/operator/path_painting/close_and_stroke_path.py +++ b/borb/pdf/canvas/operator/path_painting/close_and_stroke_path.py @@ -23,10 +23,10 @@ def __init__(self): def invoke( self, - canvas_stream_processor: "CanvasStreamProcessor", - operands: List[AnyPDFType] = [], - event_listeners: typing.List["EventListener"] = [], - ) -> None: # type: ignore [name-defined] + canvas_stream_processor: "CanvasStreamProcessor", # type: ignore [name-defined] + operands: typing.List[AnyPDFType] = [], + event_listeners: typing.List["EventListener"] = [], # type: ignore [name-defined] + ) -> None: """ Invoke the s operator """ diff --git a/borb/pdf/canvas/operator/path_painting/stroke_path.py b/borb/pdf/canvas/operator/path_painting/stroke_path.py index 451b2793d..32b3f81d7 100644 --- a/borb/pdf/canvas/operator/path_painting/stroke_path.py +++ b/borb/pdf/canvas/operator/path_painting/stroke_path.py @@ -4,7 +4,6 @@ """ Stroke the path. """ -from typing import List import typing @@ -23,10 +22,10 @@ def __init__(self): def invoke( self, - canvas_stream_processor: "CanvasStreamProcessor", + canvas_stream_processor: "CanvasStreamProcessor", # type: ignore [name-defined] operands: typing.List[AnyPDFType] = [], - event_listeners: typing.List["EventListener"] = [], - ) -> None: # type: ignore [name-defined] + event_listeners: typing.List["EventListener"] = [], # type: ignore [name-defined] + ) -> None: """ Invoke the S operator """ diff --git a/borb/pdf/canvas/operator/state/modify_transformation_matrix.py b/borb/pdf/canvas/operator/state/modify_transformation_matrix.py index 6d4876325..4729a20bd 100644 --- a/borb/pdf/canvas/operator/state/modify_transformation_matrix.py +++ b/borb/pdf/canvas/operator/state/modify_transformation_matrix.py @@ -7,10 +7,8 @@ operands specify a matrix, they shall be written as six separate numbers, not as an array. """ -from decimal import Decimal -from typing import List - import typing +from decimal import Decimal from borb.io.read.types import AnyPDFType from borb.pdf.canvas.geometry.matrix import Matrix @@ -30,10 +28,10 @@ def __init__(self): def invoke( self, - canvas_stream_processor: "CanvasStreamProcessor", + canvas_stream_processor: "CanvasStreamProcessor", # type: ignore [name-defined] operands: typing.List[AnyPDFType] = [], - event_listeners: typing.List["EventListener"] = [], - ) -> None: # type: ignore [name-defined] + event_listeners: typing.List["EventListener"] = [], # type: ignore [name-defined] + ) -> None: """ Invoke the cm operator """ diff --git a/borb/pdf/canvas/operator/state/pop_graphics_state.py b/borb/pdf/canvas/operator/state/pop_graphics_state.py index 9579cdc9c..d72b5d957 100644 --- a/borb/pdf/canvas/operator/state/pop_graphics_state.py +++ b/borb/pdf/canvas/operator/state/pop_graphics_state.py @@ -6,7 +6,6 @@ state from the stack and making it the current state (see 8.4.2, "Graphics State Stack"). """ -from typing import List import typing @@ -26,10 +25,10 @@ def __init__(self): def invoke( self, - canvas_stream_processor: "CanvasStreamProcessor", + canvas_stream_processor: "CanvasStreamProcessor", # type: ignore [name-defined] operands: typing.List[AnyPDFType] = [], - event_listeners: typing.List["EventListener"] = [], - ) -> None: # type: ignore [name-defined] + event_listeners: typing.List["EventListener"] = [], # type: ignore [name-defined] + ) -> None: """ Invoke the Q operator """ diff --git a/borb/pdf/canvas/operator/state/push_graphics_state.py b/borb/pdf/canvas/operator/state/push_graphics_state.py index 8c5022767..ef127f9f6 100644 --- a/borb/pdf/canvas/operator/state/push_graphics_state.py +++ b/borb/pdf/canvas/operator/state/push_graphics_state.py @@ -6,8 +6,6 @@ 8.4.2, "Graphics State Stack"). """ import copy -from typing import List - import typing from borb.io.read.types import AnyPDFType @@ -25,10 +23,10 @@ def __init__(self): def invoke( self, - canvas_stream_processor: "CanvasStreamProcessor", + canvas_stream_processor: "CanvasStreamProcessor", # type: ignore [name-defined] operands: typing.List[AnyPDFType] = [], - event_listeners: typing.List["EventListener"] = [], - ) -> None: # type: ignore [name-defined] + event_listeners: typing.List["EventListener"] = [], # type: ignore [name-defined] + ) -> None: """ Invoke the q operator """ diff --git a/borb/pdf/canvas/operator/state/set_line_width.py b/borb/pdf/canvas/operator/state/set_line_width.py index a46234685..76ce7d52f 100644 --- a/borb/pdf/canvas/operator/state/set_line_width.py +++ b/borb/pdf/canvas/operator/state/set_line_width.py @@ -4,10 +4,8 @@ """ Set the line width in the graphics state (see 8.4.3.2, "Line Width"). """ -from decimal import Decimal -from typing import List - import typing +from decimal import Decimal from borb.io.read.types import AnyPDFType from borb.pdf.canvas.operator.canvas_operator import CanvasOperator @@ -23,10 +21,10 @@ def __init__(self): def invoke( self, - canvas_stream_processor: "CanvasStreamProcessor", + canvas_stream_processor: "CanvasStreamProcessor", # type: ignore [name-defined] operands: typing.List[AnyPDFType] = [], - event_listeners: typing.List["EventListener"] = [], - ) -> None: # type: ignore [name-defined] + event_listeners: typing.List["EventListener"] = [], # type: ignore [name-defined] + ) -> None: """ Invoke the w operator """ diff --git a/borb/pdf/canvas/operator/text/begin_text.py b/borb/pdf/canvas/operator/text/begin_text.py index 3b9d01072..035cd3936 100644 --- a/borb/pdf/canvas/operator/text/begin_text.py +++ b/borb/pdf/canvas/operator/text/begin_text.py @@ -7,8 +7,6 @@ not appear before an ET. """ -from typing import List - import typing from borb.io.read.types import AnyPDFType @@ -29,10 +27,10 @@ def __init__(self): def invoke( self, - canvas_stream_processor: "CanvasStreamProcessor", + canvas_stream_processor: "CanvasStreamProcessor", # type: ignore [name-defined] operands: typing.List[AnyPDFType] = [], - event_listeners: typing.List["EventListener"] = [], - ) -> None: # type: ignore [name-defined] + event_listeners: typing.List["EventListener"] = [], # type: ignore [name-defined] + ) -> None: """ Invoke the BT operator """ diff --git a/borb/pdf/canvas/operator/text/end_text.py b/borb/pdf/canvas/operator/text/end_text.py index 7bea08991..bcd8b85c5 100644 --- a/borb/pdf/canvas/operator/text/end_text.py +++ b/borb/pdf/canvas/operator/text/end_text.py @@ -4,7 +4,6 @@ """ End a text object, discarding the text matrix. """ -from typing import List import typing @@ -23,10 +22,10 @@ def __init__(self): def invoke( self, - canvas_stream_processor: "CanvasStreamProcessor", + canvas_stream_processor: "CanvasStreamProcessor", # type: ignore [name-defined] operands: typing.List[AnyPDFType] = [], - event_listeners: typing.List["EventListener"] = [], - ) -> None: # type: ignore [name-defined] + event_listeners: typing.List["EventListener"] = [], # type: ignore [name-defined] + ) -> None: """ Invoke the ET operator """ diff --git a/borb/pdf/canvas/operator/text/move_text_position.py b/borb/pdf/canvas/operator/text/move_text_position.py index 54e164584..dd39fad2a 100644 --- a/borb/pdf/canvas/operator/text/move_text_position.py +++ b/borb/pdf/canvas/operator/text/move_text_position.py @@ -8,10 +8,8 @@ Tm = Tlm = [[1,0,0], [0,1,0],[tx,ty,1]] * Tlm """ import copy -from decimal import Decimal -from typing import List - import typing +from decimal import Decimal from borb.io.read.types import AnyPDFType from borb.pdf.canvas.geometry.matrix import Matrix @@ -31,10 +29,10 @@ def __init__(self): def invoke( self, - canvas_stream_processor: "CanvasStreamProcessor", + canvas_stream_processor: "CanvasStreamProcessor", # type: ignore [name-defined] operands: typing.List[AnyPDFType] = [], - event_listeners: typing.List["EventListener"] = [], - ) -> None: # type: ignore [name-defined] + event_listeners: typing.List["EventListener"] = [], # type: ignore [name-defined] + ) -> None: """ Invoke the Td operator """ diff --git a/borb/pdf/canvas/operator/text/move_text_position_set_leading.py b/borb/pdf/canvas/operator/text/move_text_position_set_leading.py index fa208fcd5..81b144788 100644 --- a/borb/pdf/canvas/operator/text/move_text_position_set_leading.py +++ b/borb/pdf/canvas/operator/text/move_text_position_set_leading.py @@ -10,7 +10,6 @@ """ import typing from decimal import Decimal -from typing import List from borb.io.read.types import AnyPDFType from borb.io.read.types import Decimal as pDecimal @@ -31,10 +30,10 @@ def __init__(self): def invoke( self, - canvas_stream_processor: "CanvasStreamProcessor", + canvas_stream_processor: "CanvasStreamProcessor", # type: ignore [name-defined] operands: typing.List[AnyPDFType] = [], - event_listeners: typing.List["EventListener"] = [], - ) -> None: # type: ignore [name-defined] + event_listeners: typing.List["EventListener"] = [], # type: ignore [name-defined] + ) -> None: """ Invoke the TD operator """ diff --git a/borb/pdf/canvas/operator/text/move_to_next_line.py b/borb/pdf/canvas/operator/text/move_to_next_line.py index 7e732f0b9..17ac6ee41 100644 --- a/borb/pdf/canvas/operator/text/move_to_next_line.py +++ b/borb/pdf/canvas/operator/text/move_to_next_line.py @@ -11,7 +11,6 @@ y coordinate. """ import typing -from typing import List from borb.io.read.types import AnyPDFType from borb.io.read.types import Decimal as pDecimal @@ -34,10 +33,10 @@ def __init__(self): def invoke( self, - canvas_stream_processor: "CanvasStreamProcessor", + canvas_stream_processor: "CanvasStreamProcessor", # type: ignore [name-defined] operands: typing.List[AnyPDFType] = [], - event_listeners: typing.List["EventListener"] = [], - ) -> None: # type: ignore [name-defined] + event_listeners: typing.List["EventListener"] = [], # type: ignore [name-defined] + ) -> None: """ Invoke the T* operator """ diff --git a/borb/pdf/canvas/operator/text/move_to_next_line_show_text.py b/borb/pdf/canvas/operator/text/move_to_next_line_show_text.py index 831b4120f..d41612713 100644 --- a/borb/pdf/canvas/operator/text/move_to_next_line_show_text.py +++ b/borb/pdf/canvas/operator/text/move_to_next_line_show_text.py @@ -8,7 +8,6 @@ string Tj """ import typing -from typing import List from borb.io.read.types import AnyPDFType from borb.pdf.canvas.operator.canvas_operator import CanvasOperator @@ -27,10 +26,10 @@ def __init__(self): def invoke( self, - canvas_stream_processor: "CanvasStreamProcessor", + canvas_stream_processor: "CanvasStreamProcessor", # type: ignore [name-defined] operands: typing.List[AnyPDFType] = [], - event_listeners: typing.List["EventListener"] = [], - ) -> None: # type: ignore [name-defined] + event_listeners: typing.List["EventListener"] = [], # type: ignore [name-defined] + ) -> None: """ Invoke the ' operator """ diff --git a/borb/pdf/canvas/operator/text/set_character_spacing.py b/borb/pdf/canvas/operator/text/set_character_spacing.py index 71e85e408..529f4e6b9 100644 --- a/borb/pdf/canvas/operator/text/set_character_spacing.py +++ b/borb/pdf/canvas/operator/text/set_character_spacing.py @@ -6,10 +6,8 @@ expressed in unscaled text space units. Character spacing shall be used by the Tj, TJ, and ' operators. Initial value: 0. """ -from decimal import Decimal -from typing import List - import typing +from decimal import Decimal from borb.io.read.types import AnyPDFType from borb.pdf.canvas.operator.canvas_operator import CanvasOperator @@ -27,10 +25,10 @@ def __init__(self): def invoke( self, - canvas_stream_processor: "CanvasStreamProcessor", + canvas_stream_processor: "CanvasStreamProcessor", # type: ignore [name-defined] operands: typing.List[AnyPDFType] = [], - event_listeners: typing.List["EventListener"] = [], - ) -> None: # type: ignore [name-defined] + event_listeners: typing.List["EventListener"] = [], # type: ignore [name-defined] + ) -> None: """ Invoke the Tc operator """ diff --git a/borb/pdf/canvas/operator/text/set_font_and_size.py b/borb/pdf/canvas/operator/text/set_font_and_size.py index 2786e1a11..c348673df 100644 --- a/borb/pdf/canvas/operator/text/set_font_and_size.py +++ b/borb/pdf/canvas/operator/text/set_font_and_size.py @@ -8,7 +8,6 @@ There is no initial value for either font or size; they shall be specified explicitly by using Tf before any text is shown. """ -from typing import List import typing @@ -31,10 +30,10 @@ def __init__(self): def invoke( self, - canvas_stream_processor: "CanvasStreamProcessor", + canvas_stream_processor: "CanvasStreamProcessor", # type: ignore [name-defined] operands: typing.List[AnyPDFType] = [], - event_listeners: typing.List["EventListener"] = [], - ) -> None: # type: ignore [name-defined] + event_listeners: typing.List["EventListener"] = [], # type: ignore [name-defined] + ) -> None: """ Invoke the Tf operator """ diff --git a/borb/pdf/canvas/operator/text/set_horizontal_text_scaling.py b/borb/pdf/canvas/operator/text/set_horizontal_text_scaling.py index b0baa13c4..cf5ea11cc 100644 --- a/borb/pdf/canvas/operator/text/set_horizontal_text_scaling.py +++ b/borb/pdf/canvas/operator/text/set_horizontal_text_scaling.py @@ -6,10 +6,8 @@ specifying the percentage of the normal width. Initial value: 100 (normal width). """ -from decimal import Decimal -from typing import List - import typing +from decimal import Decimal from borb.io.read.types import AnyPDFType from borb.pdf.canvas.operator.canvas_operator import CanvasOperator @@ -27,10 +25,10 @@ def __init__(self): def invoke( self, - canvas_stream_processor: "CanvasStreamProcessor", + canvas_stream_processor: "CanvasStreamProcessor", # type: ignore [name-defined] operands: typing.List[AnyPDFType] = [], - event_listeners: typing.List["EventListener"] = [], - ) -> None: # type: ignore [name-defined] + event_listeners: typing.List["EventListener"] = [], # type: ignore [name-defined] + ) -> None: """ Invoke the Tz operator """ diff --git a/borb/pdf/canvas/operator/text/set_spacing_move_to_next_line_show_text.py b/borb/pdf/canvas/operator/text/set_spacing_move_to_next_line_show_text.py index a86c9c6d0..f5dcacf79 100644 --- a/borb/pdf/canvas/operator/text/set_spacing_move_to_next_line_show_text.py +++ b/borb/pdf/canvas/operator/text/set_spacing_move_to_next_line_show_text.py @@ -8,7 +8,6 @@ space units. """ import typing -from typing import List from borb.io.read.types import AnyPDFType from borb.pdf.canvas.operator.canvas_operator import CanvasOperator @@ -30,10 +29,10 @@ def __init__(self): def invoke( self, - canvas_stream_processor: "CanvasStreamProcessor", + canvas_stream_processor: "CanvasStreamProcessor", # type: ignore [name-defined] operands: typing.List[AnyPDFType] = [], - event_listeners: typing.List["EventListener"] = [], - ) -> None: # type: ignore [name-defined] + event_listeners: typing.List["EventListener"] = [], # type: ignore [name-defined] + ) -> None: """ Invoke the " operator """ diff --git a/borb/pdf/canvas/operator/text/set_text_leading.py b/borb/pdf/canvas/operator/text/set_text_leading.py index 89e1304a9..9bdbcc44a 100644 --- a/borb/pdf/canvas/operator/text/set_text_leading.py +++ b/borb/pdf/canvas/operator/text/set_text_leading.py @@ -6,10 +6,8 @@ unscaled text space units. Text leading shall be used only by the T*, ', and " operators. Initial value: 0. """ -from decimal import Decimal -from typing import List - import typing +from decimal import Decimal from borb.io.read.types import AnyPDFType from borb.pdf.canvas.operator.canvas_operator import CanvasOperator @@ -27,10 +25,10 @@ def __init__(self): def invoke( self, - canvas_stream_processor: "CanvasStreamProcessor", + canvas_stream_processor: "CanvasStreamProcessor", # type: ignore [name-defined] operands: typing.List[AnyPDFType] = [], - event_listeners: typing.List["EventListener"] = [], - ) -> None: # type: ignore [name-defined] + event_listeners: typing.List["EventListener"] = [], # type: ignore [name-defined] + ) -> None: """ Invoke the TL operator """ diff --git a/borb/pdf/canvas/operator/text/set_text_matrix.py b/borb/pdf/canvas/operator/text/set_text_matrix.py index 9e9d96d47..94a9c8bb7 100644 --- a/borb/pdf/canvas/operator/text/set_text_matrix.py +++ b/borb/pdf/canvas/operator/text/set_text_matrix.py @@ -6,10 +6,8 @@ Tm = Tlm = [[a,b,0], [c,d,0],[e,f,1]] """ import copy -from decimal import Decimal -from typing import List - import typing +from decimal import Decimal from borb.io.read.types import AnyPDFType from borb.pdf.canvas.geometry.matrix import Matrix @@ -35,10 +33,10 @@ def __init__(self): def invoke( self, - canvas_stream_processor: "CanvasStreamProcessor", + canvas_stream_processor: "CanvasStreamProcessor", # type: ignore [name-defined] operands: typing.List[AnyPDFType] = [], - event_listeners: typing.List["EventListener"] = [], - ) -> None: # type: ignore [name-defined] + event_listeners: typing.List["EventListener"] = [], # type: ignore [name-defined] + ) -> None: """ Invoke the Tm operator """ diff --git a/borb/pdf/canvas/operator/text/set_text_rendering_mode.py b/borb/pdf/canvas/operator/text/set_text_rendering_mode.py index 009890f47..e0cfcdf00 100644 --- a/borb/pdf/canvas/operator/text/set_text_rendering_mode.py +++ b/borb/pdf/canvas/operator/text/set_text_rendering_mode.py @@ -5,7 +5,6 @@ Set the text rendering mode, T mode , to render, which shall be an integer. Initial value: 0. """ -from typing import List import typing @@ -24,10 +23,10 @@ def __init__(self): def invoke( self, - canvas_stream_processor: "CanvasStreamProcessor", + canvas_stream_processor: "CanvasStreamProcessor", # type: ignore [name-defined] operands: typing.List[AnyPDFType] = [], - event_listeners: typing.List["EventListener"] = [], - ) -> None: # type: ignore [name-defined] + event_listeners: typing.List["EventListener"] = [], # type: ignore [name-defined] + ) -> None: """ Invoke the Tr operator """ diff --git a/borb/pdf/canvas/operator/text/set_text_rise.py b/borb/pdf/canvas/operator/text/set_text_rise.py index d6128ae5f..cc65191e1 100644 --- a/borb/pdf/canvas/operator/text/set_text_rise.py +++ b/borb/pdf/canvas/operator/text/set_text_rise.py @@ -5,10 +5,8 @@ Set the text rise, T rise , to rise, which shall be a number expressed in unscaled text space units. Initial value: 0. """ -from decimal import Decimal -from typing import List - import typing +from decimal import Decimal from borb.io.read.types import AnyPDFType from borb.pdf.canvas.operator.canvas_operator import CanvasOperator @@ -25,10 +23,10 @@ def __init__(self): def invoke( self, - canvas_stream_processor: "CanvasStreamProcessor", + canvas_stream_processor: "CanvasStreamProcessor", # type: ignore [name-defined] operands: typing.List[AnyPDFType] = [], - event_listeners: typing.List["EventListener"] = [], - ) -> None: # type: ignore [name-defined] + event_listeners: typing.List["EventListener"] = [], # type: ignore [name-defined] + ) -> None: """ Invoke the Ts operator """ diff --git a/borb/pdf/canvas/operator/text/set_word_spacing.py b/borb/pdf/canvas/operator/text/set_word_spacing.py index cf2b7a474..31b662b7f 100644 --- a/borb/pdf/canvas/operator/text/set_word_spacing.py +++ b/borb/pdf/canvas/operator/text/set_word_spacing.py @@ -6,10 +6,8 @@ expressed in unscaled text space units. Word spacing shall be used by the Tj, TJ, and ' operators. Initial value: 0. """ -from decimal import Decimal -from typing import List - import typing +from decimal import Decimal from borb.io.read.types import AnyPDFType from borb.pdf.canvas.operator.canvas_operator import CanvasOperator @@ -27,10 +25,10 @@ def __init__(self): def invoke( self, - canvas_stream_processor: "CanvasStreamProcessor", + canvas_stream_processor: "CanvasStreamProcessor", # type: ignore [name-defined] operands: typing.List[AnyPDFType] = [], - event_listeners: typing.List["EventListener"] = [], - ) -> None: # type: ignore [name-defined] + event_listeners: typing.List["EventListener"] = [], # type: ignore [name-defined] + ) -> None: """ Invoke the Tw operator """ diff --git a/borb/pdf/canvas/operator/text/show_text.py b/borb/pdf/canvas/operator/text/show_text.py index d38fbdbf9..cb49c994b 100644 --- a/borb/pdf/canvas/operator/text/show_text.py +++ b/borb/pdf/canvas/operator/text/show_text.py @@ -5,7 +5,6 @@ Show a text string. """ import typing -from typing import List from borb.io.read.types import AnyPDFType, Name, String from borb.pdf.canvas.event.chunk_of_text_render_event import ChunkOfTextRenderEvent @@ -22,10 +21,10 @@ def __init__(self): def invoke( self, - canvas_stream_processor: "CanvasStreamProcessor", + canvas_stream_processor: "CanvasStreamProcessor", # type: ignore [name-defined] operands: typing.List[AnyPDFType] = [], - event_listeners: typing.List["EventListener"] = [], - ) -> None: # type: ignore [name-defined] + event_listeners: typing.List["EventListener"] = [], # type: ignore [name-defined] + ) -> None: """ Invoke the Tj operator """ diff --git a/borb/pdf/canvas/operator/text/show_text_with_glyph_positioning.py b/borb/pdf/canvas/operator/text/show_text_with_glyph_positioning.py index 62d8ebdd7..4cf707405 100644 --- a/borb/pdf/canvas/operator/text/show_text_with_glyph_positioning.py +++ b/borb/pdf/canvas/operator/text/show_text_with_glyph_positioning.py @@ -34,10 +34,10 @@ def __init__(self): def invoke( self, - canvas_stream_processor: "CanvasStreamProcessor", + canvas_stream_processor: "CanvasStreamProcessor", # type: ignore [name-defined] operands: typing.List[AnyPDFType] = [], - event_listeners: typing.List["EventListener"] = [], - ) -> None: # type: ignore [name-defined] + event_listeners: typing.List["EventListener"] = [], # type: ignore [name-defined] + ) -> None: """ Invoke the TJ operator """ diff --git a/borb/pdf/canvas/operator/xobject/do.py b/borb/pdf/canvas/operator/xobject/do.py index e28f72d85..55c092d9b 100644 --- a/borb/pdf/canvas/operator/xobject/do.py +++ b/borb/pdf/canvas/operator/xobject/do.py @@ -11,6 +11,7 @@ import typing import PIL # type: ignore [import] + from borb.io.read.types import AnyPDFType, Dictionary, Name, Stream from borb.pdf.canvas.event.image_render_event import ImageRenderEvent from borb.pdf.canvas.operator.canvas_operator import CanvasOperator @@ -34,10 +35,10 @@ def __init__(self): def invoke( self, - canvas_stream_processor: "CanvasStreamProcessor", + canvas_stream_processor: "CanvasStreamProcessor", # type: ignore [name-defined] operands: typing.List[AnyPDFType] = [], - event_listeners: typing.List["EventListener"] = [], - ) -> None: # type: ignore [name-defined] + event_listeners: typing.List["EventListener"] = [], # type: ignore [name-defined] + ) -> None: """ Invoke the Do operator """ diff --git a/borb/pdf/canvas/redacted_canvas_stream_processor.py b/borb/pdf/canvas/redacted_canvas_stream_processor.py index cf0939b37..c5231a440 100644 --- a/borb/pdf/canvas/redacted_canvas_stream_processor.py +++ b/borb/pdf/canvas/redacted_canvas_stream_processor.py @@ -37,10 +37,10 @@ def get_number_of_operands(self) -> int: def invoke( self, - canvas_stream_processor: "CanvasStreamProcessor", + canvas_stream_processor: "CanvasStreamProcessor", # type: ignore [name-defined] operands: typing.List[AnyPDFType] = [], - event_listeners: typing.List["EventListener"] = [], - ) -> None: # type: ignore [name-defined] + event_listeners: typing.List["EventListener"] = [], # type: ignore [name-defined] + ) -> None: """ Invokes this CanvasOperator """ @@ -106,10 +106,10 @@ def _write_chunk_of_text( def invoke( self, - canvas_stream_processor: "CanvasStreamProcessor", + canvas_stream_processor: "CanvasStreamProcessor", # type: ignore [name-defined] operands: typing.List[AnyPDFType] = [], - event_listeners: typing.List["EventListener"] = [], - ) -> None: # type: ignore [name-defined] + event_listeners: typing.List["EventListener"] = [], # type: ignore [name-defined] + ) -> None: """ Invokes this CanvasOperator """ @@ -202,10 +202,10 @@ def _write_chunk_of_text( def invoke( self, - canvas_stream_processor: "CanvasStreamProcessor", + canvas_stream_processor: "CanvasStreamProcessor", # type: ignore [name-defined] operands: typing.List[AnyPDFType] = [], - event_listeners: typing.List["EventListener"] = [], - ) -> None: # type: ignore [name-defined] + event_listeners: typing.List["EventListener"] = [], # type: ignore [name-defined] + ) -> None: """ Invoke the TJ operator """ diff --git a/borb/pdf/pdf.py b/borb/pdf/pdf.py index f4a9bec98..3f323cefe 100644 --- a/borb/pdf/pdf.py +++ b/borb/pdf/pdf.py @@ -11,9 +11,12 @@ import io from typing import List, Union +import typing + from borb.io.read.any_object_transformer import ( AnyObjectTransformer as ReadAnyObjectTransformer, ) +from borb.io.read.transformer import ReadTransformerState from borb.io.write.any_object_transformer import ( AnyObjectTransformer as WriteAnyObjectTransformer, ) @@ -41,13 +44,17 @@ class PDF: def loads( file: Union[io.BufferedIOBase, io.RawIOBase], event_listeners: List[EventListener] = [], + password: typing.Optional[str] = None, ) -> Document: """ This function reads a byte-stream input (which may be presented as an io.BufferedIOBase o io.RawIOBase) and returns a Document. """ return ReadAnyObjectTransformer().transform( - file, parent_object=None, context=None, event_listeners=event_listeners + file, + parent_object=None, + context=ReadTransformerState(password=password), + event_listeners=event_listeners, ) @staticmethod diff --git a/borb/toolkit/color/color_spectrum_extraction.py b/borb/toolkit/color/color_spectrum_extraction.py index 5bdeafd4e..3dfc5669d 100644 --- a/borb/toolkit/color/color_spectrum_extraction.py +++ b/borb/toolkit/color/color_spectrum_extraction.py @@ -8,6 +8,8 @@ from decimal import Decimal from typing import Optional +from PIL.Image import Image # type: ignore [import] + from borb.pdf.canvas.color.color import RGBColor from borb.pdf.canvas.event.begin_page_event import BeginPageEvent from borb.pdf.canvas.event.chunk_of_text_render_event import ChunkOfTextRenderEvent @@ -15,7 +17,6 @@ from borb.pdf.canvas.event.image_render_event import ImageRenderEvent from borb.pdf.canvas.geometry.rectangle import Rectangle from borb.pdf.page.page import Page -from PIL.Image import Image # type: ignore [import] class ColorSpectrumExtraction(EventListener): diff --git a/borb/toolkit/export/html_to_pdf/html_to_pdf.py b/borb/toolkit/export/html_to_pdf/html_to_pdf.py index d2864fdab..9ed1aa34e 100644 --- a/borb/toolkit/export/html_to_pdf/html_to_pdf.py +++ b/borb/toolkit/export/html_to_pdf/html_to_pdf.py @@ -7,6 +7,8 @@ import typing import xml.etree.ElementTree as ET +from lxml.etree import HTMLParser # type: ignore [import] + from borb.pdf.canvas.layout.page_layout.browser_layout import BrowserLayout from borb.pdf.canvas.layout.page_layout.page_layout import PageLayout from borb.pdf.document import Document @@ -15,7 +17,6 @@ from borb.toolkit.export.html_to_pdf.tag_transformer.any_tag_transformer import ( AnyTagTransformer, ) -from lxml.etree import HTMLParser # type: ignore [import] class HTMLToPDF: diff --git a/borb/toolkit/export/html_to_pdf/read/any_tag_transformer.py b/borb/toolkit/export/html_to_pdf/read/any_tag_transformer.py index 371d6d3c8..27afe7cbf 100644 --- a/borb/toolkit/export/html_to_pdf/read/any_tag_transformer.py +++ b/borb/toolkit/export/html_to_pdf/read/any_tag_transformer.py @@ -5,77 +5,109 @@ This class acts as an aggregator for all BaseTagTransformer implementations. Any of the (supported) HTML tags should be able to be transformed by this BaseTagTransformer. """ +from borb.toolkit.export.html_to_pdf.read.body.body_tag_transformer import ( + BodyTagTransformer, +) +from borb.toolkit.export.html_to_pdf.read.head.head_tag_transformer import ( + HeadTagTransformer, +) +from borb.toolkit.export.html_to_pdf.read.head.meta_tag_transformer import ( + MetaTagTransformer, +) +from borb.toolkit.export.html_to_pdf.read.head.title_tag_transformer import ( + TitleTagTransformer, +) +from borb.toolkit.export.html_to_pdf.read.heading.h1_tag_transformer import ( + H1TagTransformer, +) +from borb.toolkit.export.html_to_pdf.read.heading.h2_tag_transformer import ( + H2TagTransformer, +) +from borb.toolkit.export.html_to_pdf.read.heading.h3_tag_transformer import ( + H3TagTransformer, +) +from borb.toolkit.export.html_to_pdf.read.heading.h4_tag_transformer import ( + H4TagTransformer, +) +from borb.toolkit.export.html_to_pdf.read.heading.h5_tag_transformer import ( + H5TagTransformer, +) +from borb.toolkit.export.html_to_pdf.read.heading.h6_tag_transformer import ( + H6TagTransformer, +) +from borb.toolkit.export.html_to_pdf.read.heading.hr_tag_transformer import ( + HrTagTransformer, +) +from borb.toolkit.export.html_to_pdf.read.html.html_tag_transformer import ( + HTMLTagTransformer, +) +from borb.toolkit.export.html_to_pdf.read.image.img_tag_transformer import ( + ImgTagTransformer, +) +from borb.toolkit.export.html_to_pdf.read.list.li_tag_transformer import ( + LiTagTransformer, +) +from borb.toolkit.export.html_to_pdf.read.list.ol_tag_transformer import ( + OlTagTransformer, +) +from borb.toolkit.export.html_to_pdf.read.list.ul_tag_transformer import ( + UlTagTransformer, +) +from borb.toolkit.export.html_to_pdf.read.structure.address_tag_transformer import ( + AddressTagTransformer, +) +from borb.toolkit.export.html_to_pdf.read.structure.main_tag_transformer import ( + MainTagTransformer, +) +from borb.toolkit.export.html_to_pdf.read.structure.section_tag_transformer import ( + SectionTagTransformer, +) +from borb.toolkit.export.html_to_pdf.read.table.table_tag_transformer import ( + TableTagTransformer, +) +from borb.toolkit.export.html_to_pdf.read.table.tbody_tag_transformer import ( + TBodyTagTransformer, +) +from borb.toolkit.export.html_to_pdf.read.table.td_tag_transformer import ( + TdTagTransformer, +) +from borb.toolkit.export.html_to_pdf.read.table.th_tag_transformer import ( + ThTagTransformer, +) +from borb.toolkit.export.html_to_pdf.read.table.tr_tag_transformer import ( + TrTagTransformer, +) +from borb.toolkit.export.html_to_pdf.read.text.a_tag_transformer import ATagTransformer +from borb.toolkit.export.html_to_pdf.read.text.abbr_tag_transformer import ( + AbbrTagTransformer, +) +from borb.toolkit.export.html_to_pdf.read.text.bold.b_tag_transformer import ( + BTagTransformer, +) +from borb.toolkit.export.html_to_pdf.read.text.bold.strong_tag_transformer import ( + StrongTagTransformer, +) +from borb.toolkit.export.html_to_pdf.read.text.br_tag_transformer import ( + BrTagTransformer, +) +from borb.toolkit.export.html_to_pdf.read.text.code_tag_transformer import ( + CodeTagTransformer, +) +from borb.toolkit.export.html_to_pdf.read.text.italic.em_tag_transformer import ( + EmTagTransformer, +) +from borb.toolkit.export.html_to_pdf.read.text.italic.i_tag_transformer import ( + ITagTransformer, +) +from borb.toolkit.export.html_to_pdf.read.text.mark_tag_transformer import ( + MarkTagTransformer, +) +from borb.toolkit.export.html_to_pdf.read.text.p_tag_transformer import PTagTransformer + # fmt: off from borb.toolkit.export.html_to_pdf.read.transformer import \ Transformer -from borb.toolkit.export.html_to_pdf.read.body.body_tag_transformer import \ - BodyTagTransformer -from borb.toolkit.export.html_to_pdf.read.head.head_tag_transformer import \ - HeadTagTransformer -from borb.toolkit.export.html_to_pdf.read.head.meta_tag_transformer import \ - MetaTagTransformer -from borb.toolkit.export.html_to_pdf.read.head.title_tag_transformer import \ - TitleTagTransformer -from borb.toolkit.export.html_to_pdf.read.heading.h1_tag_transformer import \ - H1TagTransformer -from borb.toolkit.export.html_to_pdf.read.heading.h2_tag_transformer import \ - H2TagTransformer -from borb.toolkit.export.html_to_pdf.read.heading.h3_tag_transformer import \ - H3TagTransformer -from borb.toolkit.export.html_to_pdf.read.heading.h4_tag_transformer import \ - H4TagTransformer -from borb.toolkit.export.html_to_pdf.read.heading.h5_tag_transformer import \ - H5TagTransformer -from borb.toolkit.export.html_to_pdf.read.heading.h6_tag_transformer import \ - H6TagTransformer -from borb.toolkit.export.html_to_pdf.read.heading.hr_tag_transformer import \ - HrTagTransformer -from borb.toolkit.export.html_to_pdf.read.html.html_tag_transformer import \ - HTMLTagTransformer -from borb.toolkit.export.html_to_pdf.read.image.img_tag_transformer import \ - ImgTagTransformer -from borb.toolkit.export.html_to_pdf.read.list.li_tag_transformer import \ - LiTagTransformer -from borb.toolkit.export.html_to_pdf.read.list.ol_tag_transformer import \ - OlTagTransformer -from borb.toolkit.export.html_to_pdf.read.list.ul_tag_transformer import \ - UlTagTransformer -from borb.toolkit.export.html_to_pdf.read.structure.address_tag_transformer import \ - AddressTagTransformer -from borb.toolkit.export.html_to_pdf.read.structure.main_tag_transformer import \ - MainTagTransformer -from borb.toolkit.export.html_to_pdf.read.structure.section_tag_transformer import \ - SectionTagTransformer -from borb.toolkit.export.html_to_pdf.read.table.table_tag_transformer import \ - TableTagTransformer -from borb.toolkit.export.html_to_pdf.read.table.tbody_tag_transformer import \ - TBodyTagTransformer -from borb.toolkit.export.html_to_pdf.read.table.td_tag_transformer import \ - TdTagTransformer -from borb.toolkit.export.html_to_pdf.read.table.th_tag_transformer import \ - ThTagTransformer -from borb.toolkit.export.html_to_pdf.read.table.tr_tag_transformer import \ - TrTagTransformer -from borb.toolkit.export.html_to_pdf.read.text.a_tag_transformer import \ - ATagTransformer -from borb.toolkit.export.html_to_pdf.read.text.abbr_tag_transformer import \ - AbbrTagTransformer -from borb.toolkit.export.html_to_pdf.read.text.bold.b_tag_transformer import \ - BTagTransformer -from borb.toolkit.export.html_to_pdf.read.text.bold.strong_tag_transformer import \ - StrongTagTransformer -from borb.toolkit.export.html_to_pdf.read.text.br_tag_transformer import \ - BrTagTransformer -from borb.toolkit.export.html_to_pdf.read.text.code_tag_transformer import \ - CodeTagTransformer -from borb.toolkit.export.html_to_pdf.read.text.italic.em_tag_transformer import \ - EmTagTransformer -from borb.toolkit.export.html_to_pdf.read.text.italic.i_tag_transformer import \ - ITagTransformer -from borb.toolkit.export.html_to_pdf.read.text.mark_tag_transformer import \ - MarkTagTransformer -from borb.toolkit.export.html_to_pdf.read.text.p_tag_transformer import \ - PTagTransformer + # fmt: on diff --git a/borb/toolkit/export/html_to_pdf/read/body/body_tag_transformer.py b/borb/toolkit/export/html_to_pdf/read/body/body_tag_transformer.py index d24e3a898..550f607a0 100644 --- a/borb/toolkit/export/html_to_pdf/read/body/body_tag_transformer.py +++ b/borb/toolkit/export/html_to_pdf/read/body/body_tag_transformer.py @@ -10,8 +10,6 @@ from borb.pdf.canvas.layout.layout_element import LayoutElement from borb.pdf.canvas.layout.page_layout.page_layout import PageLayout from borb.pdf.canvas.layout.text.chunk_of_text import ChunkOfText -from borb.pdf.document import Document -from borb.pdf.page.page import Page from borb.toolkit.export.html_to_pdf.read.transformer import ( Transformer, ) diff --git a/borb/toolkit/export/html_to_pdf/read/head/head_tag_transformer.py b/borb/toolkit/export/html_to_pdf/read/head/head_tag_transformer.py index aa317531c..49fe874e1 100644 --- a/borb/toolkit/export/html_to_pdf/read/head/head_tag_transformer.py +++ b/borb/toolkit/export/html_to_pdf/read/head/head_tag_transformer.py @@ -9,8 +9,6 @@ from borb.pdf.canvas.layout.layout_element import LayoutElement from borb.pdf.canvas.layout.page_layout.page_layout import PageLayout -from borb.pdf.document import Document -from borb.pdf.page.page import Page from borb.toolkit.export.html_to_pdf.read.transformer import ( Transformer, ) diff --git a/borb/toolkit/export/html_to_pdf/read/head/meta_tag_transformer.py b/borb/toolkit/export/html_to_pdf/read/head/meta_tag_transformer.py index 9333d4dc6..19427457a 100644 --- a/borb/toolkit/export/html_to_pdf/read/head/meta_tag_transformer.py +++ b/borb/toolkit/export/html_to_pdf/read/head/meta_tag_transformer.py @@ -11,7 +11,6 @@ from borb.pdf.canvas.layout.layout_element import LayoutElement from borb.pdf.canvas.layout.page_layout.page_layout import PageLayout from borb.pdf.document import Document -from borb.pdf.page.page import Page from borb.pdf.xref.plaintext_xref import PlainTextXREF from borb.toolkit.export.html_to_pdf.read.transformer import ( Transformer, diff --git a/borb/toolkit/export/html_to_pdf/read/heading/h1_tag_transformer.py b/borb/toolkit/export/html_to_pdf/read/heading/h1_tag_transformer.py index 41486e9fa..e4b31b5c0 100644 --- a/borb/toolkit/export/html_to_pdf/read/heading/h1_tag_transformer.py +++ b/borb/toolkit/export/html_to_pdf/read/heading/h1_tag_transformer.py @@ -11,8 +11,6 @@ from borb.pdf.canvas.layout.layout_element import LayoutElement from borb.pdf.canvas.layout.page_layout.page_layout import PageLayout from borb.pdf.canvas.layout.text.heading import Heading -from borb.pdf.document import Document -from borb.pdf.page.page import Page from borb.toolkit.export.html_to_pdf.read.transformer import ( Transformer, ) diff --git a/borb/toolkit/export/html_to_pdf/read/heading/h2_tag_transformer.py b/borb/toolkit/export/html_to_pdf/read/heading/h2_tag_transformer.py index 31504f884..4bad42daf 100644 --- a/borb/toolkit/export/html_to_pdf/read/heading/h2_tag_transformer.py +++ b/borb/toolkit/export/html_to_pdf/read/heading/h2_tag_transformer.py @@ -11,8 +11,6 @@ from borb.pdf.canvas.layout.layout_element import LayoutElement from borb.pdf.canvas.layout.page_layout.page_layout import PageLayout from borb.pdf.canvas.layout.text.heading import Heading -from borb.pdf.document import Document -from borb.pdf.page.page import Page from borb.toolkit.export.html_to_pdf.read.transformer import ( Transformer, ) diff --git a/borb/toolkit/export/html_to_pdf/read/heading/h3_tag_transformer.py b/borb/toolkit/export/html_to_pdf/read/heading/h3_tag_transformer.py index fd2798428..cb9480a01 100644 --- a/borb/toolkit/export/html_to_pdf/read/heading/h3_tag_transformer.py +++ b/borb/toolkit/export/html_to_pdf/read/heading/h3_tag_transformer.py @@ -11,8 +11,6 @@ from borb.pdf.canvas.layout.layout_element import LayoutElement from borb.pdf.canvas.layout.page_layout.page_layout import PageLayout from borb.pdf.canvas.layout.text.heading import Heading -from borb.pdf.document import Document -from borb.pdf.page.page import Page from borb.toolkit.export.html_to_pdf.read.transformer import ( Transformer, ) diff --git a/borb/toolkit/export/html_to_pdf/read/heading/h4_tag_transformer.py b/borb/toolkit/export/html_to_pdf/read/heading/h4_tag_transformer.py index d7ca36b3b..b36ca844c 100644 --- a/borb/toolkit/export/html_to_pdf/read/heading/h4_tag_transformer.py +++ b/borb/toolkit/export/html_to_pdf/read/heading/h4_tag_transformer.py @@ -11,8 +11,6 @@ from borb.pdf.canvas.layout.layout_element import LayoutElement from borb.pdf.canvas.layout.page_layout.page_layout import PageLayout from borb.pdf.canvas.layout.text.heading import Heading -from borb.pdf.document import Document -from borb.pdf.page.page import Page from borb.toolkit.export.html_to_pdf.read.transformer import ( Transformer, ) diff --git a/borb/toolkit/export/html_to_pdf/read/heading/h5_tag_transformer.py b/borb/toolkit/export/html_to_pdf/read/heading/h5_tag_transformer.py index 4bf9cc29b..e78cb07a8 100644 --- a/borb/toolkit/export/html_to_pdf/read/heading/h5_tag_transformer.py +++ b/borb/toolkit/export/html_to_pdf/read/heading/h5_tag_transformer.py @@ -11,8 +11,6 @@ from borb.pdf.canvas.layout.layout_element import LayoutElement from borb.pdf.canvas.layout.page_layout.page_layout import PageLayout from borb.pdf.canvas.layout.text.heading import Heading -from borb.pdf.document import Document -from borb.pdf.page.page import Page from borb.toolkit.export.html_to_pdf.read.transformer import ( Transformer, ) diff --git a/borb/toolkit/export/html_to_pdf/read/heading/h6_tag_transformer.py b/borb/toolkit/export/html_to_pdf/read/heading/h6_tag_transformer.py index f26cb8575..685f6f431 100644 --- a/borb/toolkit/export/html_to_pdf/read/heading/h6_tag_transformer.py +++ b/borb/toolkit/export/html_to_pdf/read/heading/h6_tag_transformer.py @@ -11,8 +11,6 @@ from borb.pdf.canvas.layout.layout_element import LayoutElement from borb.pdf.canvas.layout.page_layout.page_layout import PageLayout from borb.pdf.canvas.layout.text.heading import Heading -from borb.pdf.document import Document -from borb.pdf.page.page import Page from borb.toolkit.export.html_to_pdf.read.transformer import ( Transformer, ) diff --git a/borb/toolkit/export/html_to_pdf/read/heading/hr_tag_transformer.py b/borb/toolkit/export/html_to_pdf/read/heading/hr_tag_transformer.py index 6d3937c1e..d2b07a1d9 100644 --- a/borb/toolkit/export/html_to_pdf/read/heading/hr_tag_transformer.py +++ b/borb/toolkit/export/html_to_pdf/read/heading/hr_tag_transformer.py @@ -7,13 +7,9 @@ import typing import xml.etree.ElementTree as ET -from borb.io.read.types import Decimal from borb.pdf.canvas.layout.horizontal_rule import HorizontalRule from borb.pdf.canvas.layout.layout_element import LayoutElement from borb.pdf.canvas.layout.page_layout.page_layout import PageLayout -from borb.pdf.canvas.layout.text.heading import Heading -from borb.pdf.document import Document -from borb.pdf.page.page import Page from borb.toolkit.export.html_to_pdf.read.transformer import ( Transformer, ) diff --git a/borb/toolkit/export/html_to_pdf/read/html/html_tag_transformer.py b/borb/toolkit/export/html_to_pdf/read/html/html_tag_transformer.py index f9759539b..5b78d5fa0 100644 --- a/borb/toolkit/export/html_to_pdf/read/html/html_tag_transformer.py +++ b/borb/toolkit/export/html_to_pdf/read/html/html_tag_transformer.py @@ -9,8 +9,6 @@ from borb.pdf.canvas.layout.layout_element import LayoutElement from borb.pdf.canvas.layout.page_layout.page_layout import PageLayout -from borb.pdf.document import Document -from borb.pdf.page.page import Page from borb.toolkit.export.html_to_pdf.read.transformer import ( Transformer, ) diff --git a/borb/toolkit/export/html_to_pdf/read/image/img_tag_transformer.py b/borb/toolkit/export/html_to_pdf/read/image/img_tag_transformer.py index 87e53bd00..772bebbb3 100644 --- a/borb/toolkit/export/html_to_pdf/read/image/img_tag_transformer.py +++ b/borb/toolkit/export/html_to_pdf/read/image/img_tag_transformer.py @@ -11,9 +11,6 @@ from borb.pdf.canvas.layout.image.image import Image from borb.pdf.canvas.layout.layout_element import LayoutElement from borb.pdf.canvas.layout.page_layout.page_layout import PageLayout -from borb.pdf.canvas.layout.text.heading import Heading -from borb.pdf.document import Document -from borb.pdf.page.page import Page from borb.toolkit.export.html_to_pdf.read.transformer import ( Transformer, ) diff --git a/borb/toolkit/export/html_to_pdf/read/list/li_tag_transformer.py b/borb/toolkit/export/html_to_pdf/read/list/li_tag_transformer.py index 2ea627ebd..53275ad01 100644 --- a/borb/toolkit/export/html_to_pdf/read/list/li_tag_transformer.py +++ b/borb/toolkit/export/html_to_pdf/read/list/li_tag_transformer.py @@ -7,14 +7,10 @@ import typing import xml.etree.ElementTree as ET -from borb.io.read.types import Decimal from borb.pdf.canvas.layout.layout_element import LayoutElement from borb.pdf.canvas.layout.page_layout.page_layout import PageLayout from borb.pdf.canvas.layout.text.chunk_of_text import ChunkOfText -from borb.pdf.canvas.layout.text.chunks_of_text import HeterogeneousParagraph, Span -from borb.pdf.canvas.layout.text.heading import Heading -from borb.pdf.document import Document -from borb.pdf.page.page import Page +from borb.pdf.canvas.layout.text.chunks_of_text import Span from borb.toolkit.export.html_to_pdf.read.transformer import ( Transformer, ) diff --git a/borb/toolkit/export/html_to_pdf/read/list/ol_tag_transformer.py b/borb/toolkit/export/html_to_pdf/read/list/ol_tag_transformer.py index 79556c0f8..07e6403fe 100644 --- a/borb/toolkit/export/html_to_pdf/read/list/ol_tag_transformer.py +++ b/borb/toolkit/export/html_to_pdf/read/list/ol_tag_transformer.py @@ -7,16 +7,9 @@ import typing import xml.etree.ElementTree as ET -from borb.io.read.types import Decimal from borb.pdf.canvas.layout.layout_element import LayoutElement from borb.pdf.canvas.layout.list.ordered_list import OrderedList -from borb.pdf.canvas.layout.list.unordered_list import UnorderedList from borb.pdf.canvas.layout.page_layout.page_layout import PageLayout -from borb.pdf.canvas.layout.text.chunk_of_text import ChunkOfText -from borb.pdf.canvas.layout.text.chunks_of_text import HeterogeneousParagraph -from borb.pdf.canvas.layout.text.heading import Heading -from borb.pdf.document import Document -from borb.pdf.page.page import Page from borb.toolkit.export.html_to_pdf.read.transformer import ( Transformer, ) diff --git a/borb/toolkit/export/html_to_pdf/read/list/ul_tag_transformer.py b/borb/toolkit/export/html_to_pdf/read/list/ul_tag_transformer.py index d3fe1b42a..bfcffe579 100644 --- a/borb/toolkit/export/html_to_pdf/read/list/ul_tag_transformer.py +++ b/borb/toolkit/export/html_to_pdf/read/list/ul_tag_transformer.py @@ -7,15 +7,9 @@ import typing import xml.etree.ElementTree as ET -from borb.io.read.types import Decimal from borb.pdf.canvas.layout.layout_element import LayoutElement from borb.pdf.canvas.layout.list.unordered_list import UnorderedList from borb.pdf.canvas.layout.page_layout.page_layout import PageLayout -from borb.pdf.canvas.layout.text.chunk_of_text import ChunkOfText -from borb.pdf.canvas.layout.text.chunks_of_text import HeterogeneousParagraph -from borb.pdf.canvas.layout.text.heading import Heading -from borb.pdf.document import Document -from borb.pdf.page.page import Page from borb.toolkit.export.html_to_pdf.read.transformer import ( Transformer, ) diff --git a/borb/toolkit/export/html_to_pdf/read/structure/address_tag_transformer.py b/borb/toolkit/export/html_to_pdf/read/structure/address_tag_transformer.py index 53d01c2e5..e71565c43 100644 --- a/borb/toolkit/export/html_to_pdf/read/structure/address_tag_transformer.py +++ b/borb/toolkit/export/html_to_pdf/read/structure/address_tag_transformer.py @@ -7,15 +7,9 @@ import typing import xml.etree.ElementTree as ET -from borb.io.read.types import Decimal from borb.pdf.canvas.layout.layout_element import LayoutElement from borb.pdf.canvas.layout.page_layout.page_layout import PageLayout -from borb.pdf.canvas.layout.text.chunk_of_text import ChunkOfText from borb.pdf.canvas.layout.text.chunks_of_text import HeterogeneousParagraph -from borb.pdf.canvas.layout.text.heading import Heading -from borb.pdf.canvas.layout.text.paragraph import Paragraph -from borb.pdf.document import Document -from borb.pdf.page.page import Page from borb.toolkit.export.html_to_pdf.read.transformer import ( Transformer, ) diff --git a/borb/toolkit/export/html_to_pdf/read/structure/main_tag_transformer.py b/borb/toolkit/export/html_to_pdf/read/structure/main_tag_transformer.py index c0c0dbf90..3602a7e2e 100644 --- a/borb/toolkit/export/html_to_pdf/read/structure/main_tag_transformer.py +++ b/borb/toolkit/export/html_to_pdf/read/structure/main_tag_transformer.py @@ -7,15 +7,8 @@ import typing import xml.etree.ElementTree as ET -from borb.io.read.types import Decimal from borb.pdf.canvas.layout.layout_element import LayoutElement from borb.pdf.canvas.layout.page_layout.page_layout import PageLayout -from borb.pdf.canvas.layout.text.chunk_of_text import ChunkOfText -from borb.pdf.canvas.layout.text.chunks_of_text import HeterogeneousParagraph -from borb.pdf.canvas.layout.text.heading import Heading -from borb.pdf.canvas.layout.text.paragraph import Paragraph -from borb.pdf.document import Document -from borb.pdf.page.page import Page from borb.toolkit.export.html_to_pdf.read.transformer import ( Transformer, ) diff --git a/borb/toolkit/export/html_to_pdf/read/structure/section_tag_transformer.py b/borb/toolkit/export/html_to_pdf/read/structure/section_tag_transformer.py index 79ea39e0a..d9ddcf3d9 100644 --- a/borb/toolkit/export/html_to_pdf/read/structure/section_tag_transformer.py +++ b/borb/toolkit/export/html_to_pdf/read/structure/section_tag_transformer.py @@ -7,15 +7,9 @@ import typing import xml.etree.ElementTree as ET -from borb.io.read.types import Decimal from borb.pdf.canvas.layout.layout_element import LayoutElement from borb.pdf.canvas.layout.page_layout.page_layout import PageLayout -from borb.pdf.canvas.layout.text.chunk_of_text import ChunkOfText -from borb.pdf.canvas.layout.text.chunks_of_text import HeterogeneousParagraph -from borb.pdf.canvas.layout.text.heading import Heading from borb.pdf.canvas.layout.text.paragraph import Paragraph -from borb.pdf.document import Document -from borb.pdf.page.page import Page from borb.toolkit.export.html_to_pdf.read.transformer import ( Transformer, ) diff --git a/borb/toolkit/export/html_to_pdf/read/table/td_tag_transformer.py b/borb/toolkit/export/html_to_pdf/read/table/td_tag_transformer.py index 22324f6e2..583165546 100644 --- a/borb/toolkit/export/html_to_pdf/read/table/td_tag_transformer.py +++ b/borb/toolkit/export/html_to_pdf/read/table/td_tag_transformer.py @@ -7,15 +7,11 @@ import typing import xml.etree.ElementTree as ET -from borb.io.read.types import Decimal from borb.pdf.canvas.layout.layout_element import LayoutElement from borb.pdf.canvas.layout.page_layout.page_layout import PageLayout from borb.pdf.canvas.layout.table.table import TableCell from borb.pdf.canvas.layout.text.chunk_of_text import ChunkOfText from borb.pdf.canvas.layout.text.chunks_of_text import HeterogeneousParagraph -from borb.pdf.canvas.layout.text.heading import Heading -from borb.pdf.document import Document -from borb.pdf.page.page import Page from borb.toolkit.export.html_to_pdf.read.transformer import ( Transformer, ) diff --git a/borb/toolkit/export/html_to_pdf/read/table/th_tag_transformer.py b/borb/toolkit/export/html_to_pdf/read/table/th_tag_transformer.py index c0239f3fa..851eeca84 100644 --- a/borb/toolkit/export/html_to_pdf/read/table/th_tag_transformer.py +++ b/borb/toolkit/export/html_to_pdf/read/table/th_tag_transformer.py @@ -7,7 +7,6 @@ import typing import xml.etree.ElementTree as ET -from borb.io.read.types import Decimal from borb.pdf.canvas.layout.layout_element import LayoutElement from borb.pdf.canvas.layout.page_layout.page_layout import PageLayout from borb.toolkit.export.html_to_pdf.read.transformer import ( diff --git a/borb/toolkit/export/html_to_pdf/read/text/a_tag_transformer.py b/borb/toolkit/export/html_to_pdf/read/text/a_tag_transformer.py index 7ca9d3a0b..3573d8f8f 100644 --- a/borb/toolkit/export/html_to_pdf/read/text/a_tag_transformer.py +++ b/borb/toolkit/export/html_to_pdf/read/text/a_tag_transformer.py @@ -7,15 +7,11 @@ import typing import xml.etree.ElementTree as ET -from borb.io.read.types import Decimal from borb.pdf.canvas.color.color import HexColor from borb.pdf.canvas.layout.layout_element import LayoutElement from borb.pdf.canvas.layout.page_layout.page_layout import PageLayout from borb.pdf.canvas.layout.text.chunk_of_text import ChunkOfText from borb.pdf.canvas.layout.text.chunks_of_text import HeterogeneousParagraph -from borb.pdf.canvas.layout.text.heading import Heading -from borb.pdf.document import Document -from borb.pdf.page.page import Page from borb.toolkit.export.html_to_pdf.read.transformer import ( Transformer, ) diff --git a/borb/toolkit/export/html_to_pdf/read/text/abbr_tag_transformer.py b/borb/toolkit/export/html_to_pdf/read/text/abbr_tag_transformer.py index 6170ea3d6..7a770055d 100644 --- a/borb/toolkit/export/html_to_pdf/read/text/abbr_tag_transformer.py +++ b/borb/toolkit/export/html_to_pdf/read/text/abbr_tag_transformer.py @@ -7,15 +7,10 @@ import typing import xml.etree.ElementTree as ET -from borb.io.read.types import Decimal -from borb.pdf.canvas.color.color import HexColor from borb.pdf.canvas.layout.layout_element import LayoutElement from borb.pdf.canvas.layout.page_layout.page_layout import PageLayout from borb.pdf.canvas.layout.text.chunk_of_text import ChunkOfText from borb.pdf.canvas.layout.text.chunks_of_text import HeterogeneousParagraph -from borb.pdf.canvas.layout.text.heading import Heading -from borb.pdf.document import Document -from borb.pdf.page.page import Page from borb.toolkit.export.html_to_pdf.read.transformer import ( Transformer, ) diff --git a/borb/toolkit/export/html_to_pdf/read/text/bold/b_tag_transformer.py b/borb/toolkit/export/html_to_pdf/read/text/bold/b_tag_transformer.py index e41011b1a..95f37c9aa 100644 --- a/borb/toolkit/export/html_to_pdf/read/text/bold/b_tag_transformer.py +++ b/borb/toolkit/export/html_to_pdf/read/text/bold/b_tag_transformer.py @@ -7,13 +7,9 @@ import typing import xml.etree.ElementTree as ET -from borb.io.read.types import Decimal from borb.pdf.canvas.layout.layout_element import LayoutElement from borb.pdf.canvas.layout.page_layout.page_layout import PageLayout from borb.pdf.canvas.layout.text.chunk_of_text import ChunkOfText -from borb.pdf.canvas.layout.text.heading import Heading -from borb.pdf.document import Document -from borb.pdf.page.page import Page from borb.toolkit.export.html_to_pdf.read.transformer import ( Transformer, ) diff --git a/borb/toolkit/export/html_to_pdf/read/text/bold/strong_tag_transformer.py b/borb/toolkit/export/html_to_pdf/read/text/bold/strong_tag_transformer.py index f6f76feae..40faa5eb8 100644 --- a/borb/toolkit/export/html_to_pdf/read/text/bold/strong_tag_transformer.py +++ b/borb/toolkit/export/html_to_pdf/read/text/bold/strong_tag_transformer.py @@ -7,13 +7,9 @@ import typing import xml.etree.ElementTree as ET -from borb.io.read.types import Decimal from borb.pdf.canvas.layout.layout_element import LayoutElement from borb.pdf.canvas.layout.page_layout.page_layout import PageLayout from borb.pdf.canvas.layout.text.chunk_of_text import ChunkOfText -from borb.pdf.canvas.layout.text.heading import Heading -from borb.pdf.document import Document -from borb.pdf.page.page import Page from borb.toolkit.export.html_to_pdf.read.transformer import ( Transformer, ) diff --git a/borb/toolkit/export/html_to_pdf/read/text/br_tag_transformer.py b/borb/toolkit/export/html_to_pdf/read/text/br_tag_transformer.py index a3dfc379a..f67053035 100644 --- a/borb/toolkit/export/html_to_pdf/read/text/br_tag_transformer.py +++ b/borb/toolkit/export/html_to_pdf/read/text/br_tag_transformer.py @@ -7,14 +7,9 @@ import typing import xml.etree.ElementTree as ET -from borb.io.read.types import Decimal from borb.pdf.canvas.layout.layout_element import LayoutElement from borb.pdf.canvas.layout.page_layout.page_layout import PageLayout -from borb.pdf.canvas.layout.text.chunk_of_text import ChunkOfText from borb.pdf.canvas.layout.text.chunks_of_text import HeterogeneousParagraph -from borb.pdf.canvas.layout.text.heading import Heading -from borb.pdf.document import Document -from borb.pdf.page.page import Page from borb.toolkit.export.html_to_pdf.read.transformer import ( Transformer, ) diff --git a/borb/toolkit/export/html_to_pdf/read/text/code_tag_transformer.py b/borb/toolkit/export/html_to_pdf/read/text/code_tag_transformer.py index a2064fa2c..b6f7cf78d 100644 --- a/borb/toolkit/export/html_to_pdf/read/text/code_tag_transformer.py +++ b/borb/toolkit/export/html_to_pdf/read/text/code_tag_transformer.py @@ -7,16 +7,12 @@ import typing import xml.etree.ElementTree as ET -from borb.io.read.types import Decimal from borb.pdf.canvas.color.color import HexColor from borb.pdf.canvas.font.simple_font.font_type_1 import StandardType1Font from borb.pdf.canvas.layout.layout_element import LayoutElement from borb.pdf.canvas.layout.page_layout.page_layout import PageLayout from borb.pdf.canvas.layout.text.chunk_of_text import ChunkOfText from borb.pdf.canvas.layout.text.chunks_of_text import HeterogeneousParagraph -from borb.pdf.canvas.layout.text.heading import Heading -from borb.pdf.document import Document -from borb.pdf.page.page import Page from borb.toolkit.export.html_to_pdf.read.transformer import ( Transformer, ) diff --git a/borb/toolkit/export/html_to_pdf/read/text/italic/em_tag_transformer.py b/borb/toolkit/export/html_to_pdf/read/text/italic/em_tag_transformer.py index c0526be59..b574b4f0f 100644 --- a/borb/toolkit/export/html_to_pdf/read/text/italic/em_tag_transformer.py +++ b/borb/toolkit/export/html_to_pdf/read/text/italic/em_tag_transformer.py @@ -7,13 +7,9 @@ import typing import xml.etree.ElementTree as ET -from borb.io.read.types import Decimal from borb.pdf.canvas.layout.layout_element import LayoutElement from borb.pdf.canvas.layout.page_layout.page_layout import PageLayout from borb.pdf.canvas.layout.text.chunk_of_text import ChunkOfText -from borb.pdf.canvas.layout.text.heading import Heading -from borb.pdf.document import Document -from borb.pdf.page.page import Page from borb.toolkit.export.html_to_pdf.read.transformer import ( Transformer, ) diff --git a/borb/toolkit/export/html_to_pdf/read/text/italic/i_tag_transformer.py b/borb/toolkit/export/html_to_pdf/read/text/italic/i_tag_transformer.py index e9e6a95d7..968ae3804 100644 --- a/borb/toolkit/export/html_to_pdf/read/text/italic/i_tag_transformer.py +++ b/borb/toolkit/export/html_to_pdf/read/text/italic/i_tag_transformer.py @@ -7,13 +7,9 @@ import typing import xml.etree.ElementTree as ET -from borb.io.read.types import Decimal from borb.pdf.canvas.layout.layout_element import LayoutElement from borb.pdf.canvas.layout.page_layout.page_layout import PageLayout from borb.pdf.canvas.layout.text.chunk_of_text import ChunkOfText -from borb.pdf.canvas.layout.text.heading import Heading -from borb.pdf.document import Document -from borb.pdf.page.page import Page from borb.toolkit.export.html_to_pdf.read.transformer import ( Transformer, ) diff --git a/borb/toolkit/export/html_to_pdf/read/text/mark_tag_transformer.py b/borb/toolkit/export/html_to_pdf/read/text/mark_tag_transformer.py index edf5da1b6..e17a2a215 100644 --- a/borb/toolkit/export/html_to_pdf/read/text/mark_tag_transformer.py +++ b/borb/toolkit/export/html_to_pdf/read/text/mark_tag_transformer.py @@ -7,15 +7,11 @@ import typing import xml.etree.ElementTree as ET -from borb.io.read.types import Decimal from borb.pdf.canvas.color.color import HexColor from borb.pdf.canvas.layout.layout_element import LayoutElement from borb.pdf.canvas.layout.page_layout.page_layout import PageLayout from borb.pdf.canvas.layout.text.chunk_of_text import ChunkOfText from borb.pdf.canvas.layout.text.chunks_of_text import HeterogeneousParagraph -from borb.pdf.canvas.layout.text.heading import Heading -from borb.pdf.document import Document -from borb.pdf.page.page import Page from borb.toolkit.export.html_to_pdf.read.transformer import ( Transformer, ) diff --git a/borb/toolkit/export/html_to_pdf/read/text/p_tag_transformer.py b/borb/toolkit/export/html_to_pdf/read/text/p_tag_transformer.py index fb5fcc891..fd027a785 100644 --- a/borb/toolkit/export/html_to_pdf/read/text/p_tag_transformer.py +++ b/borb/toolkit/export/html_to_pdf/read/text/p_tag_transformer.py @@ -7,14 +7,10 @@ import typing import xml.etree.ElementTree as ET -from borb.io.read.types import Decimal from borb.pdf.canvas.layout.layout_element import LayoutElement from borb.pdf.canvas.layout.page_layout.page_layout import PageLayout from borb.pdf.canvas.layout.text.chunk_of_text import ChunkOfText from borb.pdf.canvas.layout.text.chunks_of_text import HeterogeneousParagraph -from borb.pdf.canvas.layout.text.heading import Heading -from borb.pdf.document import Document -from borb.pdf.page.page import Page from borb.toolkit.export.html_to_pdf.read.transformer import ( Transformer, ) diff --git a/borb/toolkit/export/html_to_pdf/tag_transformer/body/body_tag_transformer.py b/borb/toolkit/export/html_to_pdf/tag_transformer/body/body_tag_transformer.py index d7e1a7301..40ac43bf9 100644 --- a/borb/toolkit/export/html_to_pdf/tag_transformer/body/body_tag_transformer.py +++ b/borb/toolkit/export/html_to_pdf/tag_transformer/body/body_tag_transformer.py @@ -10,8 +10,6 @@ from borb.pdf.canvas.layout.layout_element import LayoutElement from borb.pdf.canvas.layout.page_layout.page_layout import PageLayout from borb.pdf.canvas.layout.text.chunk_of_text import ChunkOfText -from borb.pdf.document import Document -from borb.pdf.page.page import Page from borb.toolkit.export.html_to_pdf.tag_transformer.base_tag_transformer import ( BaseTagTransformer, ) diff --git a/borb/toolkit/export/html_to_pdf/tag_transformer/head/head_tag_transformer.py b/borb/toolkit/export/html_to_pdf/tag_transformer/head/head_tag_transformer.py index f8d9d6215..fb4d7b3a6 100644 --- a/borb/toolkit/export/html_to_pdf/tag_transformer/head/head_tag_transformer.py +++ b/borb/toolkit/export/html_to_pdf/tag_transformer/head/head_tag_transformer.py @@ -9,8 +9,6 @@ from borb.pdf.canvas.layout.layout_element import LayoutElement from borb.pdf.canvas.layout.page_layout.page_layout import PageLayout -from borb.pdf.document import Document -from borb.pdf.page.page import Page from borb.toolkit.export.html_to_pdf.tag_transformer.base_tag_transformer import ( BaseTagTransformer, ) diff --git a/borb/toolkit/export/html_to_pdf/tag_transformer/head/meta_tag_transformer.py b/borb/toolkit/export/html_to_pdf/tag_transformer/head/meta_tag_transformer.py index 1d865eaab..2954c8be0 100644 --- a/borb/toolkit/export/html_to_pdf/tag_transformer/head/meta_tag_transformer.py +++ b/borb/toolkit/export/html_to_pdf/tag_transformer/head/meta_tag_transformer.py @@ -11,7 +11,6 @@ from borb.pdf.canvas.layout.layout_element import LayoutElement from borb.pdf.canvas.layout.page_layout.page_layout import PageLayout from borb.pdf.document import Document -from borb.pdf.page.page import Page from borb.pdf.xref.plaintext_xref import PlainTextXREF from borb.toolkit.export.html_to_pdf.tag_transformer.base_tag_transformer import ( BaseTagTransformer, diff --git a/borb/toolkit/export/html_to_pdf/tag_transformer/heading/h1_tag_transformer.py b/borb/toolkit/export/html_to_pdf/tag_transformer/heading/h1_tag_transformer.py index e4b867e16..c5eb3b54b 100644 --- a/borb/toolkit/export/html_to_pdf/tag_transformer/heading/h1_tag_transformer.py +++ b/borb/toolkit/export/html_to_pdf/tag_transformer/heading/h1_tag_transformer.py @@ -11,8 +11,6 @@ from borb.pdf.canvas.layout.layout_element import LayoutElement from borb.pdf.canvas.layout.page_layout.page_layout import PageLayout from borb.pdf.canvas.layout.text.heading import Heading -from borb.pdf.document import Document -from borb.pdf.page.page import Page from borb.toolkit.export.html_to_pdf.tag_transformer.base_tag_transformer import ( BaseTagTransformer, ) diff --git a/borb/toolkit/export/html_to_pdf/tag_transformer/heading/h2_tag_transformer.py b/borb/toolkit/export/html_to_pdf/tag_transformer/heading/h2_tag_transformer.py index a6c95fe3b..db718511f 100644 --- a/borb/toolkit/export/html_to_pdf/tag_transformer/heading/h2_tag_transformer.py +++ b/borb/toolkit/export/html_to_pdf/tag_transformer/heading/h2_tag_transformer.py @@ -11,8 +11,6 @@ from borb.pdf.canvas.layout.layout_element import LayoutElement from borb.pdf.canvas.layout.page_layout.page_layout import PageLayout from borb.pdf.canvas.layout.text.heading import Heading -from borb.pdf.document import Document -from borb.pdf.page.page import Page from borb.toolkit.export.html_to_pdf.tag_transformer.base_tag_transformer import ( BaseTagTransformer, ) diff --git a/borb/toolkit/export/html_to_pdf/tag_transformer/heading/h3_tag_transformer.py b/borb/toolkit/export/html_to_pdf/tag_transformer/heading/h3_tag_transformer.py index 12ffccebc..836137d36 100644 --- a/borb/toolkit/export/html_to_pdf/tag_transformer/heading/h3_tag_transformer.py +++ b/borb/toolkit/export/html_to_pdf/tag_transformer/heading/h3_tag_transformer.py @@ -11,8 +11,6 @@ from borb.pdf.canvas.layout.layout_element import LayoutElement from borb.pdf.canvas.layout.page_layout.page_layout import PageLayout from borb.pdf.canvas.layout.text.heading import Heading -from borb.pdf.document import Document -from borb.pdf.page.page import Page from borb.toolkit.export.html_to_pdf.tag_transformer.base_tag_transformer import ( BaseTagTransformer, ) diff --git a/borb/toolkit/export/html_to_pdf/tag_transformer/heading/h4_tag_transformer.py b/borb/toolkit/export/html_to_pdf/tag_transformer/heading/h4_tag_transformer.py index ba0945f42..1e2e6ce8a 100644 --- a/borb/toolkit/export/html_to_pdf/tag_transformer/heading/h4_tag_transformer.py +++ b/borb/toolkit/export/html_to_pdf/tag_transformer/heading/h4_tag_transformer.py @@ -11,8 +11,6 @@ from borb.pdf.canvas.layout.layout_element import LayoutElement from borb.pdf.canvas.layout.page_layout.page_layout import PageLayout from borb.pdf.canvas.layout.text.heading import Heading -from borb.pdf.document import Document -from borb.pdf.page.page import Page from borb.toolkit.export.html_to_pdf.tag_transformer.base_tag_transformer import ( BaseTagTransformer, ) diff --git a/borb/toolkit/export/html_to_pdf/tag_transformer/heading/h5_tag_transformer.py b/borb/toolkit/export/html_to_pdf/tag_transformer/heading/h5_tag_transformer.py index f79fa9b4f..9ec9e8a53 100644 --- a/borb/toolkit/export/html_to_pdf/tag_transformer/heading/h5_tag_transformer.py +++ b/borb/toolkit/export/html_to_pdf/tag_transformer/heading/h5_tag_transformer.py @@ -11,8 +11,6 @@ from borb.pdf.canvas.layout.layout_element import LayoutElement from borb.pdf.canvas.layout.page_layout.page_layout import PageLayout from borb.pdf.canvas.layout.text.heading import Heading -from borb.pdf.document import Document -from borb.pdf.page.page import Page from borb.toolkit.export.html_to_pdf.tag_transformer.base_tag_transformer import ( BaseTagTransformer, ) diff --git a/borb/toolkit/export/html_to_pdf/tag_transformer/heading/h6_tag_transformer.py b/borb/toolkit/export/html_to_pdf/tag_transformer/heading/h6_tag_transformer.py index 7f8f8fce1..3ebc911c5 100644 --- a/borb/toolkit/export/html_to_pdf/tag_transformer/heading/h6_tag_transformer.py +++ b/borb/toolkit/export/html_to_pdf/tag_transformer/heading/h6_tag_transformer.py @@ -11,8 +11,6 @@ from borb.pdf.canvas.layout.layout_element import LayoutElement from borb.pdf.canvas.layout.page_layout.page_layout import PageLayout from borb.pdf.canvas.layout.text.heading import Heading -from borb.pdf.document import Document -from borb.pdf.page.page import Page from borb.toolkit.export.html_to_pdf.tag_transformer.base_tag_transformer import ( BaseTagTransformer, ) diff --git a/borb/toolkit/export/html_to_pdf/tag_transformer/heading/hr_tag_transformer.py b/borb/toolkit/export/html_to_pdf/tag_transformer/heading/hr_tag_transformer.py index 35af11476..eb6ec37fa 100644 --- a/borb/toolkit/export/html_to_pdf/tag_transformer/heading/hr_tag_transformer.py +++ b/borb/toolkit/export/html_to_pdf/tag_transformer/heading/hr_tag_transformer.py @@ -7,13 +7,9 @@ import typing import xml.etree.ElementTree as ET -from borb.io.read.types import Decimal from borb.pdf.canvas.layout.horizontal_rule import HorizontalRule from borb.pdf.canvas.layout.layout_element import LayoutElement from borb.pdf.canvas.layout.page_layout.page_layout import PageLayout -from borb.pdf.canvas.layout.text.heading import Heading -from borb.pdf.document import Document -from borb.pdf.page.page import Page from borb.toolkit.export.html_to_pdf.tag_transformer.base_tag_transformer import ( BaseTagTransformer, ) diff --git a/borb/toolkit/export/html_to_pdf/tag_transformer/html_tag_transformer.py b/borb/toolkit/export/html_to_pdf/tag_transformer/html_tag_transformer.py index b00c2bc64..a7ba31f91 100644 --- a/borb/toolkit/export/html_to_pdf/tag_transformer/html_tag_transformer.py +++ b/borb/toolkit/export/html_to_pdf/tag_transformer/html_tag_transformer.py @@ -9,8 +9,6 @@ from borb.pdf.canvas.layout.layout_element import LayoutElement from borb.pdf.canvas.layout.page_layout.page_layout import PageLayout -from borb.pdf.document import Document -from borb.pdf.page.page import Page from borb.toolkit.export.html_to_pdf.tag_transformer.base_tag_transformer import ( BaseTagTransformer, ) diff --git a/borb/toolkit/export/html_to_pdf/tag_transformer/image/img_tag_transformer.py b/borb/toolkit/export/html_to_pdf/tag_transformer/image/img_tag_transformer.py index 9b6be9426..0df016334 100644 --- a/borb/toolkit/export/html_to_pdf/tag_transformer/image/img_tag_transformer.py +++ b/borb/toolkit/export/html_to_pdf/tag_transformer/image/img_tag_transformer.py @@ -11,9 +11,6 @@ from borb.pdf.canvas.layout.image.image import Image from borb.pdf.canvas.layout.layout_element import LayoutElement from borb.pdf.canvas.layout.page_layout.page_layout import PageLayout -from borb.pdf.canvas.layout.text.heading import Heading -from borb.pdf.document import Document -from borb.pdf.page.page import Page from borb.toolkit.export.html_to_pdf.tag_transformer.base_tag_transformer import ( BaseTagTransformer, ) diff --git a/borb/toolkit/export/html_to_pdf/tag_transformer/list/li_tag_transformer.py b/borb/toolkit/export/html_to_pdf/tag_transformer/list/li_tag_transformer.py index 88cac018f..5b8ffc831 100644 --- a/borb/toolkit/export/html_to_pdf/tag_transformer/list/li_tag_transformer.py +++ b/borb/toolkit/export/html_to_pdf/tag_transformer/list/li_tag_transformer.py @@ -7,14 +7,10 @@ import typing import xml.etree.ElementTree as ET -from borb.io.read.types import Decimal from borb.pdf.canvas.layout.layout_element import LayoutElement from borb.pdf.canvas.layout.page_layout.page_layout import PageLayout from borb.pdf.canvas.layout.text.chunk_of_text import ChunkOfText -from borb.pdf.canvas.layout.text.chunks_of_text import HeterogeneousParagraph, Span -from borb.pdf.canvas.layout.text.heading import Heading -from borb.pdf.document import Document -from borb.pdf.page.page import Page +from borb.pdf.canvas.layout.text.chunks_of_text import Span from borb.toolkit.export.html_to_pdf.tag_transformer.base_tag_transformer import ( BaseTagTransformer, ) diff --git a/borb/toolkit/export/html_to_pdf/tag_transformer/list/ol_tag_transformer.py b/borb/toolkit/export/html_to_pdf/tag_transformer/list/ol_tag_transformer.py index f47d43525..816bd55bb 100644 --- a/borb/toolkit/export/html_to_pdf/tag_transformer/list/ol_tag_transformer.py +++ b/borb/toolkit/export/html_to_pdf/tag_transformer/list/ol_tag_transformer.py @@ -7,16 +7,9 @@ import typing import xml.etree.ElementTree as ET -from borb.io.read.types import Decimal from borb.pdf.canvas.layout.layout_element import LayoutElement from borb.pdf.canvas.layout.list.ordered_list import OrderedList -from borb.pdf.canvas.layout.list.unordered_list import UnorderedList from borb.pdf.canvas.layout.page_layout.page_layout import PageLayout -from borb.pdf.canvas.layout.text.chunk_of_text import ChunkOfText -from borb.pdf.canvas.layout.text.chunks_of_text import HeterogeneousParagraph -from borb.pdf.canvas.layout.text.heading import Heading -from borb.pdf.document import Document -from borb.pdf.page.page import Page from borb.toolkit.export.html_to_pdf.tag_transformer.base_tag_transformer import ( BaseTagTransformer, ) diff --git a/borb/toolkit/export/html_to_pdf/tag_transformer/list/ul_tag_transformer.py b/borb/toolkit/export/html_to_pdf/tag_transformer/list/ul_tag_transformer.py index 7dc1602d6..968cf8394 100644 --- a/borb/toolkit/export/html_to_pdf/tag_transformer/list/ul_tag_transformer.py +++ b/borb/toolkit/export/html_to_pdf/tag_transformer/list/ul_tag_transformer.py @@ -7,15 +7,9 @@ import typing import xml.etree.ElementTree as ET -from borb.io.read.types import Decimal from borb.pdf.canvas.layout.layout_element import LayoutElement from borb.pdf.canvas.layout.list.unordered_list import UnorderedList from borb.pdf.canvas.layout.page_layout.page_layout import PageLayout -from borb.pdf.canvas.layout.text.chunk_of_text import ChunkOfText -from borb.pdf.canvas.layout.text.chunks_of_text import HeterogeneousParagraph -from borb.pdf.canvas.layout.text.heading import Heading -from borb.pdf.document import Document -from borb.pdf.page.page import Page from borb.toolkit.export.html_to_pdf.tag_transformer.base_tag_transformer import ( BaseTagTransformer, ) diff --git a/borb/toolkit/export/html_to_pdf/tag_transformer/structure/address_tag_transformer.py b/borb/toolkit/export/html_to_pdf/tag_transformer/structure/address_tag_transformer.py index 6095db258..548f74f82 100644 --- a/borb/toolkit/export/html_to_pdf/tag_transformer/structure/address_tag_transformer.py +++ b/borb/toolkit/export/html_to_pdf/tag_transformer/structure/address_tag_transformer.py @@ -7,15 +7,9 @@ import typing import xml.etree.ElementTree as ET -from borb.io.read.types import Decimal from borb.pdf.canvas.layout.layout_element import LayoutElement from borb.pdf.canvas.layout.page_layout.page_layout import PageLayout -from borb.pdf.canvas.layout.text.chunk_of_text import ChunkOfText from borb.pdf.canvas.layout.text.chunks_of_text import HeterogeneousParagraph -from borb.pdf.canvas.layout.text.heading import Heading -from borb.pdf.canvas.layout.text.paragraph import Paragraph -from borb.pdf.document import Document -from borb.pdf.page.page import Page from borb.toolkit.export.html_to_pdf.tag_transformer.base_tag_transformer import ( BaseTagTransformer, ) diff --git a/borb/toolkit/export/html_to_pdf/tag_transformer/structure/main_tag_transformer.py b/borb/toolkit/export/html_to_pdf/tag_transformer/structure/main_tag_transformer.py index 2da3a30dc..285812973 100644 --- a/borb/toolkit/export/html_to_pdf/tag_transformer/structure/main_tag_transformer.py +++ b/borb/toolkit/export/html_to_pdf/tag_transformer/structure/main_tag_transformer.py @@ -7,15 +7,8 @@ import typing import xml.etree.ElementTree as ET -from borb.io.read.types import Decimal from borb.pdf.canvas.layout.layout_element import LayoutElement from borb.pdf.canvas.layout.page_layout.page_layout import PageLayout -from borb.pdf.canvas.layout.text.chunk_of_text import ChunkOfText -from borb.pdf.canvas.layout.text.chunks_of_text import HeterogeneousParagraph -from borb.pdf.canvas.layout.text.heading import Heading -from borb.pdf.canvas.layout.text.paragraph import Paragraph -from borb.pdf.document import Document -from borb.pdf.page.page import Page from borb.toolkit.export.html_to_pdf.tag_transformer.base_tag_transformer import ( BaseTagTransformer, ) diff --git a/borb/toolkit/export/html_to_pdf/tag_transformer/structure/section_tag_transformer.py b/borb/toolkit/export/html_to_pdf/tag_transformer/structure/section_tag_transformer.py index b5690a100..5239c8124 100644 --- a/borb/toolkit/export/html_to_pdf/tag_transformer/structure/section_tag_transformer.py +++ b/borb/toolkit/export/html_to_pdf/tag_transformer/structure/section_tag_transformer.py @@ -7,15 +7,9 @@ import typing import xml.etree.ElementTree as ET -from borb.io.read.types import Decimal from borb.pdf.canvas.layout.layout_element import LayoutElement from borb.pdf.canvas.layout.page_layout.page_layout import PageLayout -from borb.pdf.canvas.layout.text.chunk_of_text import ChunkOfText -from borb.pdf.canvas.layout.text.chunks_of_text import HeterogeneousParagraph -from borb.pdf.canvas.layout.text.heading import Heading from borb.pdf.canvas.layout.text.paragraph import Paragraph -from borb.pdf.document import Document -from borb.pdf.page.page import Page from borb.toolkit.export.html_to_pdf.tag_transformer.base_tag_transformer import ( BaseTagTransformer, ) diff --git a/borb/toolkit/export/html_to_pdf/tag_transformer/table/td_tag_transformer.py b/borb/toolkit/export/html_to_pdf/tag_transformer/table/td_tag_transformer.py index 58abe5661..96057366f 100644 --- a/borb/toolkit/export/html_to_pdf/tag_transformer/table/td_tag_transformer.py +++ b/borb/toolkit/export/html_to_pdf/tag_transformer/table/td_tag_transformer.py @@ -7,15 +7,11 @@ import typing import xml.etree.ElementTree as ET -from borb.io.read.types import Decimal from borb.pdf.canvas.layout.layout_element import LayoutElement from borb.pdf.canvas.layout.page_layout.page_layout import PageLayout from borb.pdf.canvas.layout.table.table import TableCell from borb.pdf.canvas.layout.text.chunk_of_text import ChunkOfText from borb.pdf.canvas.layout.text.chunks_of_text import HeterogeneousParagraph -from borb.pdf.canvas.layout.text.heading import Heading -from borb.pdf.document import Document -from borb.pdf.page.page import Page from borb.toolkit.export.html_to_pdf.tag_transformer.base_tag_transformer import ( BaseTagTransformer, ) diff --git a/borb/toolkit/export/html_to_pdf/tag_transformer/table/th_tag_transformer.py b/borb/toolkit/export/html_to_pdf/tag_transformer/table/th_tag_transformer.py index e2ace6db4..81f54fa55 100644 --- a/borb/toolkit/export/html_to_pdf/tag_transformer/table/th_tag_transformer.py +++ b/borb/toolkit/export/html_to_pdf/tag_transformer/table/th_tag_transformer.py @@ -7,7 +7,6 @@ import typing import xml.etree.ElementTree as ET -from borb.io.read.types import Decimal from borb.pdf.canvas.layout.layout_element import LayoutElement from borb.pdf.canvas.layout.page_layout.page_layout import PageLayout from borb.toolkit.export.html_to_pdf.tag_transformer.base_tag_transformer import ( diff --git a/borb/toolkit/export/html_to_pdf/tag_transformer/text/a_tag_transformer.py b/borb/toolkit/export/html_to_pdf/tag_transformer/text/a_tag_transformer.py index 4d439b9a6..248a862b6 100644 --- a/borb/toolkit/export/html_to_pdf/tag_transformer/text/a_tag_transformer.py +++ b/borb/toolkit/export/html_to_pdf/tag_transformer/text/a_tag_transformer.py @@ -7,15 +7,11 @@ import typing import xml.etree.ElementTree as ET -from borb.io.read.types import Decimal from borb.pdf.canvas.color.color import HexColor from borb.pdf.canvas.layout.layout_element import LayoutElement from borb.pdf.canvas.layout.page_layout.page_layout import PageLayout from borb.pdf.canvas.layout.text.chunk_of_text import ChunkOfText from borb.pdf.canvas.layout.text.chunks_of_text import HeterogeneousParagraph -from borb.pdf.canvas.layout.text.heading import Heading -from borb.pdf.document import Document -from borb.pdf.page.page import Page from borb.toolkit.export.html_to_pdf.tag_transformer.base_tag_transformer import ( BaseTagTransformer, ) diff --git a/borb/toolkit/export/html_to_pdf/tag_transformer/text/abbr_tag_transformer.py b/borb/toolkit/export/html_to_pdf/tag_transformer/text/abbr_tag_transformer.py index 859630467..0f0e21c7c 100644 --- a/borb/toolkit/export/html_to_pdf/tag_transformer/text/abbr_tag_transformer.py +++ b/borb/toolkit/export/html_to_pdf/tag_transformer/text/abbr_tag_transformer.py @@ -7,15 +7,10 @@ import typing import xml.etree.ElementTree as ET -from borb.io.read.types import Decimal -from borb.pdf.canvas.color.color import HexColor from borb.pdf.canvas.layout.layout_element import LayoutElement from borb.pdf.canvas.layout.page_layout.page_layout import PageLayout from borb.pdf.canvas.layout.text.chunk_of_text import ChunkOfText from borb.pdf.canvas.layout.text.chunks_of_text import HeterogeneousParagraph -from borb.pdf.canvas.layout.text.heading import Heading -from borb.pdf.document import Document -from borb.pdf.page.page import Page from borb.toolkit.export.html_to_pdf.tag_transformer.base_tag_transformer import ( BaseTagTransformer, ) diff --git a/borb/toolkit/export/html_to_pdf/tag_transformer/text/bold/b_tag_transformer.py b/borb/toolkit/export/html_to_pdf/tag_transformer/text/bold/b_tag_transformer.py index cc6a44bd4..8cef28335 100644 --- a/borb/toolkit/export/html_to_pdf/tag_transformer/text/bold/b_tag_transformer.py +++ b/borb/toolkit/export/html_to_pdf/tag_transformer/text/bold/b_tag_transformer.py @@ -7,13 +7,9 @@ import typing import xml.etree.ElementTree as ET -from borb.io.read.types import Decimal from borb.pdf.canvas.layout.layout_element import LayoutElement from borb.pdf.canvas.layout.page_layout.page_layout import PageLayout from borb.pdf.canvas.layout.text.chunk_of_text import ChunkOfText -from borb.pdf.canvas.layout.text.heading import Heading -from borb.pdf.document import Document -from borb.pdf.page.page import Page from borb.toolkit.export.html_to_pdf.tag_transformer.base_tag_transformer import ( BaseTagTransformer, ) diff --git a/borb/toolkit/export/html_to_pdf/tag_transformer/text/bold/strong_tag_transformer.py b/borb/toolkit/export/html_to_pdf/tag_transformer/text/bold/strong_tag_transformer.py index f29d853b4..c3161de55 100644 --- a/borb/toolkit/export/html_to_pdf/tag_transformer/text/bold/strong_tag_transformer.py +++ b/borb/toolkit/export/html_to_pdf/tag_transformer/text/bold/strong_tag_transformer.py @@ -7,13 +7,9 @@ import typing import xml.etree.ElementTree as ET -from borb.io.read.types import Decimal from borb.pdf.canvas.layout.layout_element import LayoutElement from borb.pdf.canvas.layout.page_layout.page_layout import PageLayout from borb.pdf.canvas.layout.text.chunk_of_text import ChunkOfText -from borb.pdf.canvas.layout.text.heading import Heading -from borb.pdf.document import Document -from borb.pdf.page.page import Page from borb.toolkit.export.html_to_pdf.tag_transformer.base_tag_transformer import ( BaseTagTransformer, ) diff --git a/borb/toolkit/export/html_to_pdf/tag_transformer/text/br_tag_transformer.py b/borb/toolkit/export/html_to_pdf/tag_transformer/text/br_tag_transformer.py index 332ea74af..fa7e1e863 100644 --- a/borb/toolkit/export/html_to_pdf/tag_transformer/text/br_tag_transformer.py +++ b/borb/toolkit/export/html_to_pdf/tag_transformer/text/br_tag_transformer.py @@ -7,14 +7,9 @@ import typing import xml.etree.ElementTree as ET -from borb.io.read.types import Decimal from borb.pdf.canvas.layout.layout_element import LayoutElement from borb.pdf.canvas.layout.page_layout.page_layout import PageLayout -from borb.pdf.canvas.layout.text.chunk_of_text import ChunkOfText from borb.pdf.canvas.layout.text.chunks_of_text import HeterogeneousParagraph -from borb.pdf.canvas.layout.text.heading import Heading -from borb.pdf.document import Document -from borb.pdf.page.page import Page from borb.toolkit.export.html_to_pdf.tag_transformer.base_tag_transformer import ( BaseTagTransformer, ) diff --git a/borb/toolkit/export/html_to_pdf/tag_transformer/text/code_tag_transformer.py b/borb/toolkit/export/html_to_pdf/tag_transformer/text/code_tag_transformer.py index ca89a8436..976512132 100644 --- a/borb/toolkit/export/html_to_pdf/tag_transformer/text/code_tag_transformer.py +++ b/borb/toolkit/export/html_to_pdf/tag_transformer/text/code_tag_transformer.py @@ -7,16 +7,12 @@ import typing import xml.etree.ElementTree as ET -from borb.io.read.types import Decimal from borb.pdf.canvas.color.color import HexColor from borb.pdf.canvas.font.simple_font.font_type_1 import StandardType1Font from borb.pdf.canvas.layout.layout_element import LayoutElement from borb.pdf.canvas.layout.page_layout.page_layout import PageLayout from borb.pdf.canvas.layout.text.chunk_of_text import ChunkOfText from borb.pdf.canvas.layout.text.chunks_of_text import HeterogeneousParagraph -from borb.pdf.canvas.layout.text.heading import Heading -from borb.pdf.document import Document -from borb.pdf.page.page import Page from borb.toolkit.export.html_to_pdf.tag_transformer.base_tag_transformer import ( BaseTagTransformer, ) diff --git a/borb/toolkit/export/html_to_pdf/tag_transformer/text/italic/em_tag_transformer.py b/borb/toolkit/export/html_to_pdf/tag_transformer/text/italic/em_tag_transformer.py index d6fd4aaf6..74a34187b 100644 --- a/borb/toolkit/export/html_to_pdf/tag_transformer/text/italic/em_tag_transformer.py +++ b/borb/toolkit/export/html_to_pdf/tag_transformer/text/italic/em_tag_transformer.py @@ -7,13 +7,9 @@ import typing import xml.etree.ElementTree as ET -from borb.io.read.types import Decimal from borb.pdf.canvas.layout.layout_element import LayoutElement from borb.pdf.canvas.layout.page_layout.page_layout import PageLayout from borb.pdf.canvas.layout.text.chunk_of_text import ChunkOfText -from borb.pdf.canvas.layout.text.heading import Heading -from borb.pdf.document import Document -from borb.pdf.page.page import Page from borb.toolkit.export.html_to_pdf.tag_transformer.base_tag_transformer import ( BaseTagTransformer, ) diff --git a/borb/toolkit/export/html_to_pdf/tag_transformer/text/italic/i_tag_transformer.py b/borb/toolkit/export/html_to_pdf/tag_transformer/text/italic/i_tag_transformer.py index c8365f5ff..2b8ca2515 100644 --- a/borb/toolkit/export/html_to_pdf/tag_transformer/text/italic/i_tag_transformer.py +++ b/borb/toolkit/export/html_to_pdf/tag_transformer/text/italic/i_tag_transformer.py @@ -7,13 +7,9 @@ import typing import xml.etree.ElementTree as ET -from borb.io.read.types import Decimal from borb.pdf.canvas.layout.layout_element import LayoutElement from borb.pdf.canvas.layout.page_layout.page_layout import PageLayout from borb.pdf.canvas.layout.text.chunk_of_text import ChunkOfText -from borb.pdf.canvas.layout.text.heading import Heading -from borb.pdf.document import Document -from borb.pdf.page.page import Page from borb.toolkit.export.html_to_pdf.tag_transformer.base_tag_transformer import ( BaseTagTransformer, ) diff --git a/borb/toolkit/export/html_to_pdf/tag_transformer/text/mark_tag_transformer.py b/borb/toolkit/export/html_to_pdf/tag_transformer/text/mark_tag_transformer.py index b210d332c..a2f423bad 100644 --- a/borb/toolkit/export/html_to_pdf/tag_transformer/text/mark_tag_transformer.py +++ b/borb/toolkit/export/html_to_pdf/tag_transformer/text/mark_tag_transformer.py @@ -7,15 +7,11 @@ import typing import xml.etree.ElementTree as ET -from borb.io.read.types import Decimal from borb.pdf.canvas.color.color import HexColor from borb.pdf.canvas.layout.layout_element import LayoutElement from borb.pdf.canvas.layout.page_layout.page_layout import PageLayout from borb.pdf.canvas.layout.text.chunk_of_text import ChunkOfText from borb.pdf.canvas.layout.text.chunks_of_text import HeterogeneousParagraph -from borb.pdf.canvas.layout.text.heading import Heading -from borb.pdf.document import Document -from borb.pdf.page.page import Page from borb.toolkit.export.html_to_pdf.tag_transformer.base_tag_transformer import ( BaseTagTransformer, ) diff --git a/borb/toolkit/export/html_to_pdf/tag_transformer/text/p_tag_transformer.py b/borb/toolkit/export/html_to_pdf/tag_transformer/text/p_tag_transformer.py index 4ee92fdd2..b2f999412 100644 --- a/borb/toolkit/export/html_to_pdf/tag_transformer/text/p_tag_transformer.py +++ b/borb/toolkit/export/html_to_pdf/tag_transformer/text/p_tag_transformer.py @@ -7,14 +7,10 @@ import typing import xml.etree.ElementTree as ET -from borb.io.read.types import Decimal from borb.pdf.canvas.layout.layout_element import LayoutElement from borb.pdf.canvas.layout.page_layout.page_layout import PageLayout from borb.pdf.canvas.layout.text.chunk_of_text import ChunkOfText from borb.pdf.canvas.layout.text.chunks_of_text import HeterogeneousParagraph -from borb.pdf.canvas.layout.text.heading import Heading -from borb.pdf.document import Document -from borb.pdf.page.page import Page from borb.toolkit.export.html_to_pdf.tag_transformer.base_tag_transformer import ( BaseTagTransformer, ) diff --git a/borb/toolkit/export/markdown_to_pdf/markdown_transformer/table/table_transformer.py b/borb/toolkit/export/markdown_to_pdf/markdown_transformer/table/table_transformer.py index b6048f592..929ebd163 100644 --- a/borb/toolkit/export/markdown_to_pdf/markdown_transformer/table/table_transformer.py +++ b/borb/toolkit/export/markdown_to_pdf/markdown_transformer/table/table_transformer.py @@ -7,14 +7,12 @@ import typing from decimal import Decimal -from borb.pdf.canvas.color.color import HexColor from borb.pdf.canvas.font.simple_font.font_type_1 import StandardType1Font from borb.pdf.canvas.layout.layout_element import Alignment -from borb.pdf.canvas.layout.list.unordered_list import UnorderedList from borb.pdf.canvas.layout.table.flexible_column_width_table import ( FlexibleColumnWidthTable, ) -from borb.pdf.canvas.layout.table.table import Table, TableCell +from borb.pdf.canvas.layout.table.table import Table from borb.toolkit.export.markdown_to_pdf.markdown_transformer.base_markdown_transformer import ( BaseMarkdownTransformer, MarkdownTransformerState, diff --git a/borb/toolkit/export/markdown_to_pdf/read/any_markdown_transformer.py b/borb/toolkit/export/markdown_to_pdf/read/any_markdown_transformer.py index 2bcb94b88..be5e1c191 100644 --- a/borb/toolkit/export/markdown_to_pdf/read/any_markdown_transformer.py +++ b/borb/toolkit/export/markdown_to_pdf/read/any_markdown_transformer.py @@ -1,7 +1,3 @@ -from borb.toolkit.export.markdown_to_pdf.read.transformer import ( - Transformer, - TransformerState, -) from borb.toolkit.export.markdown_to_pdf.read.heading.alternate_syntax_heading_transformer import ( AlternateSyntaxHeadingTransformer, ) @@ -32,6 +28,10 @@ from borb.toolkit.export.markdown_to_pdf.read.text.paragraph_transformer import ( ParagraphTransformer, ) +from borb.toolkit.export.markdown_to_pdf.read.transformer import ( + Transformer, + TransformerState, +) class AnyMarkdownTransformer(Transformer): diff --git a/borb/toolkit/export/markdown_to_pdf/read/table/table_transformer.py b/borb/toolkit/export/markdown_to_pdf/read/table/table_transformer.py index 461f57b0b..cdb4059d9 100644 --- a/borb/toolkit/export/markdown_to_pdf/read/table/table_transformer.py +++ b/borb/toolkit/export/markdown_to_pdf/read/table/table_transformer.py @@ -7,14 +7,12 @@ import typing from decimal import Decimal -from borb.pdf.canvas.color.color import HexColor from borb.pdf.canvas.font.simple_font.font_type_1 import StandardType1Font from borb.pdf.canvas.layout.layout_element import Alignment -from borb.pdf.canvas.layout.list.unordered_list import UnorderedList from borb.pdf.canvas.layout.table.flexible_column_width_table import ( FlexibleColumnWidthTable, ) -from borb.pdf.canvas.layout.table.table import Table, TableCell +from borb.pdf.canvas.layout.table.table import Table from borb.toolkit.export.markdown_to_pdf.read.transformer import ( Transformer, TransformerState, diff --git a/borb/toolkit/export/pdf_to_jpg.py b/borb/toolkit/export/pdf_to_jpg.py index addc4b82c..1e4db34bd 100644 --- a/borb/toolkit/export/pdf_to_jpg.py +++ b/borb/toolkit/export/pdf_to_jpg.py @@ -4,18 +4,18 @@ """ This implementation of EventListener renders a PDF to a PIL Image """ -import io import platform import typing from decimal import Decimal from pathlib import Path +from PIL import Image as PILImage # type: ignore [import] +from PIL import ImageDraw, ImageFont + from borb.pdf.canvas.color.color import Color from borb.pdf.page.page_size import PageSize from borb.pdf.pdf import PDF from borb.toolkit.export.pdf_to_svg import PDFToSVG -from PIL import Image as PILImage # type: ignore [import] -from PIL import ImageDraw, ImageFont class PDFToJPG(PDFToSVG): diff --git a/borb/toolkit/export/pdf_to_mp3.py b/borb/toolkit/export/pdf_to_mp3.py index 2af6913a4..ac70629b6 100644 --- a/borb/toolkit/export/pdf_to_mp3.py +++ b/borb/toolkit/export/pdf_to_mp3.py @@ -9,12 +9,13 @@ from decimal import Decimal from pathlib import Path +from gtts import gTTS # type: ignore [import] + from borb.pdf.canvas.geometry.rectangle import Rectangle from borb.pdf.canvas.layout.text.paragraph import Paragraph from borb.pdf.page.page import Page from borb.pdf.pdf import PDF from borb.toolkit.text.simple_paragraph_extraction import SimpleParagraphExtraction -from gtts import gTTS # type: ignore [import] class PDFToMP3(SimpleParagraphExtraction): diff --git a/borb/toolkit/export/pdf_to_svg.py b/borb/toolkit/export/pdf_to_svg.py index 09848831b..dc5ca5528 100644 --- a/borb/toolkit/export/pdf_to_svg.py +++ b/borb/toolkit/export/pdf_to_svg.py @@ -11,6 +11,8 @@ from decimal import Decimal from pathlib import Path +from PIL import Image as PILImage # type: ignore [import] + from borb.pdf.canvas.color.color import Color from borb.pdf.canvas.event.begin_page_event import BeginPageEvent from borb.pdf.canvas.event.chunk_of_text_render_event import ChunkOfTextRenderEvent @@ -19,7 +21,6 @@ from borb.pdf.page.page import Page from borb.pdf.page.page_size import PageSize from borb.pdf.pdf import PDF -from PIL import Image as PILImage # type: ignore [import] class PDFToSVG(EventListener): diff --git a/borb/toolkit/image/image_format_optimization.py b/borb/toolkit/image/image_format_optimization.py index c757784c1..6e35b67f1 100644 --- a/borb/toolkit/image/image_format_optimization.py +++ b/borb/toolkit/image/image_format_optimization.py @@ -6,14 +6,14 @@ to fit their actual dimensions (ensuring they are not bigger than they need to be) """ import typing -from typing import List + +from PIL import Image as PILImage # type: ignore [import] from borb.io.read.types import Name, add_base_methods from borb.pdf.canvas.event.begin_page_event import BeginPageEvent from borb.pdf.canvas.event.event_listener import Event, EventListener from borb.pdf.canvas.event.image_render_event import ImageRenderEvent from borb.pdf.page.page import Page -from PIL import Image as PILImage # type: ignore [import] class ImageFormatOptimization(EventListener): diff --git a/borb/toolkit/image/simple_image_extraction.py b/borb/toolkit/image/simple_image_extraction.py index a6ed2d718..09fbfb4de 100644 --- a/borb/toolkit/image/simple_image_extraction.py +++ b/borb/toolkit/image/simple_image_extraction.py @@ -6,11 +6,12 @@ """ from typing import List +from PIL import Image # type: ignore [import] + from borb.pdf.canvas.event.begin_page_event import BeginPageEvent from borb.pdf.canvas.event.event_listener import Event, EventListener from borb.pdf.canvas.event.image_render_event import ImageRenderEvent from borb.pdf.page.page import Page -from PIL import Image # type: ignore [import] class SimpleImageExtraction(EventListener): diff --git a/borb/toolkit/ocr/ocr_image_render_event_listener.py b/borb/toolkit/ocr/ocr_image_render_event_listener.py index 2fe6d9ff7..de25fae53 100644 --- a/borb/toolkit/ocr/ocr_image_render_event_listener.py +++ b/borb/toolkit/ocr/ocr_image_render_event_listener.py @@ -8,6 +8,9 @@ from decimal import Decimal from pathlib import Path +from PIL import Image as PILImage # type: ignore [import] +from PIL import ImageDraw + from borb.pdf.canvas.color.color import Color, HexColor, RGBColor from borb.pdf.canvas.event.begin_page_event import BeginPageEvent from borb.pdf.canvas.event.end_page_event import EndPageEvent @@ -17,8 +20,6 @@ from borb.pdf.canvas.font.simple_font.font_type_1 import StandardType1Font from borb.pdf.canvas.geometry.rectangle import Rectangle from borb.pdf.page.page import Page -from PIL import Image as PILImage # type: ignore [import] -from PIL import ImageDraw try: import pytesseract # type: ignore [import] diff --git a/borb/toolkit/text/bigram_part_of_speech_tagger.py b/borb/toolkit/text/bigram_part_of_speech_tagger.py index 2e28c3ee6..0019e5f4a 100644 --- a/borb/toolkit/text/bigram_part_of_speech_tagger.py +++ b/borb/toolkit/text/bigram_part_of_speech_tagger.py @@ -8,7 +8,6 @@ based on both its definition and its context. A simplified form of this is commonly taught to school-age children, in the identification of words as nouns, verbs, adjectives, adverbs, etc. """ -import json import re import typing from decimal import Decimal diff --git a/borb/toolkit/text/font_color_filter.py b/borb/toolkit/text/font_color_filter.py index 7d20802d9..5d2120404 100644 --- a/borb/toolkit/text/font_color_filter.py +++ b/borb/toolkit/text/font_color_filter.py @@ -11,8 +11,6 @@ from borb.pdf.canvas.color.color import Color, RGBColor from borb.pdf.canvas.event.chunk_of_text_render_event import ChunkOfTextRenderEvent from borb.pdf.canvas.event.event_listener import Event, EventListener -from borb.pdf.canvas.event.image_render_event import ImageRenderEvent -from borb.pdf.canvas.geometry.rectangle import Rectangle class FontColorFilter(EventListener): diff --git a/borb/toolkit/text/font_name_filter.py b/borb/toolkit/text/font_name_filter.py index edb6af9b7..da2711b9c 100644 --- a/borb/toolkit/text/font_name_filter.py +++ b/borb/toolkit/text/font_name_filter.py @@ -9,8 +9,6 @@ from borb.pdf.canvas.event.chunk_of_text_render_event import ChunkOfTextRenderEvent from borb.pdf.canvas.event.event_listener import Event, EventListener -from borb.pdf.canvas.event.image_render_event import ImageRenderEvent -from borb.pdf.canvas.geometry.rectangle import Rectangle class FontNameFilter(EventListener): diff --git a/borb/toolkit/text/tf_idf_keyword_extraction.py b/borb/toolkit/text/tf_idf_keyword_extraction.py index 84cd6b7c6..9d034aa2b 100644 --- a/borb/toolkit/text/tf_idf_keyword_extraction.py +++ b/borb/toolkit/text/tf_idf_keyword_extraction.py @@ -24,7 +24,6 @@ import re import typing from math import log -from typing import List, Optional from borb.pdf.page.page import Page from borb.toolkit.text.simple_text_extraction import SimpleTextExtraction diff --git a/release_notes.md b/release_notes.md index b4f958e81..0d06b5fd6 100644 --- a/release_notes.md +++ b/release_notes.md @@ -1,23 +1,9 @@ -# :mega: borb release 2.0.10 +# :mega: borb release 2.0.11 This release features: -- Changes to layout of text LayoutElement(s) - - Support for `multiplied_leading` - - Support for `fixed_leading` - - Small fix to text justification algorithm - -- Updated the test to comply with the new behaviour - -- Added legal stuff to the library - - BORB_CONTRIBUTOR_LICENSE_AGREEMENT.md - - CONTRIBUTING.md - -- Added an extra test/showcase - - Creating a flyer using PDF graphics - -- Removed EventListener options on PDF objects - - EventListeners are now part of the parsing process, rather than the object - - EventListeners are passed around during parsing - - Objects are more lightweight - +- minor bugfix to previous `add_event_listener` - refactor +- First effort to implement PDF encryption + - Currently support for `StandardSecurityHandler` + - RC4 + - MD5 \ No newline at end of file diff --git a/setup.py b/setup.py index 1f100b2b5..723f2d67c 100644 --- a/setup.py +++ b/setup.py @@ -29,7 +29,7 @@ setuptools.setup( name="borb", - version="2.0.10", + version="2.0.11", author="Joris Schellekens", author_email="joris.schellekens.1989@gmail.com", description="borb is a library for reading, creating and manipulating PDF files in python.", diff --git a/tests/corpus/test_extract_text_expect_ground_truth.py b/tests/corpus/test_extract_text_expect_ground_truth.py index 42da0f494..cd0d24f56 100644 --- a/tests/corpus/test_extract_text_expect_ground_truth.py +++ b/tests/corpus/test_extract_text_expect_ground_truth.py @@ -118,7 +118,7 @@ def _build_document(self): Paragraph( "Timing Information", font_color=HexColor("72A276"), - font_size=Decimal(18.2), + font_size=Decimal(14), font="Helvetica-Bold", ) ) @@ -126,7 +126,7 @@ def _build_document(self): Paragraph( "Failure Information", font_color=HexColor("72A276"), - font_size=Decimal(18.2), + font_size=Decimal(14), font="Helvetica-Bold", ) ) @@ -239,7 +239,7 @@ def _build_document(self): "Most Error-prone Documents", font_color=HexColor("72A276"), font="Helvetica-Bold", - font_size=Decimal(18.2), + font_size=Decimal(14.2), ), col_span=2, ) @@ -267,7 +267,7 @@ def _build_document(self): Paragraph( "Slowest Documents", font_color=HexColor("72A276"), - font_size=Decimal(18.2), + font_size=Decimal(14.2), font="Helvetica-Bold", ), col_span=2, @@ -296,7 +296,7 @@ def _build_document(self): Paragraph( "Fastest Documents", font_color=HexColor("72A276"), - font_size=Decimal(18.2), + font_size=Decimal(14), font="Helvetica-Bold", ), col_span=2, diff --git a/tests/corpus/test_open_encrypted_document.py b/tests/corpus/test_open_encrypted_document.py new file mode 100644 index 000000000..73a8fe1fc --- /dev/null +++ b/tests/corpus/test_open_encrypted_document.py @@ -0,0 +1,151 @@ +import os +import typing +import unittest +from datetime import datetime +from pathlib import Path + +import matplotlib.pyplot as plt + +from borb.io.read.types import Decimal +from borb.pdf.canvas.layout.image.chart import Chart +from borb.pdf.canvas.layout.layout_element import Alignment +from borb.pdf.canvas.layout.list.unordered_list import UnorderedList +from borb.pdf.canvas.layout.page_layout.multi_column_layout import SingleColumnLayout +from borb.pdf.canvas.layout.page_layout.page_layout import PageLayout +from borb.pdf.canvas.layout.table.fixed_column_width_table import ( + FixedColumnWidthTable as Table, +) +from borb.pdf.canvas.layout.text.paragraph import Paragraph +from borb.pdf.document import Document +from borb.pdf.page.page import Page +from borb.pdf.pdf import PDF + + +class TestOpenEncryptedDocument(unittest.TestCase): + def __init__(self, methodName="runTest"): + super().__init__(methodName) + # find output dir + p: Path = Path(__file__).parent + while "output" not in [x.stem for x in p.iterdir() if x.is_dir()]: + p = p.parent + p = p / "output" + self.output_dir = Path(p, Path(__file__).stem.replace(".py", "")) + if not self.output_dir.exists(): + self.output_dir.mkdir() + + # link to corpus + self.corpus_dir: Path = Path("/home/joris/Code/pdf-corpus/password-protected") + + # (global) stats + self.number_of_documents: int = 0 + self.number_of_passes: int = 0 + self.number_of_fails: int = 0 + self.memory_stats_per_document: typing.Dict[str, typing.Tuple[int, int]] = {} + + @unittest.skip + def test_against_entire_corpus(self): + pdf_file_names = os.listdir(self.corpus_dir) + pdfs = [(self.corpus_dir / x) for x in pdf_file_names if x.endswith(".pdf")] + self._test_list_of_documents(pdfs) + plt.close("all") + + def test_open_document(self): + self._test_list_of_documents( + [Path("/home/joris/Code/pdf-corpus/password-protected/0221.pdf")] + ) + + def _test_list_of_documents(self, documents: typing.List[Path]): + self.number_of_documents = len(documents) + self.number_of_passes = 0 + self.number_of_fails = 0 + self.memory_stats_per_document = {} + for i, doc in enumerate(documents): + try: + print("processing %s [%d/%d] ..." % (doc.stem, i + 1, len(documents))) + with open(doc, "rb") as pdf_file_handle: + PDF.loads(pdf_file_handle) + self.number_of_passes += 1 + except Exception as e: + print("ERROR, document %s, %s" % (doc.name, str(e))) + self.number_of_fails += 1 + pass + self._build_document() + + def _build_document(self): + + doc: Document = Document() + + # append page + page: Page = Page() + doc.append_page(page) + + # add test information + layout: PageLayout = SingleColumnLayout(page) + layout.add( + Table(number_of_columns=2, number_of_rows=3) + .add(Paragraph("Date", font="Helvetica-Bold")) + .add(Paragraph(datetime.now().strftime("%d/%m/%Y, %H:%M:%S"))) + .add(Paragraph("Test", font="Helvetica-Bold")) + .add(Paragraph(Path(__file__).stem)) + .add(Paragraph("Description", font="Helvetica-Bold")) + .add( + Paragraph( + "This test attempts to read each PDF in a corpus of roughly 1000 PDF documents." + ) + ) + .set_padding_on_all_cells(Decimal(2), Decimal(2), Decimal(2), Decimal(2)) + ) + + # graph with timing information + labels = ( + "pass", + "fail", + ) + sizes = [self.number_of_passes, self.number_of_fails] + explode = ( + 0, + 0, + ) # only "explode" the 2nd slice (i.e. '<1s') + fig1, ax1 = plt.subplots() + ax1.pie( + sizes, + explode=explode, + labels=labels, + autopct="%1.1f%%", + shadow=True, + startangle=90, + colors=["#a5ffd6", "#56cbf9", "#0b3954", "#f1cd2e", "#de6449"], + ) + ax1.axis("equal") # Equal aspect ratio ensures that pie is drawn as a circle. + layout.add( + Chart( + plt.gcf(), + width=Decimal(200), + height=Decimal(200), + horizontal_alignment=Alignment.CENTERED, + ) + ) + + # raw data + ul: UnorderedList = UnorderedList() + ul.add( + Paragraph( + "processed %d documents" + % (self.number_of_fails + self.number_of_passes) + ) + ) + ul.add( + Paragraph( + "%d fail(s), %d pass(es)" + % (self.number_of_fails, self.number_of_passes) + ) + ) + layout.add(ul) + + # write + file = self.output_dir / "output.pdf" + with open(file, "wb") as pdf_file_handle: + PDF.dumps(pdf_file_handle, doc) + + # close figure(s) + plt.close("all") diff --git a/tests/misc/encryption/test_md5.py b/tests/misc/encryption/test_md5.py new file mode 100644 index 000000000..f7dc3afce --- /dev/null +++ b/tests/misc/encryption/test_md5.py @@ -0,0 +1,107 @@ +import unittest +from hashlib import md5 + +import typing + + +class TestMD5(unittest.TestCase): + def test_md5(self): + # fmt: off + raw_input: bytes = bytes([40, 191, 78, 94, 78, 117, 138, 65, + 100, 0, 78, 86, 255, 250, 1, 8, + 46, 46, 0, 182, 208, 104, 62, 128, + 47, 12, 169, 254, 100, 83, 105, 122]) + # fmt: on + + # construct hashing algorithm + h = md5() + + # update + h.update(raw_input) + + # get hash + raw_output: typing.List[int] = [ + (x - 256) if x >= 128 else x for x in h.digest() + ] + + # assert + assert raw_output == [ + 81, + 33, + 71, + -71, + -98, + 113, + -27, + 117, + 120, + 7, + 121, + -95, + -74, + 69, + 20, + 72, + ] + + def test_md5_50(self): + # fmt: off + raw_input: bytes = bytes([40, 191, 78, 94, 78, 117, 138, 65, + 100, 0, 78, 86, 255, 250, 1, 8, + 46, 46, 0, 182, 208, 104, 62, 128, + 47, 12, 169, 254, 100, 83, 105, 122]) + # fmt: on + + # construct hashing algorithm + h = md5() + + h.update(raw_input) + raw_output: typing.List[int] = [ + (x - 256) if x >= 128 else x for x in h.digest() + ] + assert raw_output == [ + 81, + 33, + 71, + -71, + -98, + 113, + -27, + 117, + 120, + 7, + 121, + -95, + -74, + 69, + 20, + 72, + ] + + # 50 iterations + prev: bytes = h.digest() + for _ in range(0, 50): + h = md5() + h.update(prev) + prev = h.digest()[0:16] + + # assert + raw_output: typing.List[int] = [(x - 256) if x >= 128 else x for x in prev] + assert raw_output == [ + 90, + 0, + 52, + 79, + 64, + -48, + -91, + -59, + 43, + 22, + 11, + -125, + 14, + 110, + 8, + 110, + ] diff --git a/tests/misc/encryption/test_standard_security_handler.py b/tests/misc/encryption/test_standard_security_handler.py new file mode 100644 index 000000000..5e448495b --- /dev/null +++ b/tests/misc/encryption/test_standard_security_handler.py @@ -0,0 +1,224 @@ +import unittest +import typing + +from borb.io.read.encryption.standard_security_handler import StandardSecurityHandler +from borb.io.read.types import ( + Dictionary, + Name, + String, + List, + HexadecimalString, + Reference, +<<<<<<< HEAD +======= + Stream, +>>>>>>> 06f5048742eee4ebd06494f391c1b6027b09a7ba +) +from borb.io.read.types import Decimal as bDecimal + + +class TestStandardSecurityHandler(unittest.TestCase): + @staticmethod + def ints_to_string_object(i: typing.List[int]) -> String: + return String(str(bytes(i), encoding="utf8")) + + def test_standard_security_handler(self): + + trailer_dictionary = Dictionary() + trailer_dictionary[Name("ID")] = List() + trailer_dictionary["ID"].append( + HexadecimalString("87B0E1BD8B0F59E30AFCF1DB4A6F70B2") + ) + trailer_dictionary["ID"].append( + HexadecimalString("29F4AA99CA167B4D90E8853A67131865") + ) + + encryption_dictionary = Dictionary() + encryption_dictionary.set_parent(trailer_dictionary) + encryption_dictionary[Name("Filter")] = Name("Standard") + encryption_dictionary[Name("Length")] = bDecimal(128) +<<<<<<< HEAD + encryption_dictionary[ + Name("U") + ] = TestStandardSecurityHandler.ints_to_string_object( + [ + 194, + 150, + 116, + 195, + 142, + 3, + 194, + 166, + 19, + 52, + 68, + 121, + 53, + 194, + 174, + 6, + 100, + 46, + 85, + 26, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + ] + ) + encryption_dictionary[Name("P")] = bDecimal(-1068) + encryption_dictionary[Name("R")] = bDecimal(3) + encryption_dictionary[ + Name("O") + ] = TestStandardSecurityHandler.ints_to_string_object( + [ + 194, + 128, + 194, + 176, + 195, + 141, + 194, + 188, + 195, + 172, + 194, + 161, + 67, + 81, + 75, + 195, + 148, + 25, + 194, + 170, + 195, + 145, + 1, + 195, + 179, + 194, + 140, + 195, + 189, + 195, + 155, + 117, + 45, + 195, + 139, + 195, + 169, + 111, + 109, + 194, + 157, + 195, + 129, + 106, + 195, + 184, + 195, + 142, + 44, + 49, + 194, + 172, + ] + ) +======= + # fmt: off + encryption_dictionary[Name("U")] = TestStandardSecurityHandler.ints_to_string_object( + [ + 194, 150, 116, 195, 142, 3, 194, 166, + 19, 52, 68, 121, 53, 194, 174, 6, + 100, 46, 85, 26, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, + ] + ) + # fmt: on + + encryption_dictionary[Name("P")] = bDecimal(-1068) + encryption_dictionary[Name("R")] = bDecimal(3) + # fmt: off + encryption_dictionary[Name("O")] = TestStandardSecurityHandler.ints_to_string_object( + [194, 128, 194, 176, 195, 141, 194, 188, + 195, 172, 194, 161, 67, 81, 75, 195, + 148, 25, 194, 170, 195, 145, 1, 195, + 179, 194, 140, 195, 189, 195, 155, 117, + 45, 195, 139, 195, 169, 111, 109, 194, + 157, 195, 129, 106, 195, 184, 195, 142, + 44, 49, 194, 172, + ] + ) + # fmt: on + +>>>>>>> 06f5048742eee4ebd06494f391c1b6027b09a7ba + encryption_dictionary[Name("V")] = bDecimal(2) + + # create security handler + ssh = StandardSecurityHandler(encryption_dictionary) + + # assert ssh._encryption_key + bs: typing.List[int] = [x for x in ssh._encryption_key] + assert bs == [ + 72, + 14, + 85, + 41, + 85, + 183, + 22, + 61, + 205, + 229, + 51, + 104, + 40, + 81, + 149, + 13, + ] +<<<<<<< HEAD +======= + + # fmt: off + stream_bytes: bytes = bytes([x if x > 0 else x + 256 for x in + [97, -102, 10, -83, -20, 76, 83, -122, 39, 93, -39, 125, 20, 81, 91, 107, 82, + -104, 64, -56, 104, -109, -7, -69, -19, -36, -100, 119, -81, -124, 111, -43, 21, + 9, -104, 15, 82, -72, 19, 57, -19, 120, 110, -118, -84, 116, -26, 91, -66, 111, + -35, 32, 17, -119, 14, 96, -83, -122, -106, 6, -53, 89, 41, 117, -42, -22, -14, + 64, -85, 30, -81, 59, 81, -120, 29, 96, 49, -110, -18, 121, -112, 14, -20, -104, + -56, 102, 30, 45, -86, -52, 23, -32, 50, 42, 4, 34, -76, 95, 119, -34]]) + # fmt: on + + # build Stream object + stream_object: Stream = Stream().set_reference(Reference(51, 0)) + stream_object[Name("DecodedBytes")] = stream_bytes + + # decrypt object + ssh._decrypt_data(stream_object) + + # check content + decrypted_stream_content: str = str( + stream_object[Name("DecodedBytes")], encoding="utf8" + ) + assert decrypted_stream_content.startswith( + '' + ) +>>>>>>> 06f5048742eee4ebd06494f391c1b6027b09a7ba diff --git a/tests/output/test_add_all_rubber_stamp_annotations/output.pdf b/tests/output/test_add_all_rubber_stamp_annotations/output.pdf index 209b28e4d..dec61c247 100644 Binary files a/tests/output/test_add_all_rubber_stamp_annotations/output.pdf and b/tests/output/test_add_all_rubber_stamp_annotations/output.pdf differ diff --git a/tests/output/test_add_circle_annotation/output.pdf b/tests/output/test_add_circle_annotation/output.pdf index 840d25a99..9d7bad08e 100644 Binary files a/tests/output/test_add_circle_annotation/output.pdf and b/tests/output/test_add_circle_annotation/output.pdf differ diff --git a/tests/output/test_add_free_text_annotation/output_001.pdf b/tests/output/test_add_free_text_annotation/output_001.pdf index 0db688bee..150fdd7ac 100644 Binary files a/tests/output/test_add_free_text_annotation/output_001.pdf and b/tests/output/test_add_free_text_annotation/output_001.pdf differ diff --git a/tests/output/test_add_free_text_annotation/output_002.pdf b/tests/output/test_add_free_text_annotation/output_002.pdf index 72257c38a..c59951408 100644 Binary files a/tests/output/test_add_free_text_annotation/output_002.pdf and b/tests/output/test_add_free_text_annotation/output_002.pdf differ diff --git a/tests/output/test_add_highlight_annotation/output_001.pdf b/tests/output/test_add_highlight_annotation/output_001.pdf index 664281000..d9533eee5 100644 Binary files a/tests/output/test_add_highlight_annotation/output_001.pdf and b/tests/output/test_add_highlight_annotation/output_001.pdf differ diff --git a/tests/output/test_add_highlight_annotation/output_002.pdf b/tests/output/test_add_highlight_annotation/output_002.pdf index 2b4c58168..f83294462 100644 Binary files a/tests/output/test_add_highlight_annotation/output_002.pdf and b/tests/output/test_add_highlight_annotation/output_002.pdf differ diff --git a/tests/output/test_add_line_annotation/output_001.pdf b/tests/output/test_add_line_annotation/output_001.pdf index e856f9677..3b090a2d6 100644 Binary files a/tests/output/test_add_line_annotation/output_001.pdf and b/tests/output/test_add_line_annotation/output_001.pdf differ diff --git a/tests/output/test_add_line_annotation/output_002.pdf b/tests/output/test_add_line_annotation/output_002.pdf index 6ec7657af..e2f747675 100644 Binary files a/tests/output/test_add_line_annotation/output_002.pdf and b/tests/output/test_add_line_annotation/output_002.pdf differ diff --git a/tests/output/test_add_outline/output_001.pdf b/tests/output/test_add_outline/output_001.pdf index e2d3af706..7d3a06ea0 100644 Binary files a/tests/output/test_add_outline/output_001.pdf and b/tests/output/test_add_outline/output_001.pdf differ diff --git a/tests/output/test_add_outline/output_002.pdf b/tests/output/test_add_outline/output_002.pdf index e10367c09..bd4f56fa7 100644 Binary files a/tests/output/test_add_outline/output_002.pdf and b/tests/output/test_add_outline/output_002.pdf differ diff --git a/tests/output/test_add_polygon_annotation_using_line_art_factory/output.pdf b/tests/output/test_add_polygon_annotation_using_line_art_factory/output.pdf index 9135b4381..45bbc1fd4 100644 Binary files a/tests/output/test_add_polygon_annotation_using_line_art_factory/output.pdf and b/tests/output/test_add_polygon_annotation_using_line_art_factory/output.pdf differ diff --git a/tests/output/test_add_polyline_annotation_using_line_art_factory/output.pdf b/tests/output/test_add_polyline_annotation_using_line_art_factory/output.pdf index 4089cba8f..f3d19d2b7 100644 Binary files a/tests/output/test_add_polyline_annotation_using_line_art_factory/output.pdf and b/tests/output/test_add_polyline_annotation_using_line_art_factory/output.pdf differ diff --git a/tests/output/test_add_redact_annotation/output_001.pdf b/tests/output/test_add_redact_annotation/output_001.pdf index 504c688ac..9c7a12d0d 100644 Binary files a/tests/output/test_add_redact_annotation/output_001.pdf and b/tests/output/test_add_redact_annotation/output_001.pdf differ diff --git a/tests/output/test_add_redact_annotation/output_002.pdf b/tests/output/test_add_redact_annotation/output_002.pdf index 3207a2b87..b77f4739e 100644 Binary files a/tests/output/test_add_redact_annotation/output_002.pdf and b/tests/output/test_add_redact_annotation/output_002.pdf differ diff --git a/tests/output/test_add_redact_annotation/output_003.pdf b/tests/output/test_add_redact_annotation/output_003.pdf index a5aa5a718..c71fdfc6d 100644 Binary files a/tests/output/test_add_redact_annotation/output_003.pdf and b/tests/output/test_add_redact_annotation/output_003.pdf differ diff --git a/tests/output/test_add_redact_annotation/output_004.pdf b/tests/output/test_add_redact_annotation/output_004.pdf index d16e94483..d520ff122 100644 Binary files a/tests/output/test_add_redact_annotation/output_004.pdf and b/tests/output/test_add_redact_annotation/output_004.pdf differ diff --git a/tests/output/test_add_redact_annotation/output_005.pdf b/tests/output/test_add_redact_annotation/output_005.pdf index ecfc170f6..98f90917c 100644 Binary files a/tests/output/test_add_redact_annotation/output_005.pdf and b/tests/output/test_add_redact_annotation/output_005.pdf differ diff --git a/tests/output/test_add_remote_go_to_annotation/output_001.pdf b/tests/output/test_add_remote_go_to_annotation/output_001.pdf index 634b1f1ae..4024fe2f0 100644 Binary files a/tests/output/test_add_remote_go_to_annotation/output_001.pdf and b/tests/output/test_add_remote_go_to_annotation/output_001.pdf differ diff --git a/tests/output/test_add_remote_go_to_annotation/output_002.pdf b/tests/output/test_add_remote_go_to_annotation/output_002.pdf index 230dd3806..6f648825a 100644 Binary files a/tests/output/test_add_remote_go_to_annotation/output_002.pdf and b/tests/output/test_add_remote_go_to_annotation/output_002.pdf differ diff --git a/tests/output/test_add_square_annotation/output.pdf b/tests/output/test_add_square_annotation/output.pdf index bd291f379..b8da0a3b3 100644 Binary files a/tests/output/test_add_square_annotation/output.pdf and b/tests/output/test_add_square_annotation/output.pdf differ diff --git a/tests/output/test_add_square_annotation_in_free_space/output_001.pdf b/tests/output/test_add_square_annotation_in_free_space/output_001.pdf index 1f2c901d4..70c2fb5a9 100644 Binary files a/tests/output/test_add_square_annotation_in_free_space/output_001.pdf and b/tests/output/test_add_square_annotation_in_free_space/output_001.pdf differ diff --git a/tests/output/test_add_square_annotation_in_free_space/output_002.pdf b/tests/output/test_add_square_annotation_in_free_space/output_002.pdf index 65926697e..d39f919cd 100644 Binary files a/tests/output/test_add_square_annotation_in_free_space/output_002.pdf and b/tests/output/test_add_square_annotation_in_free_space/output_002.pdf differ diff --git a/tests/output/test_add_squiggle_annotation/output_001.pdf b/tests/output/test_add_squiggle_annotation/output_001.pdf index fb98ac55d..fd3ce3d53 100644 Binary files a/tests/output/test_add_squiggle_annotation/output_001.pdf and b/tests/output/test_add_squiggle_annotation/output_001.pdf differ diff --git a/tests/output/test_add_squiggle_annotation/output_002.pdf b/tests/output/test_add_squiggle_annotation/output_002.pdf index 4ae88aa0d..b48801835 100644 Binary files a/tests/output/test_add_squiggle_annotation/output_002.pdf and b/tests/output/test_add_squiggle_annotation/output_002.pdf differ diff --git a/tests/output/test_add_strikeout_annotation/output_001.pdf b/tests/output/test_add_strikeout_annotation/output_001.pdf index 2cbf9d4b9..44b1fd1be 100644 Binary files a/tests/output/test_add_strikeout_annotation/output_001.pdf and b/tests/output/test_add_strikeout_annotation/output_001.pdf differ diff --git a/tests/output/test_add_strikeout_annotation/output_002.pdf b/tests/output/test_add_strikeout_annotation/output_002.pdf index 6f679453f..a4891ede4 100644 Binary files a/tests/output/test_add_strikeout_annotation/output_002.pdf and b/tests/output/test_add_strikeout_annotation/output_002.pdf differ diff --git a/tests/output/test_add_super_mario_annotation/output.pdf b/tests/output/test_add_super_mario_annotation/output.pdf index 4d4147f8a..9ed3185e2 100644 Binary files a/tests/output/test_add_super_mario_annotation/output.pdf and b/tests/output/test_add_super_mario_annotation/output.pdf differ diff --git a/tests/output/test_add_text_annotation/output_001.pdf b/tests/output/test_add_text_annotation/output_001.pdf index e952ca053..2b36c1c1b 100644 Binary files a/tests/output/test_add_text_annotation/output_001.pdf and b/tests/output/test_add_text_annotation/output_001.pdf differ diff --git a/tests/output/test_add_text_annotation/output_002.pdf b/tests/output/test_add_text_annotation/output_002.pdf index 586f7ddf2..87f5b718b 100644 Binary files a/tests/output/test_add_text_annotation/output_002.pdf and b/tests/output/test_add_text_annotation/output_002.pdf differ diff --git a/tests/output/test_add_underline_annotation/output_001.pdf b/tests/output/test_add_underline_annotation/output_001.pdf index f301b3746..7476f504a 100644 Binary files a/tests/output/test_add_underline_annotation/output_001.pdf and b/tests/output/test_add_underline_annotation/output_001.pdf differ diff --git a/tests/output/test_add_underline_annotation/output_002.pdf b/tests/output/test_add_underline_annotation/output_002.pdf index 8d2304e69..a1bd37154 100644 Binary files a/tests/output/test_add_underline_annotation/output_002.pdf and b/tests/output/test_add_underline_annotation/output_002.pdf differ diff --git a/tests/output/test_analogous_color_scheme/output.pdf b/tests/output/test_analogous_color_scheme/output.pdf index 7ea5c7e38..345c1e43c 100644 Binary files a/tests/output/test_analogous_color_scheme/output.pdf and b/tests/output/test_analogous_color_scheme/output.pdf differ diff --git a/tests/output/test_append_embedded_file/output_001.pdf b/tests/output/test_append_embedded_file/output_001.pdf index abd4b514f..aa8f08c02 100644 Binary files a/tests/output/test_append_embedded_file/output_001.pdf and b/tests/output/test_append_embedded_file/output_001.pdf differ diff --git a/tests/output/test_append_embedded_file/output_002.pdf b/tests/output/test_append_embedded_file/output_002.pdf index cf278c68e..26f499445 100644 Binary files a/tests/output/test_append_embedded_file/output_002.pdf and b/tests/output/test_append_embedded_file/output_002.pdf differ diff --git a/tests/output/test_apply_redaction_annotations/output_001.pdf b/tests/output/test_apply_redaction_annotations/output_001.pdf index 81cd41c28..88ac4e0c5 100644 Binary files a/tests/output/test_apply_redaction_annotations/output_001.pdf and b/tests/output/test_apply_redaction_annotations/output_001.pdf differ diff --git a/tests/output/test_apply_redaction_annotations/output_002.pdf b/tests/output/test_apply_redaction_annotations/output_002.pdf index bbaaa2b26..e91c581b8 100644 Binary files a/tests/output/test_apply_redaction_annotations/output_002.pdf and b/tests/output/test_apply_redaction_annotations/output_002.pdf differ diff --git a/tests/output/test_apply_redaction_annotations/output_003.pdf b/tests/output/test_apply_redaction_annotations/output_003.pdf index c9b36b281..fc098fa0a 100644 Binary files a/tests/output/test_apply_redaction_annotations/output_003.pdf and b/tests/output/test_apply_redaction_annotations/output_003.pdf differ diff --git a/tests/output/test_apply_redaction_annotations/output_004.pdf b/tests/output/test_apply_redaction_annotations/output_004.pdf index 4af1b65cf..4933a8d1b 100644 Binary files a/tests/output/test_apply_redaction_annotations/output_004.pdf and b/tests/output/test_apply_redaction_annotations/output_004.pdf differ diff --git a/tests/output/test_apply_redaction_annotations/output_005.pdf b/tests/output/test_apply_redaction_annotations/output_005.pdf index e6e784055..ad9882015 100644 Binary files a/tests/output/test_apply_redaction_annotations/output_005.pdf and b/tests/output/test_apply_redaction_annotations/output_005.pdf differ diff --git a/tests/output/test_apply_redaction_annotations/output_006.pdf b/tests/output/test_apply_redaction_annotations/output_006.pdf index c7c296590..839dcfe3d 100644 Binary files a/tests/output/test_apply_redaction_annotations/output_006.pdf and b/tests/output/test_apply_redaction_annotations/output_006.pdf differ diff --git a/tests/output/test_browser_layout_inline_next_line/output.pdf b/tests/output/test_browser_layout_inline_next_line/output.pdf index b00f77174..2ec347e96 100644 Binary files a/tests/output/test_browser_layout_inline_next_line/output.pdf and b/tests/output/test_browser_layout_inline_next_line/output.pdf differ diff --git a/tests/output/test_change_info_dictionary_author/output_001.pdf b/tests/output/test_change_info_dictionary_author/output_001.pdf index 8d49c4ebf..04d287292 100644 Binary files a/tests/output/test_change_info_dictionary_author/output_001.pdf and b/tests/output/test_change_info_dictionary_author/output_001.pdf differ diff --git a/tests/output/test_change_info_dictionary_author/output_002.pdf b/tests/output/test_change_info_dictionary_author/output_002.pdf index 8dc3bc9d0..694f55d66 100644 Binary files a/tests/output/test_change_info_dictionary_author/output_002.pdf and b/tests/output/test_change_info_dictionary_author/output_002.pdf differ diff --git a/tests/output/test_concat_documents/output_000.pdf b/tests/output/test_concat_documents/output_000.pdf index cde199092..f9cb5f2dd 100644 Binary files a/tests/output/test_concat_documents/output_000.pdf and b/tests/output/test_concat_documents/output_000.pdf differ diff --git a/tests/output/test_concat_documents/output_001.pdf b/tests/output/test_concat_documents/output_001.pdf index e392752ee..375329b68 100644 Binary files a/tests/output/test_concat_documents/output_001.pdf and b/tests/output/test_concat_documents/output_001.pdf differ diff --git a/tests/output/test_concat_documents/output_002.pdf b/tests/output/test_concat_documents/output_002.pdf index f8a376705..e00fb9849 100644 Binary files a/tests/output/test_concat_documents/output_002.pdf and b/tests/output/test_concat_documents/output_002.pdf differ diff --git a/tests/output/test_copy_document_compare_size/output.pdf b/tests/output/test_copy_document_compare_size/output.pdf index 50908e759..87d687e00 100644 Binary files a/tests/output/test_copy_document_compare_size/output.pdf and b/tests/output/test_copy_document_compare_size/output.pdf differ diff --git a/tests/output/test_copy_document_resize_images_compare_size/output.pdf b/tests/output/test_copy_document_resize_images_compare_size/output.pdf index 7b0f42151..a0ccdf45f 100644 Binary files a/tests/output/test_copy_document_resize_images_compare_size/output.pdf and b/tests/output/test_copy_document_resize_images_compare_size/output.pdf differ diff --git a/tests/output/test_count_annotations/output_001.pdf b/tests/output/test_count_annotations/output_001.pdf index cf6b235b2..19e416cdd 100644 Binary files a/tests/output/test_count_annotations/output_001.pdf and b/tests/output/test_count_annotations/output_001.pdf differ diff --git a/tests/output/test_count_annotations/output_002.pdf b/tests/output/test_count_annotations/output_002.pdf index bddc2bdbd..33ed8599b 100644 Binary files a/tests/output/test_count_annotations/output_002.pdf and b/tests/output/test_count_annotations/output_002.pdf differ diff --git a/tests/output/test_create_document_with_output_intent/output_001.pdf b/tests/output/test_create_document_with_output_intent/output_001.pdf index f78a801f2..9bdc1a11e 100644 Binary files a/tests/output/test_create_document_with_output_intent/output_001.pdf and b/tests/output/test_create_document_with_output_intent/output_001.pdf differ diff --git a/tests/output/test_detect_table/input_000.pdf b/tests/output/test_detect_table/input_000.pdf index 895220883..f9742b176 100644 Binary files a/tests/output/test_detect_table/input_000.pdf and b/tests/output/test_detect_table/input_000.pdf differ diff --git a/tests/output/test_detect_table/input_001.pdf b/tests/output/test_detect_table/input_001.pdf index 5ba58edde..c0b9b2ac1 100644 Binary files a/tests/output/test_detect_table/input_001.pdf and b/tests/output/test_detect_table/input_001.pdf differ diff --git a/tests/output/test_detect_table/input_002.pdf b/tests/output/test_detect_table/input_002.pdf index 41659e28d..8de2f622e 100644 Binary files a/tests/output/test_detect_table/input_002.pdf and b/tests/output/test_detect_table/input_002.pdf differ diff --git a/tests/output/test_detect_table/input_003.pdf b/tests/output/test_detect_table/input_003.pdf index 5aabcbdd0..412a75408 100644 Binary files a/tests/output/test_detect_table/input_003.pdf and b/tests/output/test_detect_table/input_003.pdf differ diff --git a/tests/output/test_detect_table/input_004.pdf b/tests/output/test_detect_table/input_004.pdf index 6e1b119fc..9679c8055 100644 Binary files a/tests/output/test_detect_table/input_004.pdf and b/tests/output/test_detect_table/input_004.pdf differ diff --git a/tests/output/test_detect_table/input_005.pdf b/tests/output/test_detect_table/input_005.pdf index 6880ff653..88761255c 100644 Binary files a/tests/output/test_detect_table/input_005.pdf and b/tests/output/test_detect_table/input_005.pdf differ diff --git a/tests/output/test_detect_table/input_006.pdf b/tests/output/test_detect_table/input_006.pdf index 1bfb492ab..24b00d33e 100644 Binary files a/tests/output/test_detect_table/input_006.pdf and b/tests/output/test_detect_table/input_006.pdf differ diff --git a/tests/output/test_detect_table/output_000.pdf b/tests/output/test_detect_table/output_000.pdf index fa756311e..3456d4886 100644 Binary files a/tests/output/test_detect_table/output_000.pdf and b/tests/output/test_detect_table/output_000.pdf differ diff --git a/tests/output/test_detect_table/output_001.pdf b/tests/output/test_detect_table/output_001.pdf index ab31c3db5..7eadb4c47 100644 Binary files a/tests/output/test_detect_table/output_001.pdf and b/tests/output/test_detect_table/output_001.pdf differ diff --git a/tests/output/test_detect_table/output_002.pdf b/tests/output/test_detect_table/output_002.pdf index 07a230ae4..8f386e22c 100644 Binary files a/tests/output/test_detect_table/output_002.pdf and b/tests/output/test_detect_table/output_002.pdf differ diff --git a/tests/output/test_detect_table/output_003.pdf b/tests/output/test_detect_table/output_003.pdf index 580209f58..decf409fc 100644 Binary files a/tests/output/test_detect_table/output_003.pdf and b/tests/output/test_detect_table/output_003.pdf differ diff --git a/tests/output/test_detect_table/output_004.pdf b/tests/output/test_detect_table/output_004.pdf index 77e9c51db..6e1fd0b62 100644 Binary files a/tests/output/test_detect_table/output_004.pdf and b/tests/output/test_detect_table/output_004.pdf differ diff --git a/tests/output/test_detect_table/output_005.pdf b/tests/output/test_detect_table/output_005.pdf index 67aadd0b2..0b4c43751 100644 Binary files a/tests/output/test_detect_table/output_005.pdf and b/tests/output/test_detect_table/output_005.pdf differ diff --git a/tests/output/test_detect_table/output_006.pdf b/tests/output/test_detect_table/output_006.pdf index b3a45fa3e..bee62adab 100644 Binary files a/tests/output/test_detect_table/output_006.pdf and b/tests/output/test_detect_table/output_006.pdf differ diff --git a/tests/output/test_export_html_to_pdf/example_html_input_000.pdf b/tests/output/test_export_html_to_pdf/example_html_input_000.pdf index 1b6d202fa..e7a7c4038 100644 Binary files a/tests/output/test_export_html_to_pdf/example_html_input_000.pdf and b/tests/output/test_export_html_to_pdf/example_html_input_000.pdf differ diff --git a/tests/output/test_export_html_to_pdf/example_html_input_000_ground_truth.png b/tests/output/test_export_html_to_pdf/example_html_input_000_ground_truth.png index eda42760d..3f386b087 100644 Binary files a/tests/output/test_export_html_to_pdf/example_html_input_000_ground_truth.png and b/tests/output/test_export_html_to_pdf/example_html_input_000_ground_truth.png differ diff --git a/tests/output/test_export_html_to_pdf/example_html_input_001.pdf b/tests/output/test_export_html_to_pdf/example_html_input_001.pdf index 5ee6b6e4f..18c7f7817 100644 Binary files a/tests/output/test_export_html_to_pdf/example_html_input_001.pdf and b/tests/output/test_export_html_to_pdf/example_html_input_001.pdf differ diff --git a/tests/output/test_export_html_to_pdf/example_html_input_002.pdf b/tests/output/test_export_html_to_pdf/example_html_input_002.pdf index 8ea1005a2..5223bb200 100644 Binary files a/tests/output/test_export_html_to_pdf/example_html_input_002.pdf and b/tests/output/test_export_html_to_pdf/example_html_input_002.pdf differ diff --git a/tests/output/test_export_html_to_pdf/example_html_input_003.pdf b/tests/output/test_export_html_to_pdf/example_html_input_003.pdf index 2a83c45e8..740f69b45 100644 Binary files a/tests/output/test_export_html_to_pdf/example_html_input_003.pdf and b/tests/output/test_export_html_to_pdf/example_html_input_003.pdf differ diff --git a/tests/output/test_export_html_to_pdf/example_html_input_004.pdf b/tests/output/test_export_html_to_pdf/example_html_input_004.pdf index 59cc5a0a7..a8c2c4ce6 100644 Binary files a/tests/output/test_export_html_to_pdf/example_html_input_004.pdf and b/tests/output/test_export_html_to_pdf/example_html_input_004.pdf differ diff --git a/tests/output/test_export_html_to_pdf/example_html_input_005.pdf b/tests/output/test_export_html_to_pdf/example_html_input_005.pdf index 327dd86df..fdee8c506 100644 Binary files a/tests/output/test_export_html_to_pdf/example_html_input_005.pdf and b/tests/output/test_export_html_to_pdf/example_html_input_005.pdf differ diff --git a/tests/output/test_export_html_to_pdf/example_html_input_005_ground_truth.png b/tests/output/test_export_html_to_pdf/example_html_input_005_ground_truth.png index 61c85b662..ba694297b 100644 Binary files a/tests/output/test_export_html_to_pdf/example_html_input_005_ground_truth.png and b/tests/output/test_export_html_to_pdf/example_html_input_005_ground_truth.png differ diff --git a/tests/output/test_export_html_to_pdf/example_html_input_006.pdf b/tests/output/test_export_html_to_pdf/example_html_input_006.pdf index d9e2f3805..c179942c7 100644 Binary files a/tests/output/test_export_html_to_pdf/example_html_input_006.pdf and b/tests/output/test_export_html_to_pdf/example_html_input_006.pdf differ diff --git a/tests/output/test_export_html_to_pdf/example_html_input_007.pdf b/tests/output/test_export_html_to_pdf/example_html_input_007.pdf index dc46aa932..e7dd830a4 100644 Binary files a/tests/output/test_export_html_to_pdf/example_html_input_007.pdf and b/tests/output/test_export_html_to_pdf/example_html_input_007.pdf differ diff --git a/tests/output/test_export_html_to_pdf/example_html_input_008.pdf b/tests/output/test_export_html_to_pdf/example_html_input_008.pdf index a368a5277..da87c57cd 100644 Binary files a/tests/output/test_export_html_to_pdf/example_html_input_008.pdf and b/tests/output/test_export_html_to_pdf/example_html_input_008.pdf differ diff --git a/tests/output/test_export_html_to_pdf/example_html_input_008_ground_truth.png b/tests/output/test_export_html_to_pdf/example_html_input_008_ground_truth.png index dc2123ffa..1cea8c0ab 100644 Binary files a/tests/output/test_export_html_to_pdf/example_html_input_008_ground_truth.png and b/tests/output/test_export_html_to_pdf/example_html_input_008_ground_truth.png differ diff --git a/tests/output/test_export_html_to_pdf/example_html_input_009.pdf b/tests/output/test_export_html_to_pdf/example_html_input_009.pdf index de2381f6f..bddeffe34 100644 Binary files a/tests/output/test_export_html_to_pdf/example_html_input_009.pdf and b/tests/output/test_export_html_to_pdf/example_html_input_009.pdf differ diff --git a/tests/output/test_export_html_to_pdf/example_html_input_009_ground_truth.png b/tests/output/test_export_html_to_pdf/example_html_input_009_ground_truth.png index 0d26ecd90..a194bc7bf 100644 Binary files a/tests/output/test_export_html_to_pdf/example_html_input_009_ground_truth.png and b/tests/output/test_export_html_to_pdf/example_html_input_009_ground_truth.png differ diff --git a/tests/output/test_export_html_to_pdf/example_html_input_010.pdf b/tests/output/test_export_html_to_pdf/example_html_input_010.pdf index cdb5afe4a..4a057465a 100644 Binary files a/tests/output/test_export_html_to_pdf/example_html_input_010.pdf and b/tests/output/test_export_html_to_pdf/example_html_input_010.pdf differ diff --git a/tests/output/test_export_html_to_pdf/example_html_input_010_ground_truth.png b/tests/output/test_export_html_to_pdf/example_html_input_010_ground_truth.png index 3cad139f0..0435c20e3 100644 Binary files a/tests/output/test_export_html_to_pdf/example_html_input_010_ground_truth.png and b/tests/output/test_export_html_to_pdf/example_html_input_010_ground_truth.png differ diff --git a/tests/output/test_export_html_to_pdf/example_html_input_011.pdf b/tests/output/test_export_html_to_pdf/example_html_input_011.pdf index d88c0c240..a1698fbd5 100644 Binary files a/tests/output/test_export_html_to_pdf/example_html_input_011.pdf and b/tests/output/test_export_html_to_pdf/example_html_input_011.pdf differ diff --git a/tests/output/test_export_html_to_pdf/example_html_input_012.pdf b/tests/output/test_export_html_to_pdf/example_html_input_012.pdf index a6b425741..7777bfda7 100644 Binary files a/tests/output/test_export_html_to_pdf/example_html_input_012.pdf and b/tests/output/test_export_html_to_pdf/example_html_input_012.pdf differ diff --git a/tests/output/test_export_html_to_pdf/example_html_input_013.pdf b/tests/output/test_export_html_to_pdf/example_html_input_013.pdf index 55a64fe75..55f27c1f8 100644 Binary files a/tests/output/test_export_html_to_pdf/example_html_input_013.pdf and b/tests/output/test_export_html_to_pdf/example_html_input_013.pdf differ diff --git a/tests/output/test_export_html_to_pdf/example_html_input_014.pdf b/tests/output/test_export_html_to_pdf/example_html_input_014.pdf index ca6b1755f..64aaa6de2 100644 Binary files a/tests/output/test_export_html_to_pdf/example_html_input_014.pdf and b/tests/output/test_export_html_to_pdf/example_html_input_014.pdf differ diff --git a/tests/output/test_export_markdown_to_pdf/example-markdown-input-001.md.pdf b/tests/output/test_export_markdown_to_pdf/example-markdown-input-001.md.pdf index cc1ba03e1..b5aa8123d 100644 Binary files a/tests/output/test_export_markdown_to_pdf/example-markdown-input-001.md.pdf and b/tests/output/test_export_markdown_to_pdf/example-markdown-input-001.md.pdf differ diff --git a/tests/output/test_export_markdown_to_pdf/example-markdown-input-002.md.pdf b/tests/output/test_export_markdown_to_pdf/example-markdown-input-002.md.pdf index bfd95adb2..707a9ca8d 100644 Binary files a/tests/output/test_export_markdown_to_pdf/example-markdown-input-002.md.pdf and b/tests/output/test_export_markdown_to_pdf/example-markdown-input-002.md.pdf differ diff --git a/tests/output/test_export_markdown_to_pdf/example-markdown-input-003.md.pdf b/tests/output/test_export_markdown_to_pdf/example-markdown-input-003.md.pdf index 292cf50f5..ba897cb51 100644 Binary files a/tests/output/test_export_markdown_to_pdf/example-markdown-input-003.md.pdf and b/tests/output/test_export_markdown_to_pdf/example-markdown-input-003.md.pdf differ diff --git a/tests/output/test_export_markdown_to_pdf/example-markdown-input-004.md.pdf b/tests/output/test_export_markdown_to_pdf/example-markdown-input-004.md.pdf index 8bf193a5d..7895f4bb6 100644 Binary files a/tests/output/test_export_markdown_to_pdf/example-markdown-input-004.md.pdf and b/tests/output/test_export_markdown_to_pdf/example-markdown-input-004.md.pdf differ diff --git a/tests/output/test_export_markdown_to_pdf/example-markdown-input-005.md.pdf b/tests/output/test_export_markdown_to_pdf/example-markdown-input-005.md.pdf index d856f516b..656858840 100644 Binary files a/tests/output/test_export_markdown_to_pdf/example-markdown-input-005.md.pdf and b/tests/output/test_export_markdown_to_pdf/example-markdown-input-005.md.pdf differ diff --git a/tests/output/test_export_markdown_to_pdf/example-markdown-input-006.md.pdf b/tests/output/test_export_markdown_to_pdf/example-markdown-input-006.md.pdf index 464c0c4b2..bab4d2f44 100644 Binary files a/tests/output/test_export_markdown_to_pdf/example-markdown-input-006.md.pdf and b/tests/output/test_export_markdown_to_pdf/example-markdown-input-006.md.pdf differ diff --git a/tests/output/test_export_markdown_to_pdf/example-markdown-input-007.md.pdf b/tests/output/test_export_markdown_to_pdf/example-markdown-input-007.md.pdf index 0a77b93f8..b90ef11c7 100644 Binary files a/tests/output/test_export_markdown_to_pdf/example-markdown-input-007.md.pdf and b/tests/output/test_export_markdown_to_pdf/example-markdown-input-007.md.pdf differ diff --git a/tests/output/test_export_markdown_to_pdf/example-markdown-input-008.md.pdf b/tests/output/test_export_markdown_to_pdf/example-markdown-input-008.md.pdf index b28161c25..1d42d5a65 100644 Binary files a/tests/output/test_export_markdown_to_pdf/example-markdown-input-008.md.pdf and b/tests/output/test_export_markdown_to_pdf/example-markdown-input-008.md.pdf differ diff --git a/tests/output/test_export_markdown_to_pdf/example-markdown-input-009.md.pdf b/tests/output/test_export_markdown_to_pdf/example-markdown-input-009.md.pdf index 60022af04..3d19dc639 100644 Binary files a/tests/output/test_export_markdown_to_pdf/example-markdown-input-009.md.pdf and b/tests/output/test_export_markdown_to_pdf/example-markdown-input-009.md.pdf differ diff --git a/tests/output/test_export_to_mp3/output.mp3 b/tests/output/test_export_to_mp3/output.mp3 index 6acfdaacb..6a9b61763 100644 Binary files a/tests/output/test_export_to_mp3/output.mp3 and b/tests/output/test_export_to_mp3/output.mp3 differ diff --git a/tests/output/test_extract_colors/output_001.pdf b/tests/output/test_extract_colors/output_001.pdf index bd3640022..fdb8673dd 100644 Binary files a/tests/output/test_extract_colors/output_001.pdf and b/tests/output/test_extract_colors/output_001.pdf differ diff --git a/tests/output/test_extract_colors/output_002.pdf b/tests/output/test_extract_colors/output_002.pdf index 4d8a3eef3..6fdb1c11a 100644 Binary files a/tests/output/test_extract_colors/output_002.pdf and b/tests/output/test_extract_colors/output_002.pdf differ diff --git a/tests/output/test_extract_colors/output_002.png b/tests/output/test_extract_colors/output_002.png index ef38a5c0b..12042630a 100644 Binary files a/tests/output/test_extract_colors/output_002.png and b/tests/output/test_extract_colors/output_002.png differ diff --git a/tests/output/test_extract_courier_text/output_001.pdf b/tests/output/test_extract_courier_text/output_001.pdf index 6a0433a05..7179f179c 100644 Binary files a/tests/output/test_extract_courier_text/output_001.pdf and b/tests/output/test_extract_courier_text/output_001.pdf differ diff --git a/tests/output/test_extract_font_names/output_001.pdf b/tests/output/test_extract_font_names/output_001.pdf index b40c0f7ec..19bf41b5d 100644 Binary files a/tests/output/test_extract_font_names/output_001.pdf and b/tests/output/test_extract_font_names/output_001.pdf differ diff --git a/tests/output/test_extract_font_names/output_002.pdf b/tests/output/test_extract_font_names/output_002.pdf index 17b4fee62..8936def8f 100644 Binary files a/tests/output/test_extract_font_names/output_002.pdf and b/tests/output/test_extract_font_names/output_002.pdf differ diff --git a/tests/output/test_extract_keywords/output_001.pdf b/tests/output/test_extract_keywords/output_001.pdf index 5133b4872..636820646 100644 Binary files a/tests/output/test_extract_keywords/output_001.pdf and b/tests/output/test_extract_keywords/output_001.pdf differ diff --git a/tests/output/test_extract_keywords/output_002.pdf b/tests/output/test_extract_keywords/output_002.pdf index 0759e3ed7..afa298b21 100644 Binary files a/tests/output/test_extract_keywords/output_002.pdf and b/tests/output/test_extract_keywords/output_002.pdf differ diff --git a/tests/output/test_extract_keywords/output_003.pdf b/tests/output/test_extract_keywords/output_003.pdf index e424bc6d4..5adab6c1b 100644 Binary files a/tests/output/test_extract_keywords/output_003.pdf and b/tests/output/test_extract_keywords/output_003.pdf differ diff --git a/tests/output/test_extract_red_text/output_001.pdf b/tests/output/test_extract_red_text/output_001.pdf index 37cc96a48..1d54331ef 100644 Binary files a/tests/output/test_extract_red_text/output_001.pdf and b/tests/output/test_extract_red_text/output_001.pdf differ diff --git a/tests/output/test_extract_regex/output_001.pdf b/tests/output/test_extract_regex/output_001.pdf index 8cedc27de..f1b8fd3fe 100644 Binary files a/tests/output/test_extract_regex/output_001.pdf and b/tests/output/test_extract_regex/output_001.pdf differ diff --git a/tests/output/test_extract_regex/output_002.pdf b/tests/output/test_extract_regex/output_002.pdf index fa699d2c8..d1e2a1ad4 100644 Binary files a/tests/output/test_extract_regex/output_002.pdf and b/tests/output/test_extract_regex/output_002.pdf differ diff --git a/tests/output/test_extract_text/output_001.pdf b/tests/output/test_extract_text/output_001.pdf index 875bc4366..7a27009d1 100644 Binary files a/tests/output/test_extract_text/output_001.pdf and b/tests/output/test_extract_text/output_001.pdf differ diff --git a/tests/output/test_extract_text_expect_ground_truth/output.pdf b/tests/output/test_extract_text_expect_ground_truth/output.pdf index 08c9e3972..42c001b0e 100644 Binary files a/tests/output/test_extract_text_expect_ground_truth/output.pdf and b/tests/output/test_extract_text_expect_ground_truth/output.pdf differ diff --git a/tests/output/test_extract_text_from_self_made_invoice/output.pdf b/tests/output/test_extract_text_from_self_made_invoice/output.pdf index ecd7fc024..5fda5f1b2 100644 Binary files a/tests/output/test_extract_text_from_self_made_invoice/output.pdf and b/tests/output/test_extract_text_from_self_made_invoice/output.pdf differ diff --git a/tests/output/test_extract_text_using_ocr/output_001.pdf b/tests/output/test_extract_text_using_ocr/output_001.pdf index 79dadfd35..4345744ab 100644 Binary files a/tests/output/test_extract_text_using_ocr/output_001.pdf and b/tests/output/test_extract_text_using_ocr/output_001.pdf differ diff --git a/tests/output/test_margin_and_padding/output_001.pdf b/tests/output/test_margin_and_padding/output_001.pdf index b02901a2e..e2ffca2e0 100644 Binary files a/tests/output/test_margin_and_padding/output_001.pdf and b/tests/output/test_margin_and_padding/output_001.pdf differ diff --git a/tests/output/test_margin_and_padding/output_002.pdf b/tests/output/test_margin_and_padding/output_002.pdf index 90575296d..8bbc87db0 100644 Binary files a/tests/output/test_margin_and_padding/output_002.pdf and b/tests/output/test_margin_and_padding/output_002.pdf differ diff --git a/tests/output/test_modify_image/output_001.pdf b/tests/output/test_modify_image/output_001.pdf index 390d29c1d..7b67fa19e 100644 Binary files a/tests/output/test_modify_image/output_001.pdf and b/tests/output/test_modify_image/output_001.pdf differ diff --git a/tests/output/test_modify_image/output_002.pdf b/tests/output/test_modify_image/output_002.pdf index af9ca948d..df16217b1 100644 Binary files a/tests/output/test_modify_image/output_002.pdf and b/tests/output/test_modify_image/output_002.pdf differ diff --git a/tests/output/test_open_document/output.pdf b/tests/output/test_open_document/output.pdf index 435f0641f..8c19b786d 100644 Binary files a/tests/output/test_open_document/output.pdf and b/tests/output/test_open_document/output.pdf differ diff --git a/tests/output/test_open_encrypted_document/output.pdf b/tests/output/test_open_encrypted_document/output.pdf new file mode 100644 index 000000000..a37519d7e Binary files /dev/null and b/tests/output/test_open_encrypted_document/output.pdf differ diff --git a/tests/output/test_optimize_images/output_001.pdf b/tests/output/test_optimize_images/output_001.pdf index 23526ea01..b4e670f89 100644 Binary files a/tests/output/test_optimize_images/output_001.pdf and b/tests/output/test_optimize_images/output_001.pdf differ diff --git a/tests/output/test_redact_common_regular_expressions/output_001.pdf b/tests/output/test_redact_common_regular_expressions/output_001.pdf index c50615c6d..5e9b0b168 100644 Binary files a/tests/output/test_redact_common_regular_expressions/output_001.pdf and b/tests/output/test_redact_common_regular_expressions/output_001.pdf differ diff --git a/tests/output/test_redact_common_regular_expressions/output_002.pdf b/tests/output/test_redact_common_regular_expressions/output_002.pdf index f2f62e2c7..b57c6fb3f 100644 Binary files a/tests/output/test_redact_common_regular_expressions/output_002.pdf and b/tests/output/test_redact_common_regular_expressions/output_002.pdf differ diff --git a/tests/output/test_redact_common_regular_expressions/output_003.pdf b/tests/output/test_redact_common_regular_expressions/output_003.pdf index 626c12778..7a9e05d4e 100644 Binary files a/tests/output/test_redact_common_regular_expressions/output_003.pdf and b/tests/output/test_redact_common_regular_expressions/output_003.pdf differ diff --git a/tests/output/test_remove_annotation/output_001.pdf b/tests/output/test_remove_annotation/output_001.pdf index 527221629..b82aa176c 100644 Binary files a/tests/output/test_remove_annotation/output_001.pdf and b/tests/output/test_remove_annotation/output_001.pdf differ diff --git a/tests/output/test_remove_annotation/output_002.pdf b/tests/output/test_remove_annotation/output_002.pdf index 2d11f2b6f..0f4261095 100644 Binary files a/tests/output/test_remove_annotation/output_002.pdf and b/tests/output/test_remove_annotation/output_002.pdf differ diff --git a/tests/output/test_remove_annotation/output_003.pdf b/tests/output/test_remove_annotation/output_003.pdf index 7cc6a0707..365920274 100644 Binary files a/tests/output/test_remove_annotation/output_003.pdf and b/tests/output/test_remove_annotation/output_003.pdf differ diff --git a/tests/output/test_remove_page/output_001.pdf b/tests/output/test_remove_page/output_001.pdf index 1288868cd..4140523be 100644 Binary files a/tests/output/test_remove_page/output_001.pdf and b/tests/output/test_remove_page/output_001.pdf differ diff --git a/tests/output/test_remove_page/output_002.pdf b/tests/output/test_remove_page/output_002.pdf index 8f93b8fe9..093d7747b 100644 Binary files a/tests/output/test_remove_page/output_002.pdf and b/tests/output/test_remove_page/output_002.pdf differ diff --git a/tests/output/test_remove_page/output_003.pdf b/tests/output/test_remove_page/output_003.pdf index b7b0adb60..d05e9009b 100644 Binary files a/tests/output/test_remove_page/output_003.pdf and b/tests/output/test_remove_page/output_003.pdf differ diff --git a/tests/output/test_remove_page/output_004.pdf b/tests/output/test_remove_page/output_004.pdf index 307ce6530..c7aa32c17 100644 Binary files a/tests/output/test_remove_page/output_004.pdf and b/tests/output/test_remove_page/output_004.pdf differ diff --git a/tests/output/test_rotate_page/output_001.pdf b/tests/output/test_rotate_page/output_001.pdf index 0d0c3cd37..2650982a3 100644 Binary files a/tests/output/test_rotate_page/output_001.pdf and b/tests/output/test_rotate_page/output_001.pdf differ diff --git a/tests/output/test_rotate_page/output_002.pdf b/tests/output/test_rotate_page/output_002.pdf index f8902eafc..88e58490e 100644 Binary files a/tests/output/test_rotate_page/output_002.pdf and b/tests/output/test_rotate_page/output_002.pdf differ diff --git a/tests/output/test_rotate_page/output_003.pdf b/tests/output/test_rotate_page/output_003.pdf index 39228b488..a4ddd3c51 100644 Binary files a/tests/output/test_rotate_page/output_003.pdf and b/tests/output/test_rotate_page/output_003.pdf differ diff --git a/tests/output/test_split_complementary_color_scheme/output.pdf b/tests/output/test_split_complementary_color_scheme/output.pdf index 04857ccc3..ebe93366b 100644 Binary files a/tests/output/test_split_complementary_color_scheme/output.pdf and b/tests/output/test_split_complementary_color_scheme/output.pdf differ diff --git a/tests/output/test_tetradic_rectangle_color_scheme/output.pdf b/tests/output/test_tetradic_rectangle_color_scheme/output.pdf index d4be8df54..695948e11 100644 Binary files a/tests/output/test_tetradic_rectangle_color_scheme/output.pdf and b/tests/output/test_tetradic_rectangle_color_scheme/output.pdf differ diff --git a/tests/output/test_tetradic_square_color_scheme/output.pdf b/tests/output/test_tetradic_square_color_scheme/output.pdf index 6284f1127..b6cf27d7a 100644 Binary files a/tests/output/test_tetradic_square_color_scheme/output.pdf and b/tests/output/test_tetradic_square_color_scheme/output.pdf differ diff --git a/tests/output/test_triadic_color_scheme/output.pdf b/tests/output/test_triadic_color_scheme/output.pdf index 5b6ee2bf9..cccd25565 100644 Binary files a/tests/output/test_triadic_color_scheme/output.pdf and b/tests/output/test_triadic_color_scheme/output.pdf differ diff --git a/tests/output/test_write_2_scatter_plots/output.pdf b/tests/output/test_write_2_scatter_plots/output.pdf index 5b57722f1..6ff41d921 100644 Binary files a/tests/output/test_write_2_scatter_plots/output.pdf and b/tests/output/test_write_2_scatter_plots/output.pdf differ diff --git a/tests/output/test_write_3d_density_chart/output.pdf b/tests/output/test_write_3d_density_chart/output.pdf index 32edd2ebe..56eb5c76a 100644 Binary files a/tests/output/test_write_3d_density_chart/output.pdf and b/tests/output/test_write_3d_density_chart/output.pdf differ diff --git a/tests/output/test_write_3d_surface_plot/output.pdf b/tests/output/test_write_3d_surface_plot/output.pdf index f7693ecc6..ed9fd5cb5 100644 Binary files a/tests/output/test_write_3d_surface_plot/output.pdf and b/tests/output/test_write_3d_surface_plot/output.pdf differ diff --git a/tests/output/test_write_all_types_of_barcode/output.pdf b/tests/output/test_write_all_types_of_barcode/output.pdf index eb8af5e76..cccce9306 100644 Binary files a/tests/output/test_write_all_types_of_barcode/output.pdf and b/tests/output/test_write_all_types_of_barcode/output.pdf differ diff --git a/tests/output/test_write_battleship/output.pdf b/tests/output/test_write_battleship/output.pdf index 70a05763a..cc932a4d2 100644 Binary files a/tests/output/test_write_battleship/output.pdf and b/tests/output/test_write_battleship/output.pdf differ diff --git a/tests/output/test_write_blobs/output.pdf b/tests/output/test_write_blobs/output.pdf index 913c7f031..4cb1cf4c3 100644 Binary files a/tests/output/test_write_blobs/output.pdf and b/tests/output/test_write_blobs/output.pdf differ diff --git a/tests/output/test_write_check_box/output_001.pdf b/tests/output/test_write_check_box/output_001.pdf index 30ef0ce8a..668e9431c 100644 Binary files a/tests/output/test_write_check_box/output_001.pdf and b/tests/output/test_write_check_box/output_001.pdf differ diff --git a/tests/output/test_write_check_box/output_002.pdf b/tests/output/test_write_check_box/output_002.pdf index e3919e3f2..359c4ab97 100644 Binary files a/tests/output/test_write_check_box/output_002.pdf and b/tests/output/test_write_check_box/output_002.pdf differ diff --git a/tests/output/test_write_chunk_of_text/output.pdf b/tests/output/test_write_chunk_of_text/output.pdf index 14c191276..67ad66f5e 100644 Binary files a/tests/output/test_write_chunk_of_text/output.pdf and b/tests/output/test_write_chunk_of_text/output.pdf differ diff --git a/tests/output/test_write_chunk_of_text_escaped_chars/output.pdf b/tests/output/test_write_chunk_of_text_escaped_chars/output.pdf index 07031ee10..601d1ee6c 100644 Binary files a/tests/output/test_write_chunk_of_text_escaped_chars/output.pdf and b/tests/output/test_write_chunk_of_text_escaped_chars/output.pdf differ diff --git a/tests/output/test_write_chunk_of_text_in_rainbow_colors/output.pdf b/tests/output/test_write_chunk_of_text_in_rainbow_colors/output.pdf index e859a43f1..eaa1657a7 100644 Binary files a/tests/output/test_write_chunk_of_text_in_rainbow_colors/output.pdf and b/tests/output/test_write_chunk_of_text_in_rainbow_colors/output.pdf differ diff --git a/tests/output/test_write_chunks_of_text/output_001.pdf b/tests/output/test_write_chunks_of_text/output_001.pdf index 2d3271990..359a3be94 100644 Binary files a/tests/output/test_write_chunks_of_text/output_001.pdf and b/tests/output/test_write_chunks_of_text/output_001.pdf differ diff --git a/tests/output/test_write_chunks_of_text/output_002.pdf b/tests/output/test_write_chunks_of_text/output_002.pdf index 53a5fce46..b23cc5fb4 100644 Binary files a/tests/output/test_write_chunks_of_text/output_002.pdf and b/tests/output/test_write_chunks_of_text/output_002.pdf differ diff --git a/tests/output/test_write_chunks_of_text/output_003.pdf b/tests/output/test_write_chunks_of_text/output_003.pdf index ee73cb7e8..bd978da97 100644 Binary files a/tests/output/test_write_chunks_of_text/output_003.pdf and b/tests/output/test_write_chunks_of_text/output_003.pdf differ diff --git a/tests/output/test_write_chunks_of_text/output_004.pdf b/tests/output/test_write_chunks_of_text/output_004.pdf index 411265a9e..31d533c74 100644 Binary files a/tests/output/test_write_chunks_of_text/output_004.pdf and b/tests/output/test_write_chunks_of_text/output_004.pdf differ diff --git a/tests/output/test_write_chunks_of_text/output_005.pdf b/tests/output/test_write_chunks_of_text/output_005.pdf index c052bc67a..0ad743587 100644 Binary files a/tests/output/test_write_chunks_of_text/output_005.pdf and b/tests/output/test_write_chunks_of_text/output_005.pdf differ diff --git a/tests/output/test_write_chunks_of_text_preserves_bounding_boxes/output.pdf b/tests/output/test_write_chunks_of_text_preserves_bounding_boxes/output.pdf index 5fadf92fb..e305afa3f 100644 Binary files a/tests/output/test_write_chunks_of_text_preserves_bounding_boxes/output.pdf and b/tests/output/test_write_chunks_of_text_preserves_bounding_boxes/output.pdf differ diff --git a/tests/output/test_write_code_128_barcode/output.pdf b/tests/output/test_write_code_128_barcode/output.pdf index 5f5adfb88..19e0b297c 100644 Binary files a/tests/output/test_write_code_128_barcode/output.pdf and b/tests/output/test_write_code_128_barcode/output.pdf differ diff --git a/tests/output/test_write_code_128_barcode_in_color/output.pdf b/tests/output/test_write_code_128_barcode_in_color/output.pdf index 8824f54df..e44f1cc5e 100644 Binary files a/tests/output/test_write_code_128_barcode_in_color/output.pdf and b/tests/output/test_write_code_128_barcode_in_color/output.pdf differ diff --git a/tests/output/test_write_codeblock/output.pdf b/tests/output/test_write_codeblock/output.pdf index 9de6bff34..9dfcc35bb 100644 Binary files a/tests/output/test_write_codeblock/output.pdf and b/tests/output/test_write_codeblock/output.pdf differ diff --git a/tests/output/test_write_dragon_curve/output.pdf b/tests/output/test_write_dragon_curve/output.pdf index 675ccee61..99e3d6871 100644 Binary files a/tests/output/test_write_dragon_curve/output.pdf and b/tests/output/test_write_dragon_curve/output.pdf differ diff --git a/tests/output/test_write_drop_down_list/output_001.pdf b/tests/output/test_write_drop_down_list/output_001.pdf index 3f1897e3d..16baa9f41 100644 Binary files a/tests/output/test_write_drop_down_list/output_001.pdf and b/tests/output/test_write_drop_down_list/output_001.pdf differ diff --git a/tests/output/test_write_drop_down_list/output_002.pdf b/tests/output/test_write_drop_down_list/output_002.pdf index 26e0af78a..fe195caa4 100644 Binary files a/tests/output/test_write_drop_down_list/output_002.pdf and b/tests/output/test_write_drop_down_list/output_002.pdf differ diff --git a/tests/output/test_write_emoji/output.pdf b/tests/output/test_write_emoji/output.pdf index 4961ba0d1..18e6456b6 100644 Binary files a/tests/output/test_write_emoji/output.pdf and b/tests/output/test_write_emoji/output.pdf differ diff --git a/tests/output/test_write_empty_document/output.pdf b/tests/output/test_write_empty_document/output.pdf index 42df8d341..ebcdb0773 100644 Binary files a/tests/output/test_write_empty_document/output.pdf and b/tests/output/test_write_empty_document/output.pdf differ diff --git a/tests/output/test_write_fixed_column_width_table/output_001.pdf b/tests/output/test_write_fixed_column_width_table/output_001.pdf index 4bf3ad298..b8f596788 100644 Binary files a/tests/output/test_write_fixed_column_width_table/output_001.pdf and b/tests/output/test_write_fixed_column_width_table/output_001.pdf differ diff --git a/tests/output/test_write_fixed_column_width_table/output_002.pdf b/tests/output/test_write_fixed_column_width_table/output_002.pdf index 221c6291d..082d0ee93 100644 Binary files a/tests/output/test_write_fixed_column_width_table/output_002.pdf and b/tests/output/test_write_fixed_column_width_table/output_002.pdf differ diff --git a/tests/output/test_write_fixed_column_width_table/output_003.pdf b/tests/output/test_write_fixed_column_width_table/output_003.pdf index 5edbc35e4..f1feb7c20 100644 Binary files a/tests/output/test_write_fixed_column_width_table/output_003.pdf and b/tests/output/test_write_fixed_column_width_table/output_003.pdf differ diff --git a/tests/output/test_write_fixed_column_width_table/output_004.pdf b/tests/output/test_write_fixed_column_width_table/output_004.pdf index e32bc0926..baabdb6ec 100644 Binary files a/tests/output/test_write_fixed_column_width_table/output_004.pdf and b/tests/output/test_write_fixed_column_width_table/output_004.pdf differ diff --git a/tests/output/test_write_fixed_column_width_table/output_005.pdf b/tests/output/test_write_fixed_column_width_table/output_005.pdf index 5c1eadd2f..2892dbc47 100644 Binary files a/tests/output/test_write_fixed_column_width_table/output_005.pdf and b/tests/output/test_write_fixed_column_width_table/output_005.pdf differ diff --git a/tests/output/test_write_flexi_table/output_001.pdf b/tests/output/test_write_flexi_table/output_001.pdf index 6bca8c00c..37954a738 100644 Binary files a/tests/output/test_write_flexi_table/output_001.pdf and b/tests/output/test_write_flexi_table/output_001.pdf differ diff --git a/tests/output/test_write_flexi_table/output_002.pdf b/tests/output/test_write_flexi_table/output_002.pdf index e515ea961..308c21b22 100644 Binary files a/tests/output/test_write_flexi_table/output_002.pdf and b/tests/output/test_write_flexi_table/output_002.pdf differ diff --git a/tests/output/test_write_flexi_table/output_003.pdf b/tests/output/test_write_flexi_table/output_003.pdf index d7855269a..0b19773eb 100644 Binary files a/tests/output/test_write_flexi_table/output_003.pdf and b/tests/output/test_write_flexi_table/output_003.pdf differ diff --git a/tests/output/test_write_flexi_table/output_004.pdf b/tests/output/test_write_flexi_table/output_004.pdf index 1d183cabc..5119ff22c 100644 Binary files a/tests/output/test_write_flexi_table/output_004.pdf and b/tests/output/test_write_flexi_table/output_004.pdf differ diff --git a/tests/output/test_write_flexi_table/output_005.pdf b/tests/output/test_write_flexi_table/output_005.pdf index b7f3fa95c..e9125cf24 100644 Binary files a/tests/output/test_write_flexi_table/output_005.pdf and b/tests/output/test_write_flexi_table/output_005.pdf differ diff --git a/tests/output/test_write_flexi_table_with_preferred_width/output.pdf b/tests/output/test_write_flexi_table_with_preferred_width/output.pdf index 691c178c1..fbfb476b6 100644 Binary files a/tests/output/test_write_flexi_table_with_preferred_width/output.pdf and b/tests/output/test_write_flexi_table_with_preferred_width/output.pdf differ diff --git a/tests/output/test_write_flowchart_line_art/output.pdf b/tests/output/test_write_flowchart_line_art/output.pdf index 5322b11f0..27a650c52 100644 Binary files a/tests/output/test_write_flowchart_line_art/output.pdf and b/tests/output/test_write_flowchart_line_art/output.pdf differ diff --git a/tests/output/test_write_flyer/output.pdf b/tests/output/test_write_flyer/output.pdf index 52b808128..855b58247 100644 Binary files a/tests/output/test_write_flyer/output.pdf and b/tests/output/test_write_flyer/output.pdf differ diff --git a/tests/output/test_write_grayscale_image/output.pdf b/tests/output/test_write_grayscale_image/output.pdf index ef6328df1..474fd7662 100644 Binary files a/tests/output/test_write_grayscale_image/output.pdf and b/tests/output/test_write_grayscale_image/output.pdf differ diff --git a/tests/output/test_write_hyphenated_paragraph/output.pdf b/tests/output/test_write_hyphenated_paragraph/output.pdf index d98bb34b9..760e059f6 100644 Binary files a/tests/output/test_write_hyphenated_paragraph/output.pdf and b/tests/output/test_write_hyphenated_paragraph/output.pdf differ diff --git a/tests/output/test_write_image_aligned_center/output.pdf b/tests/output/test_write_image_aligned_center/output.pdf index 91bdf9f81..bebf35e74 100644 Binary files a/tests/output/test_write_image_aligned_center/output.pdf and b/tests/output/test_write_image_aligned_center/output.pdf differ diff --git a/tests/output/test_write_image_by_url/output.pdf b/tests/output/test_write_image_by_url/output.pdf index 74aec45d5..8a30eac5d 100644 Binary files a/tests/output/test_write_image_by_url/output.pdf and b/tests/output/test_write_image_by_url/output.pdf differ diff --git a/tests/output/test_write_incomplete_table/output.pdf b/tests/output/test_write_incomplete_table/output.pdf index aaba039d3..08c8ee86a 100644 Binary files a/tests/output/test_write_incomplete_table/output.pdf and b/tests/output/test_write_incomplete_table/output.pdf differ diff --git a/tests/output/test_write_line_of_text_justified_center/output.pdf b/tests/output/test_write_line_of_text_justified_center/output.pdf index 20b1c076a..14864dfd1 100644 Binary files a/tests/output/test_write_line_of_text_justified_center/output.pdf and b/tests/output/test_write_line_of_text_justified_center/output.pdf differ diff --git a/tests/output/test_write_line_of_text_justified_full/output.pdf b/tests/output/test_write_line_of_text_justified_full/output.pdf index 72dadbe8f..b4a90c338 100644 Binary files a/tests/output/test_write_line_of_text_justified_full/output.pdf and b/tests/output/test_write_line_of_text_justified_full/output.pdf differ diff --git a/tests/output/test_write_line_of_text_justified_right/output.pdf b/tests/output/test_write_line_of_text_justified_right/output.pdf index 72297552b..beb841a9a 100644 Binary files a/tests/output/test_write_line_of_text_justified_right/output.pdf and b/tests/output/test_write_line_of_text_justified_right/output.pdf differ diff --git a/tests/output/test_write_lissajours_line_art/output.pdf b/tests/output/test_write_lissajours_line_art/output.pdf index b86b97a57..b7020b8bf 100644 Binary files a/tests/output/test_write_lissajours_line_art/output.pdf and b/tests/output/test_write_lissajours_line_art/output.pdf differ diff --git a/tests/output/test_write_long_unordered_list/output.pdf b/tests/output/test_write_long_unordered_list/output.pdf index b8cf5abd6..0639fda4c 100644 Binary files a/tests/output/test_write_long_unordered_list/output.pdf and b/tests/output/test_write_long_unordered_list/output.pdf differ diff --git a/tests/output/test_write_multiple_pages/output.pdf b/tests/output/test_write_multiple_pages/output.pdf index ff676da6a..1fb4be65a 100644 Binary files a/tests/output/test_write_multiple_pages/output.pdf and b/tests/output/test_write_multiple_pages/output.pdf differ diff --git a/tests/output/test_write_nested_ordered_list/output.pdf b/tests/output/test_write_nested_ordered_list/output.pdf index 8f00b7fe4..688c2c467 100644 Binary files a/tests/output/test_write_nested_ordered_list/output.pdf and b/tests/output/test_write_nested_ordered_list/output.pdf differ diff --git a/tests/output/test_write_nested_unordered_list/output.pdf b/tests/output/test_write_nested_unordered_list/output.pdf index a843371d4..7b898d361 100644 Binary files a/tests/output/test_write_nested_unordered_list/output.pdf and b/tests/output/test_write_nested_unordered_list/output.pdf differ diff --git a/tests/output/test_write_nested_unordered_list/output.png b/tests/output/test_write_nested_unordered_list/output.png index 2e126c9c6..b57b1a904 100644 Binary files a/tests/output/test_write_nested_unordered_list/output.png and b/tests/output/test_write_nested_unordered_list/output.png differ diff --git a/tests/output/test_write_ordered_list/output_001.pdf b/tests/output/test_write_ordered_list/output_001.pdf index 531bfbe89..af811af21 100644 Binary files a/tests/output/test_write_ordered_list/output_001.pdf and b/tests/output/test_write_ordered_list/output_001.pdf differ diff --git a/tests/output/test_write_ordered_list/output_002.pdf b/tests/output/test_write_ordered_list/output_002.pdf index b27e212f1..d3db47e29 100644 Binary files a/tests/output/test_write_ordered_list/output_002.pdf and b/tests/output/test_write_ordered_list/output_002.pdf differ diff --git a/tests/output/test_write_paragraph/output.pdf b/tests/output/test_write_paragraph/output.pdf index 9db61f62d..c7ea5de01 100644 Binary files a/tests/output/test_write_paragraph/output.pdf and b/tests/output/test_write_paragraph/output.pdf differ diff --git a/tests/output/test_write_paragraph_alignment/output.pdf b/tests/output/test_write_paragraph_alignment/output.pdf index 640391752..51b3ea97b 100644 Binary files a/tests/output/test_write_paragraph_alignment/output.pdf and b/tests/output/test_write_paragraph_alignment/output.pdf differ diff --git a/tests/output/test_write_paragraph_border_left/output.pdf b/tests/output/test_write_paragraph_border_left/output.pdf index 5a3409383..54f52f473 100644 Binary files a/tests/output/test_write_paragraph_border_left/output.pdf and b/tests/output/test_write_paragraph_border_left/output.pdf differ diff --git a/tests/output/test_write_paragraph_force_split/output.pdf b/tests/output/test_write_paragraph_force_split/output.pdf index e936f2fd6..0f8af9545 100644 Binary files a/tests/output/test_write_paragraph_force_split/output.pdf and b/tests/output/test_write_paragraph_force_split/output.pdf differ diff --git a/tests/output/test_write_paragraph_justified_center/output_001.pdf b/tests/output/test_write_paragraph_justified_center/output_001.pdf index 539a86c00..9e3947f3f 100644 Binary files a/tests/output/test_write_paragraph_justified_center/output_001.pdf and b/tests/output/test_write_paragraph_justified_center/output_001.pdf differ diff --git a/tests/output/test_write_paragraph_justified_center/output_002.pdf b/tests/output/test_write_paragraph_justified_center/output_002.pdf index aecfaae47..b177aa761 100644 Binary files a/tests/output/test_write_paragraph_justified_center/output_002.pdf and b/tests/output/test_write_paragraph_justified_center/output_002.pdf differ diff --git a/tests/output/test_write_paragraph_justified_center_with_padding/output.pdf b/tests/output/test_write_paragraph_justified_center_with_padding/output.pdf index 87d8dbd83..b8558a66a 100644 Binary files a/tests/output/test_write_paragraph_justified_center_with_padding/output.pdf and b/tests/output/test_write_paragraph_justified_center_with_padding/output.pdf differ diff --git a/tests/output/test_write_paragraph_justified_center_with_padding_and_border/output.pdf b/tests/output/test_write_paragraph_justified_center_with_padding_and_border/output.pdf index 0ae9945c1..88e531ec2 100644 Binary files a/tests/output/test_write_paragraph_justified_center_with_padding_and_border/output.pdf and b/tests/output/test_write_paragraph_justified_center_with_padding_and_border/output.pdf differ diff --git a/tests/output/test_write_paragraph_justified_center_with_padding_and_border_and_background/output.pdf b/tests/output/test_write_paragraph_justified_center_with_padding_and_border_and_background/output.pdf index 4220e3433..f4d7902ab 100644 Binary files a/tests/output/test_write_paragraph_justified_center_with_padding_and_border_and_background/output.pdf and b/tests/output/test_write_paragraph_justified_center_with_padding_and_border_and_background/output.pdf differ diff --git a/tests/output/test_write_paragraph_justified_full/output.pdf b/tests/output/test_write_paragraph_justified_full/output.pdf index 3746c5484..b94990f04 100644 Binary files a/tests/output/test_write_paragraph_justified_full/output.pdf and b/tests/output/test_write_paragraph_justified_full/output.pdf differ diff --git a/tests/output/test_write_paragraph_justified_right/output.pdf b/tests/output/test_write_paragraph_justified_right/output.pdf index ad8bfaed1..bfa542eff 100644 Binary files a/tests/output/test_write_paragraph_justified_right/output.pdf and b/tests/output/test_write_paragraph_justified_right/output.pdf differ diff --git a/tests/output/test_write_paragraph_preserve_space/output.pdf b/tests/output/test_write_paragraph_preserve_space/output.pdf index 51de22a67..32da1afa7 100644 Binary files a/tests/output/test_write_paragraph_preserve_space/output.pdf and b/tests/output/test_write_paragraph_preserve_space/output.pdf differ diff --git a/tests/output/test_write_paragraph_save_twice/output_001.pdf b/tests/output/test_write_paragraph_save_twice/output_001.pdf index 6c0367c1d..3f68d250a 100644 Binary files a/tests/output/test_write_paragraph_save_twice/output_001.pdf and b/tests/output/test_write_paragraph_save_twice/output_001.pdf differ diff --git a/tests/output/test_write_paragraph_save_twice/output_002.pdf b/tests/output/test_write_paragraph_save_twice/output_002.pdf index 48dabd4c5..841b811b4 100644 Binary files a/tests/output/test_write_paragraph_save_twice/output_002.pdf and b/tests/output/test_write_paragraph_save_twice/output_002.pdf differ diff --git a/tests/output/test_write_paragraph_with_accented_letters/output.pdf b/tests/output/test_write_paragraph_with_accented_letters/output.pdf index 6dfe6308b..21a9094fd 100644 Binary files a/tests/output/test_write_paragraph_with_accented_letters/output.pdf and b/tests/output/test_write_paragraph_with_accented_letters/output.pdf differ diff --git a/tests/output/test_write_paragraphs_using_multi_column_layout/output.pdf b/tests/output/test_write_paragraphs_using_multi_column_layout/output.pdf index 76f4f74f3..ff47b2b05 100644 Binary files a/tests/output/test_write_paragraphs_using_multi_column_layout/output.pdf and b/tests/output/test_write_paragraphs_using_multi_column_layout/output.pdf differ diff --git a/tests/output/test_write_paragraphs_using_single_column_layout/output.pdf b/tests/output/test_write_paragraphs_using_single_column_layout/output.pdf index 7475cbde0..60ea65976 100644 Binary files a/tests/output/test_write_paragraphs_using_single_column_layout/output.pdf and b/tests/output/test_write_paragraphs_using_single_column_layout/output.pdf differ diff --git a/tests/output/test_write_paragraphs_with_headings/output.pdf b/tests/output/test_write_paragraphs_with_headings/output.pdf index 5f9e9fc24..261a947c8 100644 Binary files a/tests/output/test_write_paragraphs_with_headings/output.pdf and b/tests/output/test_write_paragraphs_with_headings/output.pdf differ diff --git a/tests/output/test_write_pil_image/output.pdf b/tests/output/test_write_pil_image/output.pdf index 7938f5b93..3e1387342 100644 Binary files a/tests/output/test_write_pil_image/output.pdf and b/tests/output/test_write_pil_image/output.pdf differ diff --git a/tests/output/test_write_png_image_by_url/output.pdf b/tests/output/test_write_png_image_by_url/output.pdf index 62b6f19f2..3f5c9fe86 100644 Binary files a/tests/output/test_write_png_image_by_url/output.pdf and b/tests/output/test_write_png_image_by_url/output.pdf differ diff --git a/tests/output/test_write_radar_plot/output.pdf b/tests/output/test_write_radar_plot/output.pdf index e71be815d..84d59472a 100644 Binary files a/tests/output/test_write_radar_plot/output.pdf and b/tests/output/test_write_radar_plot/output.pdf differ diff --git a/tests/output/test_write_table_with_col_span/output.pdf b/tests/output/test_write_table_with_col_span/output.pdf index 851a67444..d64d4ff99 100644 Binary files a/tests/output/test_write_table_with_col_span/output.pdf and b/tests/output/test_write_table_with_col_span/output.pdf differ diff --git a/tests/output/test_write_table_with_image/output.pdf b/tests/output/test_write_table_with_image/output.pdf index f0597f606..4acf7eaa6 100644 Binary files a/tests/output/test_write_table_with_image/output.pdf and b/tests/output/test_write_table_with_image/output.pdf differ diff --git a/tests/output/test_write_table_with_non_black_paragraphs/output.pdf b/tests/output/test_write_table_with_non_black_paragraphs/output.pdf index ceb34976c..50228d0f0 100644 Binary files a/tests/output/test_write_table_with_non_black_paragraphs/output.pdf and b/tests/output/test_write_table_with_non_black_paragraphs/output.pdf differ diff --git a/tests/output/test_write_table_with_rainbow_background/output.pdf b/tests/output/test_write_table_with_rainbow_background/output.pdf index 68fe6924e..6c8985a36 100644 Binary files a/tests/output/test_write_table_with_rainbow_background/output.pdf and b/tests/output/test_write_table_with_rainbow_background/output.pdf differ diff --git a/tests/output/test_write_table_with_row_span/output.pdf b/tests/output/test_write_table_with_row_span/output.pdf index 28a3a7aad..e86533f42 100644 Binary files a/tests/output/test_write_table_with_row_span/output.pdf and b/tests/output/test_write_table_with_row_span/output.pdf differ diff --git a/tests/output/test_write_table_with_special_characters/output.pdf b/tests/output/test_write_table_with_special_characters/output.pdf index 63762b1f0..e5cc5c76a 100644 Binary files a/tests/output/test_write_table_with_special_characters/output.pdf and b/tests/output/test_write_table_with_special_characters/output.pdf differ diff --git a/tests/output/test_write_tents_and_trees/output.pdf b/tests/output/test_write_tents_and_trees/output.pdf index 1f709e30f..9b8a37c94 100644 Binary files a/tests/output/test_write_tents_and_trees/output.pdf and b/tests/output/test_write_tents_and_trees/output.pdf differ diff --git a/tests/output/test_write_text_area/output_001.pdf b/tests/output/test_write_text_area/output_001.pdf index 91417a9cc..01d97ad2b 100644 Binary files a/tests/output/test_write_text_area/output_001.pdf and b/tests/output/test_write_text_area/output_001.pdf differ diff --git a/tests/output/test_write_text_area/output_002.pdf b/tests/output/test_write_text_area/output_002.pdf index 0d613c856..ab133153c 100644 Binary files a/tests/output/test_write_text_area/output_002.pdf and b/tests/output/test_write_text_area/output_002.pdf differ diff --git a/tests/output/test_write_text_field/output_001.pdf b/tests/output/test_write_text_field/output_001.pdf index 07bea4619..ef8a20b12 100644 Binary files a/tests/output/test_write_text_field/output_001.pdf and b/tests/output/test_write_text_field/output_001.pdf differ diff --git a/tests/output/test_write_text_field/output_002.pdf b/tests/output/test_write_text_field/output_002.pdf index bf73a502f..e5621d0d0 100644 Binary files a/tests/output/test_write_text_field/output_002.pdf and b/tests/output/test_write_text_field/output_002.pdf differ diff --git a/tests/output/test_write_unordered_list/output.pdf b/tests/output/test_write_unordered_list/output.pdf index 643355254..7f20179cb 100644 Binary files a/tests/output/test_write_unordered_list/output.pdf and b/tests/output/test_write_unordered_list/output.pdf differ diff --git a/tests/output/test_write_using_low_level_instructions/output.pdf b/tests/output/test_write_using_low_level_instructions/output.pdf index 6d42d8066..4fdd12393 100644 Binary files a/tests/output/test_write_using_low_level_instructions/output.pdf and b/tests/output/test_write_using_low_level_instructions/output.pdf differ diff --git a/tests/output/test_write_with_truetype_font/output_001.pdf b/tests/output/test_write_with_truetype_font/output_001.pdf index ae1f57b3a..390b99c85 100644 Binary files a/tests/output/test_write_with_truetype_font/output_001.pdf and b/tests/output/test_write_with_truetype_font/output_001.pdf differ diff --git a/tests/output/test_write_with_truetype_font/output_002.pdf b/tests/output/test_write_with_truetype_font/output_002.pdf index e99258ea8..764b8345e 100644 Binary files a/tests/output/test_write_with_truetype_font/output_002.pdf and b/tests/output/test_write_with_truetype_font/output_002.pdf differ diff --git a/tests/output/test_write_with_truetype_font/output_002.png b/tests/output/test_write_with_truetype_font/output_002.png index 67ed351fc..95c64e707 100644 Binary files a/tests/output/test_write_with_truetype_font/output_002.png and b/tests/output/test_write_with_truetype_font/output_002.png differ diff --git a/tests/output/test_write_with_truetype_font/output_003.pdf b/tests/output/test_write_with_truetype_font/output_003.pdf index 548cdf103..b6b529d10 100644 Binary files a/tests/output/test_write_with_truetype_font/output_003.pdf and b/tests/output/test_write_with_truetype_font/output_003.pdf differ diff --git a/tests/output/test_write_xl_image/output.pdf b/tests/output/test_write_xl_image/output.pdf index cb76f8ce8..01cb76aa0 100644 Binary files a/tests/output/test_write_xl_image/output.pdf and b/tests/output/test_write_xl_image/output.pdf differ