Skip to content

Conversation

june6423
Copy link

example_new_line.pdf
example_new_word.pdf
example_old.pdf
example.pdf

I discovered that the font-replacement code was not working, likely due to changes in the behavior of page.clean_contents() in PyMuPDF. To address this issue, I made several modifications to the file to restore functionality.

In the previous version, the logic resized the font to preserve the bounding box (bbox) of a line of text. However, I believe it is more appropriate to preserve the bbox of individual words to maintain the correct font size. Consequently, I changed the logic to preserve word bboxes.

I have attached the following files for reference:

  • example.pdf: The original input file.
  • example_old.pdf: The output generated by the previous version.
  • example_new_word.pdf: The output generated by the modified version with the new logic.
  • example_new_line.pdf: The output generated by the modified version without changing the original logic, to ensure the correction works.

Thank you for your time and consideration. Please let me know if you have any questions or need further information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant