graft: use pikepdf's random name API instead of our own

Minor change to PDF output.
This commit is contained in:
James R. Barlow
2022-06-12 00:31:01 -07:00
parent b17fb61389
commit 0e550a1c6d
+1 -2
View File
@@ -7,7 +7,6 @@
"""For grafting text-only PDF pages onto freeform PDF pages."""
import logging
import uuid
from contextlib import suppress
from pathlib import Path
from typing import Optional
@@ -286,7 +285,7 @@ class OcrGrafter:
base_resources = _ensure_dictionary(base_page, Name.Resources)
base_xobjs = _ensure_dictionary(base_resources, Name.XObject)
text_xobj_name = Name('/' + str(uuid.uuid4()))
text_xobj_name = Name.random(prefix="OCR-")
xobj = self.pdf_base.make_stream(pdf_text_contents)
base_xobjs[text_xobj_name] = xobj
xobj.Type = Name.XObject