convert-stream 1.3__tar.gz → 1.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of convert-stream might be problematic. Click here for more details.
- {convert_stream-1.3 → convert_stream-1.4}/PKG-INFO +8 -9
- {convert_stream-1.3 → convert_stream-1.4}/convert_stream/__main__.py +5 -1
- {convert_stream-1.3 → convert_stream-1.4}/convert_stream/_version.py +2 -2
- {convert_stream-1.3 → convert_stream-1.4}/convert_stream/models/models_pdf.py +8 -2
- {convert_stream-1.3 → convert_stream-1.4}/convert_stream/pdf_page.py +11 -13
- {convert_stream-1.3 → convert_stream-1.4}/convert_stream/pdf_to_images.py +1 -1
- {convert_stream-1.3 → convert_stream-1.4}/convert_stream/table_files.py +4 -11
- {convert_stream-1.3 → convert_stream-1.4}/convert_stream.egg-info/PKG-INFO +8 -9
- convert_stream-1.4/convert_stream.egg-info/requires.txt +8 -0
- {convert_stream-1.3 → convert_stream-1.4}/pyproject.toml +9 -9
- convert_stream-1.3/convert_stream.egg-info/requires.txt +0 -9
- {convert_stream-1.3 → convert_stream-1.4}/README.md +0 -0
- {convert_stream-1.3 → convert_stream-1.4}/convert_stream/__init__.py +0 -0
- {convert_stream-1.3 → convert_stream-1.4}/convert_stream/convert.py +0 -0
- {convert_stream-1.3 → convert_stream-1.4}/convert_stream/image_to_pdf.py +0 -0
- {convert_stream-1.3 → convert_stream-1.4}/convert_stream/imagelib.py +0 -0
- {convert_stream-1.3 → convert_stream-1.4}/convert_stream/models/__init__.py +0 -0
- {convert_stream-1.3 → convert_stream-1.4}/convert_stream/models/m_text.py +0 -0
- {convert_stream-1.3 → convert_stream-1.4}/convert_stream/models/models_image.py +0 -0
- {convert_stream-1.3 → convert_stream-1.4}/convert_stream/pdf_compress.py +0 -0
- {convert_stream-1.3 → convert_stream-1.4}/convert_stream/pdf_document.py +0 -0
- {convert_stream-1.3 → convert_stream-1.4}/convert_stream/progress/__init__.py +0 -0
- {convert_stream-1.3 → convert_stream-1.4}/convert_stream/progress/progress_bar.py +0 -0
- {convert_stream-1.3 → convert_stream-1.4}/convert_stream/text.py +0 -0
- {convert_stream-1.3 → convert_stream-1.4}/convert_stream.egg-info/SOURCES.txt +0 -0
- {convert_stream-1.3 → convert_stream-1.4}/convert_stream.egg-info/dependency_links.txt +0 -0
- {convert_stream-1.3 → convert_stream-1.4}/convert_stream.egg-info/top_level.txt +0 -0
- {convert_stream-1.3 → convert_stream-1.4}/setup.cfg +0 -0
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: convert_stream
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.4
|
|
4
4
|
Summary: Manipulação de documentos PDF e Imagens. Converter, Ler, rotacionar exportar etc.
|
|
5
5
|
Author: Bruno Chaves
|
|
6
6
|
Requires-Python: >=3.11
|
|
7
7
|
Description-Content-Type: text/markdown
|
|
8
8
|
Requires-Dist: soup_files
|
|
9
|
-
Requires-Dist:
|
|
10
|
-
Requires-Dist:
|
|
11
|
-
Requires-Dist:
|
|
12
|
-
Requires-Dist:
|
|
13
|
-
Requires-Dist:
|
|
14
|
-
Requires-Dist:
|
|
15
|
-
Requires-Dist:
|
|
16
|
-
Requires-Dist: requests==2.32.3
|
|
9
|
+
Requires-Dist: PyMuPDF
|
|
10
|
+
Requires-Dist: reportlab
|
|
11
|
+
Requires-Dist: openpyxl
|
|
12
|
+
Requires-Dist: pandas
|
|
13
|
+
Requires-Dist: Pillow>=11.3.0
|
|
14
|
+
Requires-Dist: opencv-python
|
|
15
|
+
Requires-Dist: requests>=2.32.4
|
|
17
16
|
|
|
18
17
|
# Configuração instalação:
|
|
19
18
|
pip3 install -r requirements.txt
|
|
@@ -4,7 +4,11 @@
|
|
|
4
4
|
Configuração instalação:
|
|
5
5
|
$ pip3 install -r requirements.txt
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
------------------[versão 1.3.1]------------------
|
|
8
|
+
- excluir PyPDF2 das dependências
|
|
9
|
+
+ incluir add_folder() em PdfStream()
|
|
10
|
+
|
|
11
|
+
|
|
8
12
|
------------------[versão 1.1]------------------
|
|
9
13
|
+ Incluir funcionalidade para adicionar imagens ao PdfStream()
|
|
10
14
|
+ Incluir os métodos __eq__() e __hash__() em PageDocumentPdf()
|
|
@@ -10,11 +10,17 @@ from pandas import DataFrame
|
|
|
10
10
|
from soup_files import File, Directory
|
|
11
11
|
from convert_stream.models.models_image import ABCImageObject, LibraryImage
|
|
12
12
|
from convert_stream.progress.progress_bar import ProgressBarAdapter, ProgressBarSimple
|
|
13
|
-
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
try:
|
|
16
|
+
from PyPDF2 import PageObject
|
|
17
|
+
except Exception as e:
|
|
18
|
+
print(e)
|
|
14
19
|
|
|
15
20
|
try:
|
|
16
21
|
import fitz
|
|
17
|
-
except:
|
|
22
|
+
except Exception as e:
|
|
23
|
+
print(e)
|
|
18
24
|
import PyMuPDF as fitz
|
|
19
25
|
|
|
20
26
|
|
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
from __future__ import annotations
|
|
5
5
|
from typing import List
|
|
6
6
|
from io import BytesIO
|
|
7
|
+
from pandas import DataFrame
|
|
8
|
+
from convert_stream.models.models_pdf import LibraryPDF, ABCPagePdf
|
|
7
9
|
|
|
8
10
|
MODULE_PYPDF2: bool = False
|
|
9
11
|
MODULE_FITZ: bool = False
|
|
@@ -14,8 +16,8 @@ try:
|
|
|
14
16
|
except:
|
|
15
17
|
try:
|
|
16
18
|
import pymupdf as fitz
|
|
17
|
-
except:
|
|
18
|
-
|
|
19
|
+
except Exception as e:
|
|
20
|
+
print(e)
|
|
19
21
|
else:
|
|
20
22
|
MODULE_FITZ = True
|
|
21
23
|
else:
|
|
@@ -24,15 +26,11 @@ else:
|
|
|
24
26
|
# Checar a lib PyPDF2
|
|
25
27
|
try:
|
|
26
28
|
from PyPDF2 import PdfReader, PdfWriter, PageObject
|
|
27
|
-
except:
|
|
28
|
-
|
|
29
|
+
except Exception as e:
|
|
30
|
+
print(e)
|
|
29
31
|
else:
|
|
30
32
|
MODULE_PYPDF2 = True
|
|
31
33
|
|
|
32
|
-
from pandas import DataFrame
|
|
33
|
-
from convert_stream.models.models_pdf import LibraryPDF, ABCPagePdf
|
|
34
|
-
|
|
35
|
-
|
|
36
34
|
#======================================================================#
|
|
37
35
|
# Página PDF
|
|
38
36
|
#======================================================================#
|
|
@@ -51,7 +49,7 @@ class PagePyPdf2(ABCPagePdf):
|
|
|
51
49
|
self.width = self.page.mediabox.width
|
|
52
50
|
self.height = self.page.mediabox.height
|
|
53
51
|
|
|
54
|
-
def to_string(self) -> str:
|
|
52
|
+
def to_string(self) -> str | None:
|
|
55
53
|
s = self.page.extract_text()
|
|
56
54
|
if (s is None) or (s == ''):
|
|
57
55
|
return None
|
|
@@ -100,7 +98,7 @@ class PagePyPdf2(ABCPagePdf):
|
|
|
100
98
|
pass
|
|
101
99
|
|
|
102
100
|
@classmethod
|
|
103
|
-
def create_from_page_bytes(cls, page_bytes) -> PagePyPdf2:
|
|
101
|
+
def create_from_page_bytes(cls, page_bytes) -> PagePyPdf2 | None:
|
|
104
102
|
try:
|
|
105
103
|
pdf_writer = PdfWriter()
|
|
106
104
|
pdf_reader = PdfReader(BytesIO(page_bytes)) # Carrega o PDF a partir dos bytes
|
|
@@ -133,7 +131,7 @@ class PagePdfFitz(ABCPagePdf):
|
|
|
133
131
|
self.width = self.page.rect.width
|
|
134
132
|
self.height = self.page.rect.height
|
|
135
133
|
|
|
136
|
-
def to_string(self) -> str:
|
|
134
|
+
def to_string(self) -> str | None:
|
|
137
135
|
s = self.page.get_text()
|
|
138
136
|
if (s is None) or (s == ''):
|
|
139
137
|
return None
|
|
@@ -185,8 +183,8 @@ class PagePdfFitz(ABCPagePdf):
|
|
|
185
183
|
temp_doc: fitz.Document = fitz.Document(stream=page_bytes, filetype="pdf")
|
|
186
184
|
merged_document.insert_pdf(temp_doc)
|
|
187
185
|
current_page: fitz.Page = merged_document[0]
|
|
188
|
-
except Exception as
|
|
189
|
-
print(
|
|
186
|
+
except Exception as _exce:
|
|
187
|
+
print(_exce)
|
|
190
188
|
return None
|
|
191
189
|
else:
|
|
192
190
|
return cls(current_page, current_page.number)
|
|
@@ -154,7 +154,7 @@ class ConvertPdfToImage(object):
|
|
|
154
154
|
cls,
|
|
155
155
|
lib_image: LibraryImage = LibraryImage.OPENCV,
|
|
156
156
|
*,
|
|
157
|
-
lib_convert_pdf: LibConvertPDF =
|
|
157
|
+
lib_convert_pdf: LibConvertPDF = LibConvertPDF.FITZ,
|
|
158
158
|
dpi: int = 150,
|
|
159
159
|
pbar: ProgressBarAdapter = CreatePbar().get(),
|
|
160
160
|
) -> ConvertPdfToImage:
|
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
from __future__ import annotations
|
|
5
5
|
from abc import ABC, abstractmethod
|
|
6
6
|
from enum import Enum
|
|
7
|
-
from typing import List
|
|
8
|
-
from soup_files import File,
|
|
7
|
+
from typing import List
|
|
8
|
+
from soup_files import File, ProgressBarAdapter
|
|
9
9
|
import pandas as pd
|
|
10
|
-
from convert_stream import CreatePbar, DocumentPdf
|
|
10
|
+
from convert_stream import CreatePbar, DocumentPdf
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
class ColumnTable(Enum):
|
|
@@ -100,7 +100,7 @@ def create_df_from_filepdf(file: File) -> pd.DataFrame:
|
|
|
100
100
|
items: List[pd.DataFrame] = []
|
|
101
101
|
doc = DocumentPdf()
|
|
102
102
|
doc.add_file_pdf(file)
|
|
103
|
-
for page in doc.
|
|
103
|
+
for page in doc.get_pages():
|
|
104
104
|
text_page: str = page.to_string()
|
|
105
105
|
if (text_page is not None) and (text_page != ""):
|
|
106
106
|
try:
|
|
@@ -206,10 +206,3 @@ class FileToTable(object):
|
|
|
206
206
|
@classmethod
|
|
207
207
|
def create_doc_pdf(cls) -> FileToTable:
|
|
208
208
|
return cls(TableFilesPdf())
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: convert_stream
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.4
|
|
4
4
|
Summary: Manipulação de documentos PDF e Imagens. Converter, Ler, rotacionar exportar etc.
|
|
5
5
|
Author: Bruno Chaves
|
|
6
6
|
Requires-Python: >=3.11
|
|
7
7
|
Description-Content-Type: text/markdown
|
|
8
8
|
Requires-Dist: soup_files
|
|
9
|
-
Requires-Dist:
|
|
10
|
-
Requires-Dist:
|
|
11
|
-
Requires-Dist:
|
|
12
|
-
Requires-Dist:
|
|
13
|
-
Requires-Dist:
|
|
14
|
-
Requires-Dist:
|
|
15
|
-
Requires-Dist:
|
|
16
|
-
Requires-Dist: requests==2.32.3
|
|
9
|
+
Requires-Dist: PyMuPDF
|
|
10
|
+
Requires-Dist: reportlab
|
|
11
|
+
Requires-Dist: openpyxl
|
|
12
|
+
Requires-Dist: pandas
|
|
13
|
+
Requires-Dist: Pillow>=11.3.0
|
|
14
|
+
Requires-Dist: opencv-python
|
|
15
|
+
Requires-Dist: requests>=2.32.4
|
|
17
16
|
|
|
18
17
|
# Configuração instalação:
|
|
19
18
|
pip3 install -r requirements.txt
|
|
@@ -4,24 +4,24 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "convert_stream"
|
|
7
|
-
version = "1.
|
|
7
|
+
version = "1.4"
|
|
8
8
|
authors = [
|
|
9
9
|
{ name="Bruno Chaves"},
|
|
10
10
|
]
|
|
11
|
+
|
|
11
12
|
description = "Manipulação de documentos PDF e Imagens. Converter, Ler, rotacionar exportar etc."
|
|
12
13
|
readme = "README.md"
|
|
13
14
|
requires-python = ">=3.11"
|
|
14
15
|
|
|
15
16
|
dependencies = [
|
|
16
17
|
"soup_files",
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"requests==2.32.3",
|
|
18
|
+
"PyMuPDF",
|
|
19
|
+
"reportlab",
|
|
20
|
+
"openpyxl",
|
|
21
|
+
"pandas",
|
|
22
|
+
"Pillow>=11.3.0",
|
|
23
|
+
"opencv-python",
|
|
24
|
+
"requests>=2.32.4",
|
|
25
25
|
]
|
|
26
26
|
|
|
27
27
|
[tool.setuptools]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|