Skip to content

Commit

Permalink
Update __init__.py
Browse files Browse the repository at this point in the history
Simplify code for creating string representations from PDF object .
  • Loading branch information
JorjMcKie committed Oct 30, 2023
1 parent 5383849 commit 0c3b820
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5130,13 +5130,10 @@ def resolve_names(self):

def obj_string(obj):
"""Return string version of a PDF object definition."""
buffer = fitz.mupdf.fz_new_buffer(512)
output = fitz.mupdf.ll_fz_new_output_with_buffer(buffer.m_internal)
fitz.mupdf.ll_pdf_print_obj(output, obj.m_internal, 1, 0)
printed = fitz.JM_UnicodeFromBuffer(buffer)
fitz.mupdf.ll_fz_drop_output(output)
fitz.mupdf.ll_fz_drop_buffer(buffer.m_internal)
return printed
buffer = mupdf.fz_new_buffer(512)
output = mupdf.FzOutput(buffer)
mupdf.pdf_print_obj(output, obj, 1, 0)
return fitz.JM_UnicodeFromBuffer(buffer)

def get_array(val):
"""Generate value of one item of the names dictionary."""
Expand Down

0 comments on commit 0c3b820

Please sign in to comment.