Closed ckotte closed 7 years ago
There's a debug tool for workflows in Alfred Preferences:
here's the output:
[2017-05-08 10:33:34][trigger.action] Processing output of 'utility.argument' with arg '(
"/Users/xxx/Documents/test/5.pdf",
"/Users/xxx/Documents/test/6.pdf"
)'
[2017-05-08 10:33:34][utility.argument] Processing output of 'input.keyword' with arg ''
[2017-05-08 10:33:40][input.keyword] Processing output of 'utility.argument' with arg 'test3'
[2017-05-08 10:33:40][utility.argument] Processing output of 'action.script' with arg ''
[2017-05-08 10:33:40][ERROR: action.script] Traceback (most recent call last):
File "/Users/xxx/Library/Application Support/Alfred 3/Alfred.alfredpreferences/workflows/user.workflow.EED19C5F-EA04-4641-BF0F-95F36108230B/merge.py", line 64, in
I doesn't get the error with other pdfs
Please, test this build and tell me what happens:
looks like its the same issue:
Starting debug for 'Alfred PDF Tools'
[2017-05-08 19:25:22][trigger.action] Processing output of 'utility.argument' with arg '(
"/Users/xx/Documents/test/5.pdf",
"/Users/xx/Documents/test/6.pdf"
)'
[2017-05-08 19:25:22][utility.argument] Processing output of 'input.keyword' with arg ''
[2017-05-08 19:25:25][input.keyword] Processing output of 'utility.argument' with arg 'test3'
[2017-05-08 19:25:25][utility.argument] Processing output of 'action.script' with arg ''
[2017-05-08 19:25:25][ERROR: action.script] Traceback (most recent call last):
File "/Users/xxx/Library/Application Support/Alfred 3/Alfred.alfredpreferences/workflows/user.workflow.8F206B4F-4FC3-450E-A6DB-41275900C545/merge.py", line 64, in
It might be difficult to debug the issue without the offending PDF file. Would it be possible to share the file in case it doesn't have any sensitive information?
unfortunately, it's an invoice..
Looks like the pdf is corrupt. I couldn't find much about "Could not find xref table at specified location" except that a guy has the same issue with a corrupted pdf.
I get the same if I execute:
from PyPDF2 import PdfFileReader, PdfFileWriter test_reader = PdfFileReader(file("6.pdf", "rb")) Traceback (most recent call last): File "
", line 1, in File "/usr/local/lib/python2.7/site-packages/PyPDF2/pdf.py", line 1084, in init self.read(stream) File "/usr/local/lib/python2.7/site-packages/PyPDF2/pdf.py", line 1901, in read raise utils.PdfReadError("Could not find xref table at specified location") PyPDF2.utils.PdfReadError: Could not find xref table at specified location test_reader = PdfFileReader(file("eee.pdf", "rb"))
Is it possible to implement a popup in Alfred that shows me the file that couldn't be merged or just merge all files before the one that doesn't work?? I had several pdfs and I needed to find the non-working file by merging only two files at the same time..
Unfortunately I would need the offending file to reproduce the issue and implement such feature.
How can I send you the file? I don't want to post it here.
I also found a solution: You can repair a corrupted file with Ghostscript: gs -o repaired.pdf -sDEVICE=pdfwrite -dPDFSETTINGS=/prepress corrupted.pdf GPL Ghostscript 9.21 (2017-03-16) Copyright (C) 2017 Artifex Software, Inc. All rights reserved. This software comes with NO WARRANTY: see the file PUBLIC for details. **** Warning: File has some garbage before %PDF- . Processing pages 1 through 1. Page 1
It would be nice if you could implement this in the workflow and post an OSX Notification if a file was corrupted or if it can't be processed at all.
You can send me a share link by private message in Alfred Forum where I have the same username.
Regarding the suggested repair solution, I don't plan to implement it, since to bundle the workflow with Ghostscript would double its size in order to address an individual and rare issue.
Please, if you don't want to send the file anymore let me know and I will close the issue.
Looks like there's something wrong with one of the pdfs!? How can I enable debugging of the workflow or the Python scripts??