PDF Chain error 256 when attempting to concatenate PDF files

Bug #1048045 reported by Jake Hansen
56
This bug affects 9 people
Affects Status Importance Assigned to Milestone
PDF Chain
Fix Released
Undecided
Unassigned
pdfchain (Ubuntu)
Fix Released
Medium
Johann Felix Soden

Bug Description

1) lsb_release -rd
Description: Ubuntu 12.10
Release: 12.10

2) apt-cache policy pdfchain
pdfchain:
  Installed: 1:0.3.3-1
  Candidate: 1:0.3.3-1
  Version table:
 *** 1:0.3.3-1 0
        500 http://archive.ubuntu.com/ubuntu/ quantal/universe i386 Packages
        100 /var/lib/dpkg/status

3) What is expected to happen via the attached click Add some files to concatenate -> highlight page1.pdf and page 2.pdf -> click button Add -> highlight page2.pdf -> click Move selected files up -> button Save As -> final -> button save and it print successfully.

4) What happens instead is a window pops up noting:
PDFTK returned error!
Input/Output Error
Error code: 256

Running from a terminal:
pdfchain

PDFTK command:
Error: Given handle has no associated file:
   B, used here: B1-endN
   Exiting.
Errors encountered. No output created.
Done. Input errors, so no output created.
pdftk A="/home/moniker/Desktop/page1.pdf" cat B1-endN A1-endN output "/home/moniker/Desktop/final.pdf" allow AllFeatures
Input/Output Error - PDFTK returned: 256

Original Reporter Comments: I was able to successfully concatenate the same files using pdftk via the command line, so I don't think the problem is with pdftk.

ProblemType: Bug
DistroRelease: Ubuntu 12.04
Package: pdfchain 1:0.3.3-1
ProcVersionSignature: Ubuntu 3.2.0-29.46-generic-pae 3.2.24
Uname: Linux 3.2.0-29-generic-pae i686
ApportVersion: 2.0.1-0ubuntu12
Architecture: i386
Date: Sat Sep 8 17:35:02 2012
ExecutablePath: /usr/bin/pdfchain
InstallationMedia: Ubuntu 12.04 LTS "Precise Pangolin" - Release i386 (20120423)
ProcEnviron:
 PATH=(custom, no user)
 LANG=en_US.UTF-8
 SHELL=/bin/bash
SourcePackage: pdfchain
UpgradeStatus: No upgrade log present (probably fresh install)

Revision history for this message
Jake Hansen (citizenunderdog) wrote :
Revision history for this message
Johann Felix Soden (johfel) wrote :

Thank you for report.

To track down the error, could you start pdfchain from a console window (terminal), please?
When you then concatenate pdf files, the used pdftk command
should be displayed in the terminal.

Do you get an error message when you run this command by hand?
Or does pdfchain display any error messages in the console?

Are spaces or other special characters in the path or
filename of the input (or output) pdf files?

Another reason for the bug could be a wrongly set PATH environment variable.
So run "echo $PATH" in a terminal and send me the result. Of course, you can replace
any private information by random letters.

In certain circumstances, it could be helpful if you provide scanned pdf files which shows this strange result,
but as it looks at the moment, the problem is outside pdftk.

Revision history for this message
Jake Hansen (citizenunderdog) wrote :

Here is the command used (from Terminal output):

PDFTK command:
Error: Given handle has no associated file:
   B, used here: B1-endN
   Exiting.
Errors encountered. No output created.
Done. Input errors, so no output created.
pdftk A="/home/jake/Desktop/checks_2012-09-09.pdf" cat B1-endN A1-endN output "/home/jake/Desktop/CHAG_Offering_2012-09-09.pdf" allow AllFeatures
Input/Output Error - PDFTK returned: 256

Revision history for this message
Jake Hansen (citizenunderdog) wrote :

I selected two files:
/home/jake/Desktop/checks_2012-09-09.pdf
and
/home/jake/Desktop/Offering_count_sheet_2012-09-09.pdf

but it looks like it only recognized the file /home/jake/Desktop/checks_2012-09-09.pdf

I don't see the second file referenced in the pdftk command output.

Revision history for this message
Lutz Andersohn (landersohn-m) wrote :

I just encountered the same problem. Trying to concatenate two PDF files: one file generated with LibreOffice, the other scanned.
If I use the LibreOffice PDF file as first file followed by the scanned file, PDF Chain works. The other way around (scanned PDF first, followed by the LibreOffice PDF file), PDFChain/pdftk fails. Both files are located in the same directory, so I doubt it's a $PATH problem

Console Output in the first case:
PDFTK command:
pdftk A="/home/andersl/Desktop/Link_AutoRefractor_ProjBook/RootCause_Reports/RootCause_Report_CameraFreeze_bug_181_207.pdf" B="/home/andersl/Desktop/Link_AutoRefractor_ProjBook/RootCause_Reports/RootCause_Report_CameraFreeze_bug_181_207.sig.pdf" cat A1-endN B1-endN output "/home/andersl/Desktop/Link_AutoRefractor_ProjBook/RootCause_Reports/gaga.pdf" allow AllFeatures
PDFTK returned: 0

Console output in the second case:
PDFTK command:
Error: Given handle has no associated file:
   B, used here: B1-endN
   Exiting.
Errors encountered. No output created.
Done. Input errors, so no output created.
pdftk A="/home/andersl/Desktop/Link_AutoRefractor_ProjBook/RootCause_Reports/RootCause_Report_CameraFreeze_bug_181_207.pdf" cat B1-endN A1-endN output "/home/andersl/Desktop/Link_AutoRefractor_ProjBook/RootCause_Reports/gaga4.pdf" allow AllFeatures
Input/Output Error - PDFTK returned: 256

Revision history for this message
Lutz Andersohn (landersohn-m) wrote :

I should mention, using pdftk from the command line works either way, regardless of the order of the PDF file. problem seems to be in the PDFChain GUI, not in pdftk

Revision history for this message
Johann Felix Soden (johfel) wrote :

It seems that the problem occurs only with specific pdf files (scanned documents). Can someone attach such a file to this bug report, please? pdfchain tries to count the pages inside the pdf document. I assume that something there gets wrong.

Does the bug with pdfchain still occur if the pdf document is processed with pdftk first (pdftk scanned.pdf output scanned_fix.pdf )?

Revision history for this message
Martin Singer (mpower3) wrote : Re: [Bug 1048045] Re: PDF Chain errors when attempting to concatenate PDF files

Hi,

The error code is actually returned by pdftk. If you start pdfchain from
a terminal, the created pdftk command appears there. The error message
of pdftk is also displayed there.
Pdfchain in version 0.3.3 only supports the transfer of the file paths
to pdftk using index characters (A to Z). The simpler variant - a simple
list of filenames in a row (without options) is supported with version
0.3.4 ("Cat Simple").
It is possible that the fault is related with the extended delivery of
the file name. With direct input of pdftk command probably the simple
version was used (without index characters).
I think more likely a unhandled special character in the file path. An
error with UTF8 characters in the file path is also conceivable. With
direct input of pdftk command probably not a complete file path for each
document was submitted. Probably it was changed to that directory
containing the documents at first.
The error returned from pdftk "Input Output Error" indicates that a file
can not be found or read, or the output file can not be created.
The fact supplied command (including all special characters) would be
helpful.

Thaks for sending the bugreport.

Best regards,
Martin

Am Freitag, den 14.09.2012, 08:24 +0000 schrieb Johann Felix Soden:
> It seems that the problem occurs only with specific pdf files (scanned
> documents). Can someone attach such a file to this bug report, please?
> pdfchain tries to count the pages inside the pdf document. I assume that
> something there gets wrong.
>
> Does the bug with pdfchain still occur if the pdf document is processed
> with pdftk first (pdftk scanned.pdf output scanned_fix.pdf )?
>

Revision history for this message
Martin Singer (martin-singer) wrote : Re: PDF Chain errors when attempting to concatenate PDF files

pdftk A="/home/jake/Desktop/checks_2012-09-09.pdf" cat B1-endN A1-endN output "/home/jake/Desktop/CHAG_Offering_2012-09-09.pdf" allow AllFeatures
Input/Output Error - PDFTK returned: 256

That's definitely a fault of pdfchain. I will reproduce the error and sign up as soon as I have solved it.

Thanks and greetings.

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in pdfchain (Ubuntu):
status: New → Confirmed
Revision history for this message
Martin Singer (martin-singer) wrote :

Hi,
now i solved the problem and released a new version (0.3.5). I hope it works fine now.

https://sourceforge.net/projects/pdfchain/files/pdfchain-0.3.5/

Thanks for the report and best regards.

Changed in pdfchain (Ubuntu):
status: Confirmed → Fix Released
Revision history for this message
James Doyle (jujudu3) wrote :

For those still on 0.3.3 this work around is successful for me every time.

1. Add one additional file to the pdf to be concatenated (can be a duplicate of one you actually are using)
2. Move the extra file to the end of the list
3. Deselect it using the box on the left
4. Now save and hopefully success.

Good luck.

Changed in pdfchain:
status: New → Fix Released
Changed in pdfchain (Ubuntu):
assignee: nobody → Johann Felix Soden (johfel)
Revision history for this message
Johann Felix Soden (johfel) wrote :

As this bug still affects all current official Ubuntu pdfchain packages, this bug was wrongly marked "Fix Released",
which hides the bug from users. Due to (in my eyes) wrong restrictions in Launchpad, I cannot change/undo this.
I would be glad, if Jake Hansen as bug reporter or someone else can fix this.
I added the upstream project to this bug, where the bug is really "Fix Released".

Since Debian testing is in freeze at the moment, I cannot really upload the new pdfchain upstream version via the standard way. However, I will try a different way to provide the current pdfchain upstream version officially to Ubuntu users.

But firstly, I want to solve this bug in the pdfchain 0.3.3 version. In newer upstream version, the corresponding code was re-written, which makes a direct backport difficult.
However, I found that enabling an extra re-indexing of all handles, solves at least a bug with the same error as this bug that occur when the ordering of two pdf files were changed after adding them.
As nobody yet provided me a "scanned PDF file" which triggers the error, I am currently not able to test if the fix works also for this.

I published a minimally modified pdfchain 0.3.3 version that contains the described fix, in my personal PPA ( https://launchpad.net/~johfel/+archive/pdfchain ) and need people who test it. Thank you very much in advance.

Revision history for this message
James Doyle (jujudu3) wrote :

Mimimally modified 0.3.3 worked for me on a pdf that previously caused the error.

Revision history for this message
Martin Singer (martin-singer) wrote :

Hi Felix,

sorry for changing the status wrongly to "Fix Released". I thought this would show you a fix is released in general. I released a fix with version 0.3.5 . I should have guessed that you need a fix for version 0.3.3.

Your fix for version 0.3.3 does the same as my at version 0.3.5 .
It is necessary to re-index the liststore entries before creating the pdftk-command. Because the create-pdftk-command function needs the handles in a sorted way (from A to Z). After adding files the handles are sorted. By moving the files at the list they become unsorted.

Thanks and greetings,
Martin

Revision history for this message
penalvch (penalvch) wrote :

Marking back to New as it was mistakenly marked Fix Released as per https://bugs.launchpad.net/ubuntu/+source/pdfchain/+bug/1048045/comments/13 .

Changed in pdfchain (Ubuntu):
status: Fix Released → New
Revision history for this message
penalvch (penalvch) wrote :
description: updated
tags: added: quantal
Changed in pdfchain (Ubuntu):
importance: Undecided → Medium
status: New → Triaged
Revision history for this message
penalvch (penalvch) wrote :
penalvch (penalvch)
summary: - PDF Chain errors when attempting to concatenate PDF files
+ PDF Chain error 256 when attempting to concatenate PDF files
Revision history for this message
Johann Felix Soden (johfel) wrote :

The bug should be fixed now in pdfchain 1:0.3.3-2 (in Ubuntu Raring). The fix is very small and the same as in my ppa which was successfully tested here ( see e.g. https://bugs.launchpad.net/ubuntu/+source/pdfchain/+bug/1048045/comments/14 )

Therefore, feel free to fill SRU / backport requests.

As soon as Debian wheezy is out, I will release the current upstream version (0.3.5) as new package.

Revision history for this message
penalvch (penalvch) wrote :

Jake Hansen, thank you for taking the time to report this bug and helping to make Ubuntu better. However, I am closing it because the bug has been fixed in the latest development version of Ubuntu - Raring Ringtail.

This is a significant bug in Ubuntu. If you need a fix for the bug in previous versions of Ubuntu, please do steps 1 and 2 of the SRU Procedure [1] to bring the need to a developer's attention.

[1]: https://wiki.ubuntu.com/StableReleaseUpdates#Procedure

Confirmed Fix Released for Raring.

Changed in pdfchain (Ubuntu):
status: Triaged → Fix Released
Revision history for this message
Martin Singer (mpower3) wrote : Re: [Bug 1048045] Re: PDF Chain error 256 when attempting to concatenate PDF files

Hi Jazz,

it seems you are using PDF Chain 0.4.0 (or newer) with PDFtk 1.44. PDF
Chain 0.4.0 is only compatible with PDFtk 1.45, because PDFtk 1.45 has a
new command syntax.

You can install the new PDFtk 1.45 from source. On Ubuntu 12.10 LTS it
is easy and works well. Instructions for this are on
http://pdfchain.sourceforge.net/installation.html in Chapter "Compiling
the PDFtk from source".

On the other side you can downgrade to PDF Chain 0.3.5 (which is
compatible with PDFtk 1.44).

Greetings,
Martin

Am Dienstag, den 07.05.2013, 17:23 +0000 schrieb jazz:
> Hi,
> I have problems concacenate pdfs with error 256.
>
> Console output says following:
>
> pdftk A="/home/jazz/DOa.pdf" B="/home/jazz/DOb.pdf" cat A1-endnorth B1-endnorth output "/home/jazz/MPT0017.pdf" allow AllFeatures
> Input/Output Error - PDFTK returned: 256
>
> PDFTK command:
> Error: Unexpected text in page range end, here:
> north
> Exiting.
> Acceptable keywords, here, are: "even" or "odd".
> Errors encountered. No output created.
> Done. Input errors, so no output created.
>

Revision history for this message
LanceHaverkamp (lance-thehaverkamps) wrote :

This says fix released, but I'm seeing the exact same behavior, a year later, in 13.10.

Revision history for this message
LanceHaverkamp (lance-thehaverkamps) wrote :

Disregard...I was actually seeing this error due to defective input pdf's caused by https://bugs.launchpad.net/ubuntu/+source/evince/+bug/784228

Sorry & thanks.

Revision history for this message
Rocdufer (lepcis) wrote :

Just for the record. The «PDF Chain» message for an «input.pdf»

PDFTK returned error!
Input/Output Error
Error code: 256

may be removed by decrypting «input.pdf» with the command

qpdf --decrypt input.pdf output.pdf

as Manoj did for another, related problem

https://stackoverflow.com/questions/30259554/pdftk-error-failed-to-open-pdf-file.

Nothing in the PDF file's cover says "encrypted", it says "optimized". So compression was

applied and it needs to be decompressed for PDFTK to open it.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.