View Issue Details

IDProjectCategoryView StatusLast Update
0000694fileGeneralpublic2025-11-10 18:38
Reporteryedaya Assigned To 
PrioritylowSeverityfeatureReproducibilityalways
Status newResolutionopen 
Product Version5.46 
Summary0000694: pdf: Find single digit page number
DescriptionCurrently when running `file pages.pdf` if the number of pages is lower than 10 it can print a wrong number of pages, since it looks for a number with 2 or more digits.
For example a pdf with this content in it will produce 'PDF document, version 1.4, 31 page(s)':
```
30 0 obj
<</Type/Pages/Count 1/Kids[31 0 R]>>
endobj
```

Attached a patch to fix this
TagsNo tags attached.

Activities

yedaya

2025-11-10 18:38

reporter  

0001-pdf-Find-single-digit-page-number.patch (662 bytes)   
From b5335e7585bdeb13cf528ab49387d1f5d1a90fcf Mon Sep 17 00:00:00 2001
From: Yedaya Katsman <yedaya.ka@gmail.com>
Date: Mon, 10 Nov 2025 20:26:38 +0200
Subject: [PATCH] pdf: Find single digit page number

---
 magic/Magdir/pdf | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/magic/Magdir/pdf b/magic/Magdir/pdf
index c4ab2142..3144e3b4 100644
--- a/magic/Magdir/pdf
+++ b/magic/Magdir/pdf
@@ -6,7 +6,7 @@
 
 0	name	pdf
 >8	search		/Count
->>&0	regex		[1-9][0-9]+		\b, %s page(s)
+>>&0	regex		[1-9]([0-9]+)?		\b, %s page(s)
 >8	search/512	/Filter/FlateDecode/	(zip deflate encoded)
 
 0	string		%PDF-		PDF document
-- 
2.51.0.491.g4b71b29477

Issue History

Date Modified Username Field Change
2025-11-10 18:38 yedaya New Issue
2025-11-10 18:38 yedaya File Added: 0001-pdf-Find-single-digit-page-number.patch