fraserxu / electron-pdf

📄 A command line tool to generate PDF from URL, HTML or Markdown files.
MIT License
1.24k stars 136 forks source link

Select text from PDF to clipboard is garbled on Mac #300

Closed danactive closed 5 months ago

danactive commented 2 years ago

After generating a PDF from markdown. I open the PDF in Apple Preview app or Safari; then select text, copy, and paste into a text editor, and I'm seeing garbled text like

.elbisaef si sa etirw-ot-ysae dna daer-ot-ysae sa eb ot dednetni si nwodkraM

Whereas the source markdown code is

Markdown is intended to be as easy-to-read and easy-to-write as is feasible.

The PDF text is fine to copy from other PDF viewers like Firefox or Brave.

Any ideas if this is a problem with Apple or electron-pdf?

vgiroux commented 2 years ago

It seems to be caused by the font style. Removing system-ui from the CSS font-family resolved the issue. (tested on macOS Monterey)