MCPcopy Create free account
hub / github.com/pymupdf/PyMuPDF / write_stabilized_with_links

Method write_stabilized_with_links

src/__init__.py:16067–16080  ·  view source on GitHub ↗
(contentfn, rectfn, user_css=None, em=12, positionfn=None, pagefn=None, archive=None, add_header_ids=True)

Source from the content-addressed store, hash-verified

16065
16066 @staticmethod
16067 def write_stabilized_with_links(contentfn, rectfn, user_css=None, em=12, positionfn=None, pagefn=None, archive=None, add_header_ids=True):
16068 #log("write_stabilized_with_links()")
16069 stream = io.BytesIO()
16070 writer = DocumentWriter(stream)
16071 positions = []
16072 def positionfn2(position):
16073 #log(f"write_stabilized_with_links(): {position=}")
16074 positions.append(position)
16075 if positionfn:
16076 positionfn(position)
16077 Story.write_stabilized(writer, contentfn, rectfn, user_css, em, positionfn2, pagefn, archive, add_header_ids)
16078 writer.close()
16079 stream.seek(0)
16080 return Story.add_pdf_links(stream, positions)
16081
16082 def write_with_links(self, rectfn, positionfn=None, pagefn=None):
16083 #log("write_with_links()")

Calls 5

closeMethod · 0.95
DocumentWriterClass · 0.85
write_stabilizedMethod · 0.80
seekMethod · 0.80
add_pdf_linksMethod · 0.80

Tested by 1