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
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Carlos Ramos Carreño
erp5
Commits
bccac747
Commit
bccac747
authored
Mar 22, 2023
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pdf_merge: py3
parent
a4fd9fee
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 @
bccac747
...
...
@@ -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
merged pdf in recto/verso mode.
"""
from
six.moves
import
cStringIO
as
String
IO
from
io
import
Bytes
IO
from
PyPDF2
import
PdfFileWriter
,
PdfFileReader
output
=
PdfFileWriter
()
for
pdf_data
in
pdf_data_list
:
if
pdf_data
:
pdf_reader
=
PdfFileReader
(
String
IO
(
pdf_data
))
pdf_reader
=
PdfFileReader
(
Bytes
IO
(
pdf_data
))
page_count
=
pdf_reader
.
getNumPages
()
for
page
in
range
(
page_count
):
output
.
addPage
(
pdf_reader
.
getPage
(
page
))
if
start_on_recto
and
page_count
%
2
:
output
.
addBlankPage
()
outputStream
=
String
IO
()
outputStream
=
Bytes
IO
()
output
.
write
(
outputStream
)
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