Skip to content

Commit d936666

Browse files
committed
Changes after spotting
the cause for the previous segmentation fault.
1 parent abac0a8 commit d936666

1 file changed

Lines changed: 4 additions & 8 deletions

File tree

src/__init__.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19160,21 +19160,17 @@ def JM_convert_to_pdf(doc, fp, tp, rotate) -> bytes:
1916019160
for ilink in internal_links:
1916119161
pdf_page = mupdf.pdf_load_page(pdfout, ilink["page"])
1916219162
ret = ilink["ret"]
19163-
loc = mupdf.FzLocation()
19164-
loc.chapter = ret.chapter
19165-
loc.page = ret.page
19166-
dest = mupdf.FzLinkDest()
19163+
dest = mupdf.fz_link_dest()
1916719164
dest.type = 7 # XYZ destination format
19168-
dest.loc = loc # (chapter, page)
19165+
dest.loc.chapter = ret.chapter
19166+
dest.loc.page = ret.page
1916919167
dest.h = ilink["h"]
1917019168
dest.w = ilink["w"]
1917119169
dest.x = ilink["xp"]
1917219170
dest.y = ilink["yp"]
1917319171
dest.zoom = 0
1917419172
rect=ilink["from"]
19175-
# the following gives us a segv, so we construct the URI ourselves:
19176-
# uri = mupdf.pdf_new_uri_from_explicit_dest(dest)
19177-
uri = f"#&page={dest.loc.page+1}&zoom={dest.zoom},{round(dest.x,4)},{round(dest.y,4)}"
19173+
uri = mupdf.pdf_new_uri_from_explicit_dest(mupdf.FzLinkDest(dest))
1917819174
mupdf.pdf_create_link(pdf_page, rect, uri)
1917919175
# prepare write options structure
1918019176
opts = mupdf.PdfWriteOptions()

0 commit comments

Comments
 (0)