Skip to content
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

The file “out.pdf” could not be opened. #14

Closed
john-catalano opened this issue Jun 6, 2021 · 2 comments
Closed

The file “out.pdf” could not be opened. #14

john-catalano opened this issue Jun 6, 2021 · 2 comments

Comments

@john-catalano
Copy link

john-catalano commented Jun 6, 2021

"It may be damaged or use a file format that Preview doesn’t recognize."

Hi. I'm getting the above error message when I try to open the resulting PDF.

I've installed pdftilecut from homebrew on macOS 11.4. There were no errors during the install.

I have a sample "in.pdf" file on ~/Desktop. It is 1.7MB.
Here is a link to that in.pdf file

From ~/Desktop, I run:
pdftilecut -tile-size A4 -in in.pdf -out out.pdf

This message is produced:
2021/06/06 14:14:58 cannot find MediaBox for page:
/Contents 6 0 R
/Parent 3 0 R
/Resources 8 0 R
/Type /Page

An "out.pdf" file is created that is 660 bytes. When I attempt to open it, I get the titled error.
Here is a link to that out.pdf file

Here is my use case:
I have PDFs that are exported from Safari (both iOS and macOS) that end up being one, long PDF page, rather than split/paginated. Yes, I could simply Print to PDF, but these long PDFs are what results when you choose "Annotate" in Safari on iOS. I find it easier to read/work on PDFs that are in A4 format, but, I digress.

Can you advise on the above?

Thank you,

John

@oxplot
Copy link
Owner

oxplot commented Jun 6, 2021

Your input file in.pdf has errors in it. Running it through ghostscript prints the following error:

$ gs \
  -o repaired.pdf \
  -sDEVICE=pdfwrite \
  -dPDFSETTINGS=/prepress \
   in.pdf
GPL Ghostscript 9.54.0 (2021-03-30)
Copyright (C) 2021 Artifex Software, Inc.  All rights reserved.
This software is supplied under the GNU AGPLv3 and comes with NO WARRANTY:
see the file COPYING for details.
   **** Warning: considering '0000000000 XXXXX n' as a free entry.
   **** Warning: considering '0000000000 XXXXX n' as a free entry.
   **** Warning: considering '0000000000 XXXXX n' as a free entry.
Processing pages 1 through 1.
Page 1

   **** This file had errors that were repaired or ignored.
   **** The file was produced by: 
   **** >>>> iOS Version 14.6 (Build 18F72) Quartz PDFContext <<<<
   **** Please notify the author of the software that produced this
   **** file that it does not conform to Adobe's published PDF
   **** specification.

Nonetheless, having run it throught ghostscript, you get a file you can successfully tile:

repaired.pdf

@oxplot oxplot closed this as completed Jun 6, 2021
@oxplot
Copy link
Owner

oxplot commented Jun 6, 2021

Looks related to #5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants