News:

2023-03-15 Major improvements to the new Geolocation feature

Main Menu

Not a SCALAR reference error on PDF

Started by cm_dheighton, December 08, 2022, 01:10:57 PM

Previous topic - Next topic

cm_dheighton

System: Windows Server, and Windows 10 Pro
Version: 12.52
Command Line:
exiftool.exe -all:all= 2022162220_Monthly_Permit_Log__79_.pdf

Output Error:
Not a SCALAR reference at C:\Users\Daniel\AppData\Local\Temp\par-44616e69656c\cache-exiftool-12.52\inc\lib/Image/ExifTool/WritePDF.pl line 398, <EXIFTOOL_FILE2> line 24.

PDF File:
https://drive.google.com/file/d/1tQ_r6dG_meRcmzOa5WBcKHEreHjyzahN/view?usp=sharing

Would appreciate any insight into this. PDF opens works fine in browser, Adobe, etc. We just want to strip out the metadata.

Phil Harvey

I'm heading out on a 1-week vacation today but I'll look into this when I return.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

StarGeek

Quote from: cm_dheighton on December 08, 2022, 01:10:57 PMWould appreciate any insight into this. PDF opens works fine in browser, Adobe, etc.

This isn't necessarily an indication that there isn't a problem with the PDF, as there is a lot of code out there that writes PDFs badly and readers often work around it.  But my quick tests on your example file do not find any problems, so this may be an exiftool bug.  I'm still looking for a good pdf checker.

QuoteWe just want to strip out the metadata.

You should note that exiftool's edits to PDF files are reversible unless the file is re-linearized after editing.  See the PDF Tags page.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

cm_dheighton

Quote from: StarGeek on December 09, 2022, 11:02:13 AMYou should note that exiftool's edits to PDF files are reversible unless the file is re-linearized after editing.  See the PDF Tags page.
Thanks for the heads up. I'll make sure my developer is aware.

Quote from: Phil Harvey on December 09, 2022, 07:00:48 AMI'm heading out on a 1-week vacation today but I'll look into this when I return.

- Phil
Thanks Phil. Looking forward to hearing from you.


Phil Harvey

The sample PDF has an Info dictionary which is a direct object.  According to the PDF specification, this must be an indirect object, so the software that wrote this PDF is buggy.

I'll patch ExifTool to check for this rather than issuing a runtime error.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

cm_dheighton

Thanks Phil.

I figured as much, we see a lot of bad PDFs overall. Sadly we have no control or leverage to get this fixed at the source.

Do you have any advice on other PDF tools that can repair/fix these kind of problems? (Applies to my other post as well)
We use mutool to correct some of the invalid PDFs we come across, but it didn't resolve either of these.

I'd prefer our processing tool chain not just let PDFs past if they can't correctly finish a step.

Phil Harvey

I don't know much about pdf tools other than using qpdf to linearize pdf files.  You could maybe try that.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).