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
138
Merge Requests
138
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
Jobs
Commits
Open sidebar
nexedi
erp5
Commits
48de4a7e
Commit
48de4a7e
authored
Mar 22, 2023
by
Jérome Perrin
Committed by
Arnaud Fontaine
Jul 06, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pdf_merge: py3
parent
bba606b3
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 @
48de4a7e
...
...
@@ -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