mirror of
https://github.com/arsvendg/Stirling-PDF.git
synced 2026-07-16 11:23:10 +02:00
🤖 format everything with pre-commit by stirlingbot (#5144)
Auto-generated by [create-pull-request][1] with **stirlingbot** [1]: https://github.com/peter-evans/create-pull-request Signed-off-by: stirlingbot[bot] <stirlingbot[bot]@users.noreply.github.com> Co-authored-by: stirlingbot[bot] <195170888+stirlingbot[bot]@users.noreply.github.com>
This commit is contained in:
co-authored by
stirlingbot[bot] <195170888+stirlingbot[bot]@users.noreply.github.com>
parent
e6d3f20c36
commit
c990ab3216
@@ -9,10 +9,10 @@ The script prints size and font statistics so we can confirm whether the
|
||||
lightweight export (no COS dictionaries) is active and how large the font
|
||||
payloads are.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import base64
|
||||
import json
|
||||
import math
|
||||
from pathlib import Path
|
||||
@@ -105,7 +105,11 @@ def analyze_fonts(fonts: Iterable[Dict[str, Any]]) -> FontBreakdown:
|
||||
sample_cos_ids.append((font_id, uid))
|
||||
|
||||
metadata_bytes += approx_struct_size(
|
||||
{k: v for k, v in font.items() if k not in {"program", "webProgram", "pdfProgram"}}
|
||||
{
|
||||
k: v
|
||||
for k, v in font.items()
|
||||
if k not in {"program", "webProgram", "pdfProgram"}
|
||||
}
|
||||
)
|
||||
|
||||
program = font.get("program")
|
||||
@@ -259,18 +263,14 @@ def main() -> None:
|
||||
f" Text payload characters (not counting JSON overhead): "
|
||||
f"{page_stats.text_payload_chars:,}"
|
||||
)
|
||||
print(
|
||||
f" Approx text structure bytes: {human_bytes(page_stats.text_struct_bytes)}"
|
||||
)
|
||||
print(f" Approx text structure bytes: {human_bytes(page_stats.text_struct_bytes)}")
|
||||
print(
|
||||
f" Approx image structure bytes: {human_bytes(page_stats.image_struct_bytes)}"
|
||||
)
|
||||
print(
|
||||
f" Approx content stream bytes: {human_bytes(page_stats.content_stream_bytes)}"
|
||||
)
|
||||
print(
|
||||
f" Approx annotations bytes: {human_bytes(page_stats.annotations_bytes)}"
|
||||
)
|
||||
print(f" Approx annotations bytes: {human_bytes(page_stats.annotations_bytes)}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in New Issue
Block a user