-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bad /Contents 1 error while processing a file #95
Comments
Can you give the output of |
Sure
|
Ok, I ran:
and I get no errors. Can you show me a failing command? |
It's a kind of magic... I've tried once again and couldn't detect any issues too. Indeed when I first encountered the issue, I tried to update cpdf and see whether the issue persisted. It persisted. But maybe I was still using an old version of cpdf somehow? For example, I didn't reload PowerShell and it used some cached version of binary... I dunno. |
Hm.... I've met this error again. Here's the command:
Here's the problematic file: @johnwhitington are you able to reproduce error on your machine? |
The file is malformed: it has some page contents entries pointing to stuff which is not page content. I have altered CamlPDF (Cpdf's base library) to ignore the problem and it now completes: $ cpdf -add-text "%Page of %EndPage" -bottom 15pt -font "Times-Roman" -font-size 14 учителю.pdf -o out.pdf As a bonus, the file will now be repaired - at least in that respect. Your file crashes Adobe Reader, but after processing with this new version of Cpdf it does not crash - it shows a couple of error popups though, complaining of malformed content - so presumably there are other problems. As a check, I asked Ghostscript to convert it to PostScript and got: $ pdf2ps учителю.pdf So there is definitely some malformity. You can build a new version from source (use master CamlPDF with master Cpdf). If you're a commercial customer I can make a build for you - contact me using the support email address. |
Thank you for finding solution quickly! However, I'm afraid it's just a temporary solution with some deeper problem hiding underneath. This file itself was created with cpdf, so it seems that there is some problem with file generation. I used these files to create the malformed one with the following command:
I've used the same page-numbering script on every source file and it has run successively. |
Was that merged file created by cpdf 2.7.2 or an earlier version? This smells like a problem to do with rewriting of structure trees on merging which was corrected a few weeks ago - a fix included in 2.7.2. |
I ran cpdf -idir files -o merged.pdf Then cpdf -add-text "%Page of %EndPage" -bottom 15pt -font "Times-Roman" -font-size 14 merged.pdf -o numbered.pdf And I get the attached file. This is with cpdf 2.8 (which is out soon). Please re-check you are using v2.7.2. If that fails, I will send you a build of v2.8. |
I don't mean v2.7.2, I mean v2.7.2(fix 1) i.e downloaded from this repository "master". |
Hello! I have a bunch1.zip of files which I'm processing with cpdf. Two of them were previously processed by cpdf. I'm trying to merge them and than page-number the merged file with command inside PowerShell script:
And it fails with error:
Bad /Contents 1
However if I run cpdf on a bunch2.zip, that consists of initital source files not processed by cpdf, it pagenumbers the merged PDF without problems.
It seems like somehow cpdf corrupts files while merging and makes it inapropriate for -add-text command.
If I try to pagenumber single preprocessed by cpdf file from bunch1.zip (actually both of them, they are marked as -merged in filenames) cpdf also runs smoothly.
bunch1.zip
bunch2.zip
The text was updated successfully, but these errors were encountered: