Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
pdf-miner
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Qin Kaijie
pdf-miner
Commits
7b937d58
Commit
7b937d58
authored
Apr 15, 2024
by
赵小蒙
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix 参数名称
parent
0b01a346
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
6 deletions
+6
-6
pdf_image_tools.py
magic_pdf/libs/pdf_image_tools.py
+2
-2
UNIPipe.py
magic_pdf/pipe/UNIPipe.py
+4
-4
No files found.
magic_pdf/libs/pdf_image_tools.py
View file @
7b937d58
from
magic_pdf.io.AbsReaderWriter
import
AbsReaderWriter
from
magic_pdf.libs.commons
import
fitz
from
loguru
import
logger
from
magic_pdf.libs.commons
import
join_path
...
...
@@ -28,7 +28,7 @@ def cut_image(bbox: tuple, page_num: int, page: fitz.Page, return_path, imageWri
byte_data
=
pix
.
tobytes
(
output
=
'jpeg'
,
jpg_quality
=
95
)
imageWriter
.
write
(
content
=
byte_data
,
path
=
img_hash256_path
,
mode
=
"binary"
)
imageWriter
.
write
(
byte_data
,
img_hash256_path
,
AbsReaderWriter
.
MODE_BIN
)
return
img_hash256_path
...
...
magic_pdf/pipe/UNIPipe.py
View file @
7b937d58
...
...
@@ -105,8 +105,8 @@ if __name__ == '__main__':
pdf_file_path
=
r"linshixuqiu\25536-00.pdf"
model_file_path
=
r"linshixuqiu\25536-00.json"
pdf_bytes
=
drw
.
read
(
p
ath
=
pdf_file_path
,
mode
=
AbsReaderWriter
.
MODE_BIN
)
model_json_txt
=
drw
.
read
(
path
=
model_file_path
,
mode
=
AbsReaderWriter
.
MODE_TXT
)
pdf_bytes
=
drw
.
read
(
p
df_file_path
,
AbsReaderWriter
.
MODE_BIN
)
model_json_txt
=
drw
.
read
(
model_file_path
,
AbsReaderWriter
.
MODE_TXT
)
pdf_type
=
UNIPipe
.
classify
(
pdf_bytes
)
logger
.
info
(
f
"pdf_type is {pdf_type}"
)
...
...
@@ -122,5 +122,5 @@ if __name__ == '__main__':
md_content
=
pipe
.
mk_markdown
(
pdf_mid_data
,
"imgs"
)
md_writer
=
DiskReaderWriter
(
write_path
)
md_writer
.
write
(
content
=
md_content
,
path
=
"25536-00.md"
,
mode
=
AbsReaderWriter
.
MODE_TXT
)
md_writer
.
write
(
content
=
json
.
dumps
(
JsonCompressor
.
decompress_json
(
pdf_mid_data
),
ensure_ascii
=
False
,
indent
=
4
),
path
=
"25536-00.json"
,
mode
=
AbsReaderWriter
.
MODE_TXT
)
md_writer
.
write
(
md_content
,
"25536-00.md"
,
AbsReaderWriter
.
MODE_TXT
)
md_writer
.
write
(
json
.
dumps
(
JsonCompressor
.
decompress_json
(
pdf_mid_data
),
ensure_ascii
=
False
,
indent
=
4
),
"25536-00.json"
,
AbsReaderWriter
.
MODE_TXT
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment