Exported PDF on macOS produces backward text with copy+paste

Steps to reproduce

  1. Export PDF from Sandbox
  2. Open PDF in Preview. It looks fine.
  3. Copy content and paste into anything (Notes, TextEdit, Mail…)

Expected result

Text pastes correctly.

Actual result

Pasted text is backwards.

Environment

macOS 12.6.2
Obsidian 1.1.9 (1.1.9 installer)
Sandbox; default theme; restricted mode; no snippets


Additional information

  • Manually changing to the Inter font for Text font in Settings > Appearance produces a PDF that can be copied/pasted.

Suggestion: Inter (or a font with no PDF/macOS issues) should be set as the default export/media/PDF font on macOS.

I reproduced the behavior (Obsidian 1.0.3 on MacOS 13.1), but the text copies correctly from Adobe Acrobat.

I noticed I also had difficulty selecting in Preview. It seemed to want to select too much I wasn’t able to select the 2 lines I selected from Acrobat — I could only get 3 (I didn’t spend a lot of time trying).

1 Like

Thanks for checking.

Yeah, selecting text acts odd with these exported PDFs in Preview. It’s like text is selected from the left of your insert point only. If you select right-to-left it kinda works (but still pastes backwards).

The solution seems to be here, but not sure if it was ever implemented; fell through the cracks with the move to 1.0, etc->

After some googling we believe this probably a combination of Chromium, the font that gets embedded, and Apple. With most of the blame likely on Apple. We invite you to file a bug report to Apple.

For the time being, we are going to revert to old font “Inter” just for printing as a workaround for this issue (0.15.10).

Export to PDF - searchable only when word is typed backwards - #5 by WhiteNoise?

The left-to-right thing makes sense as to why the selection acts weird — I didn’t think of that.

It’s strange the font should cause an issue, since I think Obsidian uses the system font(s) by default. But, computers :woman_shrugging:t2:

My problem is with searching. I export and then expect to be able to search a pdf but the pdf can’t find what I search for because somehow it is reading the text backwards. If I type the word I’m searching for backwards, it finds it. So weird. Still isn’t fixed for me. I’ve taken to revealing files in Finder and then open in Marked to convert to PDF.

If there is another fix I am unaware of, please let me know.

The workaround is mentioned multiple times above:

Swap your text font (Settings>Appearance>Text Font) to Inter, export the PDF, swap back to your preferred font.

That’s a pretty klunky workaround. Other Apps (Joplin, for example) do this correctly out of the box – how about a fix?

A fix would be nice.

This snippet also produces a copyable PDF (tested with the default and Minimal theme).

@media print {
  body {
  --font-text: 'Inter' !important;
  }
}
2 Likes

Do we know what font Obsidian end up using on MacOS, and whether the problem is specific to that font, or to multiple fonts?

With no changes, I think the Sandbox (1.1.9) uses the System Font on macOS 12.6, which I believe is ‘San Francisco’. Pasting Sandbox copied text into TextEdit shows as “System Font (Default)” (but that’s probably different from PDF copied text)

Most likely, fonts other than Inter also embed fine and are viewable in Preview with an Obsidian exported PDF (haven’t tried go through them), but honestly, I’ve wasted too much time on this for what was supposed to be fun family project. :sob:

1 Like

Thanks for sharing.

1 Like

yes, this is the same bug where some fonts are backwards when using Apple libraries to open the pdf.

1 Like

…gnola gniwollof llits enoyna roF

If you’re looking for a monospace font, “Fira Code” looks great and works fine in exported PDFs.

1 Like

fixed 1.1.14 using Inter for printing for default theme.

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.