Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
7
Merge Requests
7
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Jérome Perrin
erp5
Commits
b9834b7e
Commit
b9834b7e
authored
Mar 22, 2023
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pdf_merge: py3
parent
4a7942f0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
bt5/erp5_pdf_merge/ExtensionTemplateItem/portal_components/extension.erp5.ERP5PDFMerge.py
...lateItem/portal_components/extension.erp5.ERP5PDFMerge.py
+3
-3
No files found.
bt5/erp5_pdf_merge/ExtensionTemplateItem/portal_components/extension.erp5.ERP5PDFMerge.py
View file @
b9834b7e
...
@@ -35,20 +35,20 @@ def mergePDFList(self, pdf_data_list, start_on_recto=False):
...
@@ -35,20 +35,20 @@ def mergePDFList(self, pdf_data_list, start_on_recto=False):
to have each PDF as the recto page. This is useful if you have to print the
to have each PDF as the recto page. This is useful if you have to print the
merged pdf in recto/verso mode.
merged pdf in recto/verso mode.
"""
"""
from
six.moves
import
cStringIO
as
String
IO
from
io
import
Bytes
IO
from
PyPDF2
import
PdfFileWriter
,
PdfFileReader
from
PyPDF2
import
PdfFileWriter
,
PdfFileReader
output
=
PdfFileWriter
()
output
=
PdfFileWriter
()
for
pdf_data
in
pdf_data_list
:
for
pdf_data
in
pdf_data_list
:
if
pdf_data
:
if
pdf_data
:
pdf_reader
=
PdfFileReader
(
String
IO
(
pdf_data
))
pdf_reader
=
PdfFileReader
(
Bytes
IO
(
pdf_data
))
page_count
=
pdf_reader
.
getNumPages
()
page_count
=
pdf_reader
.
getNumPages
()
for
page
in
range
(
page_count
):
for
page
in
range
(
page_count
):
output
.
addPage
(
pdf_reader
.
getPage
(
page
))
output
.
addPage
(
pdf_reader
.
getPage
(
page
))
if
start_on_recto
and
page_count
%
2
:
if
start_on_recto
and
page_count
%
2
:
output
.
addBlankPage
()
output
.
addBlankPage
()
outputStream
=
String
IO
()
outputStream
=
Bytes
IO
()
output
.
write
(
outputStream
)
output
.
write
(
outputStream
)
return
outputStream
.
getvalue
()
return
outputStream
.
getvalue
()
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