Skip to content

PDF-Hul produces Invalid Page Dictionary for PDF's with VP dictionaries #662

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

Open
thorsted opened this issue Mar 1, 2021 · 7 comments · Fixed by #665
Open

PDF-Hul produces Invalid Page Dictionary for PDF's with VP dictionaries #662

thorsted opened this issue Mar 1, 2021 · 7 comments · Fixed by #665
Assignees
Labels
bug A product defect that needs fixing P2 Medium priority issues to be scheduled in a future release

Comments

@thorsted
Copy link

thorsted commented Mar 1, 2021

Any PDF which uses a ViewPort dictionary including the newer Geo Supplement throws the PDF-HUL-117 error.

May be related to the parsing of the Measurement key.

AutoCAD-Viewport-Sample1.pdf

@carlwilson carlwilson added bug A product defect that needs fixing P2 Medium priority issues to be scheduled in a future release labels Mar 4, 2021
@bdoubrov
Copy link

bdoubrov commented Mar 11, 2021

Indeed, current way of parsing measurement format arrays is incorrect and will be fixed. The only remaining question is how to present this measurement data in the report. For example, there might be multiple measurement units in X (or Y) direction. In PDF they would be defined as (see Table 262 in PDF 1.7 spec):

<<
... 
/X  [ << /U (inch) /C 0.0254 >> << /U (mile) /C 1609.34>> ]
...
>> 

We can put them in the report as is:

-- X
---- U inch
---- C 0.0254
---- U mile
---- C 1609.34

or make the key names more user friendly. Like:

-- X
---- Name "inch"
---- Coefficient 0.0254
---- Name "mile"
---- Coefficient 1609.34

@thorsted
Copy link
Author

thorsted commented Mar 11, 2021

I have found in most of my samples the units and ratio are often not populated, Do they need to be?

/Measure <<
          /A [ <<
                /C 1
                /U ( )
              >> ]
          /D [ <<
                /C 1
                /U ( )
              >> ]
          /R ( )
          /Subtype /RL
          /Type /Measure
          /X [ <<
                /C .00231
                /U ( )
              >> ]
        >>

@bdoubrov
Copy link

bdoubrov commented Mar 11, 2021

Both /U and /C entries are required (see Table 263, PDF 1.7 spec). /U entry is defined as:

U - (Required) A text string specifying a label for displaying the units represented by this dictionary in a user interface; the label should use a universally recognized abbreviation.

The example from PDF 1.7 specification suggests the following use:

<</Type /Measure
/Subtype /RL
/R (1in = 0.1 mi)
/X [ <</U (mi) % x offset represented in miles
/C .00139 % Conversion from user space units to miles
/D 100000
]
/D[<< /U (mi) /C 1 >>% Distance: initial unit is miles; no conversion needed
<< /U (ft) /C 5280 >>% Conversion from miles to feet
<< /U (in) /C 12 % Conversion from feet to inches
/F /F /D 8 >>% Fractions of inches rounded to nearest 1/8
]
/A [<</U (acres) % Area: measured in acres
/C 640 >>% Conversion from square miles to acres
]
>>

However, an empty /U value is not forbidden. And this is what the PDF creators might use in cases when the scaling coefficient is not linked to any standard unit.

@thorsted
Copy link
Author

thorsted commented Apr 14, 2022

1.26RC1 PDF-Hul is still using version 1.12.2, so can't test.

@carlwilson
Copy link
Member

This one I suspected might be a mistake on my part. Now I'm aware there's a packaging issue, which likely has a similar cause, I'll still double check, but believe it's fixed.

@thorsted
Copy link
Author

This one I suspected might be a mistake on my part. Now I'm aware there's a packaging issue, which likely has a similar cause, I'll still double check, but believe it's fixed.

Just checked PDF-Hul 1.12.3 and this sample PDF is still not well formed.

@carlwilson
Copy link
Member

I'll look into this and get back to you this week. I think I may have been hard of understanding on the issue, let's see.

@carlwilson carlwilson reopened this Apr 27, 2022
@carlwilson carlwilson modified the milestones: JHOVE 1.26, JHOVE 1.28 Jun 15, 2022
@carlwilson carlwilson modified the milestones: JHOVE 1.28, OPF Hackathon 2023 Tasks Jun 21, 2023
@carlwilson carlwilson removed this from the OPF Hackathon 2023 Tasks milestone Mar 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A product defect that needs fixing P2 Medium priority issues to be scheduled in a future release
Projects
Status: No status
Development

Successfully merging a pull request may close this issue.

4 participants