@@ -114,11 +114,11 @@ print(sentinel.file_analysis("samples/test.pdf", json_response=True))
114114 " too_many_vector_ops:33035" ,
115115 " raster_estimate_too_big:77760000"
116116 ],
117- "page_width" : 612 .0 ,
118- "page_height" : 792 .0 ,
119- "max_image_pixels" : 0 ,
120- "max_vectors_operations" : 58 ,
121- "max_raster_pixels" : 8415000
117+ "page_width" : 2592 .0 ,
118+ "page_height" : 1728 .0 ,
119+ "max_image_pixels" : 354652 ,
120+ "max_vectors_operations" : 33035 ,
121+ "max_raster_pixels" : 77760000
122122 }
123123 ]
124124}
@@ -139,39 +139,26 @@ print(sentinel.page_analysis("samples/test.pdf", 3, json_response=True))
139139You can override safety thresholds per call:
140140
141141``` python
142- sentinel.is_file_safe(" samples/test.pdf" , config = {
143- " max_page_size" : 1800 ,
144- " max_image_pixels" : 10_000_000 ,
145- " max_vectors_operations" : 1000 ,
146- " max_raster_pixels" : 20_000_000
147- })
142+ sentinel.is_file_safe(
143+ " samples/test.pdf" ,
144+ config = {
145+ " max_page_size" : 1800 ,
146+ " max_image_pixels" : 10_000_000 ,
147+ " max_vectors_operations" : 1000 ,
148+ " max_raster_pixels" : 20_000_000
149+ }
150+ )
148151```
149152
150153| Parameter | Default | Description |
151154| ------------------------ | ---------- | --------------------------------------------- |
152155| ` max_page_size ` | 2000 | Max page dimension in points |
153- | ` max_image_pixels ` | 20,000,000 | Max embedded image size (w × h) |
156+ | ` max_image_pixels ` | 20,000,000 | Max embedded image total pixels size (w × h) |
154157| ` max_vectors_operations ` | 1500 | Max allowed vector drawing operations |
155158| ` max_raster_pixels ` | 30,000,000 | Estimated max rasterization size (at 300 dpi) |
156159
157160---
158161
159- ## Testing Example
160-
161- You can create a simple ` test_sentinel.py ` at the project root:
162-
163- ``` python
164- import PDFSentinel
165-
166- sentinel = PDFSentinel()
167-
168- result = sentinel.is_file_safe(" samples/test.pdf" , json_response = True )
169- print (result)
170- ```
171-
172- ---
173-
174-
175162## License
176163
177164MIT License © 2025 — Not Empty Foundation
0 commit comments