Comments (6)
@sunqianxiang i wrote some code based on the fancy_watermark.py, no issue with flipping.
from pdfrw.
Either your watermark or your PDF pages are probably rotated. (Probably the PDF page, I think rotation for the watermark is handled.) If you have examples (especially if you have examples I can add to the test suite) please email them to me and I will fix.
Thanks,
Pat
from pdfrw.
but I maybe need normal merger..Such as for example with PyPDF2..
from PyPDF2 import PdfFileWriter, PdfFileReader
output = PdfFileWriter()
ipdf = PdfFileReader(open('output.pdf', 'rb'))
wpdf = PdfFileReader(open('transafe.pdf', 'rb'))
watermark = wpdf.getPage(0)
for i in xrange(ipdf.getNumPages()):
try:
page = ipdf.getPage(i)
page.mergePage(watermark)
output.addPage(page)
except:
pass
with open('newfile.pdf', 'wb') as f:
output.write(f)
here generate not flipping pdf from code..but it have problem in pdf 1.4.
i think watemark need custom options or providing method to adjustment.
in pdf1.4 maybe have the problam.i can send mail to you for my pdf file..
Thanks in advance
from pdfrw.
Thank you for this bug report. I have checked in some code on a new branch that fixes this problem.
When I did a rewrite of my merge code, I forgot to save graphics state if the object was a regular page and not a form XObject. Most PDFs work fine this way, but your example PDF alters the graphics state and leaves it altered (which is perfectly legal, but which I did not have a failing PDF for).
I have not yet checked the fix into the master because I will first need to update expected checksums for the output of the watermark test. There is one changed file, here:
https://github.com/pmaupin/pdfrw/blob/pagemerge_state_save_restore/pdfrw/pagemerge.py
Please verify it works on all your files.
Also, if you can create a non-sensitive file that the old one fails on and the new one works on I will add it to the test suite.
@ThomasWaldmann -- you may also want this fix, depending on how much control you have over the PDFs you are watermarking -- it is a definite bug in pdfrw, but the PDFs you provided so far did not provoke it.
Thanks,
Pat
from pdfrw.
yup, works fine, had the same issue
from pdfrw.
The branch to fix this is now merged, so I'm closing this issue.
from pdfrw.
Related Issues (20)
- PDF Form - Break Line
- Can't use preexisting streams like pyPdf while initializing PdfReader
- means to determine that a file is encrypted
- Incorrect reportlab link in README
- Preserve table of contents when editing PDF HOT 1
- NameError: name 'name' is not defined
- please use logging.NullHandler
- [Discussion] PyPDF2 ❤️ pdfrw HOT 2
- Hi! I was wondering if pdfrw is capable of making a new PDF based off of the PDF form
- How to change the font? HOT 1
- How to create a new PDF, add new pages with some text? HOT 1
- PdfReader only reads 11 pages of a certain file but there is no error
- PageMerge with canvas :: Links are not working
- invisible text layer HOT 1
- pdfrwx: a pre-preliminary announcement
- reader.Info is None. How to set attribute in this case? HOT 1
- Expected dict type of /XRef HOT 1
- Form push button widget creation does not work HOT 2
- Get Layered PDF using pdfrw HOT 1
- Fill PDF from Excel sheet HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pdfrw.