convert-stream 1.3.1__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.

Files changed (27) hide show
  1. {convert_stream-1.3.1 → convert_stream-1.4}/PKG-INFO +1 -2
  2. {convert_stream-1.3.1 → convert_stream-1.4}/convert_stream/__main__.py +5 -1
  3. {convert_stream-1.3.1 → convert_stream-1.4}/convert_stream/_version.py +2 -2
  4. {convert_stream-1.3.1 → convert_stream-1.4}/convert_stream/models/models_pdf.py +8 -2
  5. {convert_stream-1.3.1 → convert_stream-1.4}/convert_stream/pdf_page.py +11 -13
  6. {convert_stream-1.3.1 → convert_stream-1.4}/convert_stream/table_files.py +4 -11
  7. {convert_stream-1.3.1 → convert_stream-1.4}/convert_stream.egg-info/PKG-INFO +1 -2
  8. {convert_stream-1.3.1 → convert_stream-1.4}/convert_stream.egg-info/requires.txt +0 -1
  9. {convert_stream-1.3.1 → convert_stream-1.4}/pyproject.toml +1 -2
  10. {convert_stream-1.3.1 → convert_stream-1.4}/README.md +0 -0
  11. {convert_stream-1.3.1 → convert_stream-1.4}/convert_stream/__init__.py +0 -0
  12. {convert_stream-1.3.1 → convert_stream-1.4}/convert_stream/convert.py +0 -0
  13. {convert_stream-1.3.1 → convert_stream-1.4}/convert_stream/image_to_pdf.py +0 -0
  14. {convert_stream-1.3.1 → convert_stream-1.4}/convert_stream/imagelib.py +0 -0
  15. {convert_stream-1.3.1 → convert_stream-1.4}/convert_stream/models/__init__.py +0 -0
  16. {convert_stream-1.3.1 → convert_stream-1.4}/convert_stream/models/m_text.py +0 -0
  17. {convert_stream-1.3.1 → convert_stream-1.4}/convert_stream/models/models_image.py +0 -0
  18. {convert_stream-1.3.1 → convert_stream-1.4}/convert_stream/pdf_compress.py +0 -0
  19. {convert_stream-1.3.1 → convert_stream-1.4}/convert_stream/pdf_document.py +0 -0
  20. {convert_stream-1.3.1 → convert_stream-1.4}/convert_stream/pdf_to_images.py +0 -0
  21. {convert_stream-1.3.1 → convert_stream-1.4}/convert_stream/progress/__init__.py +0 -0
  22. {convert_stream-1.3.1 → convert_stream-1.4}/convert_stream/progress/progress_bar.py +0 -0
  23. {convert_stream-1.3.1 → convert_stream-1.4}/convert_stream/text.py +0 -0
  24. {convert_stream-1.3.1 → convert_stream-1.4}/convert_stream.egg-info/SOURCES.txt +0 -0
  25. {convert_stream-1.3.1 → convert_stream-1.4}/convert_stream.egg-info/dependency_links.txt +0 -0
  26. {convert_stream-1.3.1 → convert_stream-1.4}/convert_stream.egg-info/top_level.txt +0 -0
  27. {convert_stream-1.3.1 → convert_stream-1.4}/setup.cfg +0 -0
@@ -1,12 +1,11 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: convert_stream
3
- Version: 1.3.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: PyPDF2
10
9
  Requires-Dist: PyMuPDF
11
10
  Requires-Dist: reportlab
12
11
  Requires-Dist: openpyxl
@@ -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()
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env python3
2
2
  # -*- coding: utf-8 -*-
3
- __version__ = '1.3'
3
+ __version__ = '1.4'
4
4
  __author__ = 'Bruno Chaves'
5
5
  __license__ = 'MIT'
6
6
  __module_name__ = 'convert_stream'
7
- __modify_date__ = '2025-07-06'
7
+ __modify_date__ = '2025-07-11'
@@ -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
- from PyPDF2 import PageObject
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
- pass
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
- pass
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 e:
189
- print(e)
186
+ except Exception as _exce:
187
+ print(_exce)
190
188
  return None
191
189
  else:
192
190
  return cls(current_page, current_page.number)
@@ -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, Dict
8
- from soup_files import File, Directory, InputFiles, LibraryDocs, ProgressBarAdapter
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, PageDocumentPdf
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.pages:
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,12 +1,11 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: convert_stream
3
- Version: 1.3.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: PyPDF2
10
9
  Requires-Dist: PyMuPDF
11
10
  Requires-Dist: reportlab
12
11
  Requires-Dist: openpyxl
@@ -1,5 +1,4 @@
1
1
  soup_files
2
- PyPDF2
3
2
  PyMuPDF
4
3
  reportlab
5
4
  openpyxl
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "convert_stream"
7
- version = "1.3.1"
7
+ version = "1.4"
8
8
  authors = [
9
9
  { name="Bruno Chaves"},
10
10
  ]
@@ -15,7 +15,6 @@ requires-python = ">=3.11"
15
15
 
16
16
  dependencies = [
17
17
  "soup_files",
18
- "PyPDF2",
19
18
  "PyMuPDF",
20
19
  "reportlab",
21
20
  "openpyxl",
File without changes
File without changes