I want to insert a new page character or something to prevent the second file from over writing the second file in the PDF. What can I do to concatenate 2 PDFs in openerp?
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Kế toán
- Tồn kho
- PoS
- Project
- MRP
Câu hỏi này đã bị gắn cờ
Hi Ny Emotion,
If you are looking to concatenate / merge two (or more) PDF files, you can simply check the link below (I tested the solution and it works perfectly ; both with Pypdf and PyPDF2) :
https://stackoverflow.com/questions/3444645/merge-pdf-files
If you are looking to concatenate two (or more) PDF Structure (https://en.wikipedia.org/wiki/PDF , see chapter "Technical Overview"), it's a little bit more tricky but I manage to do that a few days ago.
Below is the code snippet I created to do so (I hope this will be useful to you) :
# Useful librairies
import StringIO
import cStringIO
from openerp.report.pyPdf import PdfFileWriter, PdfFileReader
# "results" is a list containing the PDF structures to merge
output = PdfFileWriter()
for result in results:
reader = PdfFileReader(cStringIO.StringIO(result))
for page in range(reader.getNumPages()):
output.addPage(reader.getPage(page))
s = cStringIO.StringIO()
output.write(s)
return s.getvalue()
Hi emotion did you do this?
how did you do this
Hello Ny Emotion
Please check, i think it's helpful https://mygisblog.wordpress.com/2011/08/26/merging-pdf-files-with-python/
Bạn có hứng thú với cuộc thảo luận không? Đừng chỉ đọc, hãy tham gia nhé!
Tạo tài khoản ngay hôm nay để tận hưởng các tính năng độc đáo và tham gia cộng đồng tuyệt vời của chúng tôi!
Đăng kýBài viết liên quan | Trả lời | Lượt xem | Hoạt động | |
---|---|---|---|---|
|
3
thg 2 25
|
3723 | ||
|
0
thg 5 24
|
46 | ||
|
1
thg 4 24
|
3454 | ||
|
4
thg 9 23
|
4974 | ||
|
2
thg 9 23
|
7159 |