mirror of
https://github.com/bringout/oca-ocb-core.git
synced 2026-04-18 05:32:03 +02:00
fix PyPDF2 3.x page copying issue - prevent 327-byte empty PDFs
Added explicit page copying after cloneReaderDocumentRoot() calls because
PyPDF2 3.x only copies document structure, not content pages.
🤖 assisted by claude
This commit is contained in:
parent
c3d53c6a4d
commit
3f19943cec
3 changed files with 510 additions and 11 deletions
|
|
@ -43,6 +43,18 @@ This patch provides backward compatibility by creating wrapper classes that:
|
|||
|
||||
## Implementation Details
|
||||
|
||||
### Critical PyPDF2 3.x Fix - Page Content Copying
|
||||
|
||||
In PyPDF2 3.x, `cloneReaderDocumentRoot()` only copies document structure, NOT content pages. This was causing 327-byte PDFs with no actual content. Modules using this method now include explicit page copying:
|
||||
|
||||
```python
|
||||
writer.cloneReaderDocumentRoot(reader)
|
||||
# Copy all pages from the reader to the writer (required for PyPDF2 3.x)
|
||||
for page_num in range(reader.getNumPages()):
|
||||
page = reader.getPage(page_num)
|
||||
writer.addPage(page)
|
||||
```
|
||||
|
||||
### Compatibility Import Pattern
|
||||
```python
|
||||
try:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue