typora / typora-issues

Bugs, suggestions or free discussions about the minimal markdown editor — Typora
https://typora.io
1.53k stars 58 forks source link

Typora v1.7.5 Freezes or Produce PDF with Wrong Footer are Footer is Turned On in PDF Export Setting on macOS Ventura #5846

Open g4x86 opened 1 year ago

g4x86 commented 1 year ago

Describe the bug Typora became unresponsive when exporting to PDF file with header/footer are turned on using internal theme.

To Reproduce Steps to reproduce the behavior:

  1. Go to Settings -> Export -> PDF
  2. Set Theme to an internal theme, e.g. GitHub
  3. Set Footer to a predefined tag "No. ${pageNo} / ${totalPages}"
  4. Close the dialog and export a Markdown to PDF
  5. Typora either becomes unreposive or produces a PDF file after a long delay with a text "footer" at the bottom of each page instead of the desired page numbers.

Expected behavior Typora should produce a PDF document with correct page footer as expected.

Screenshots / Screencasts A screenshot of PDF export setting dialog

Sample Markdown File Diagrams.md Diagrams.pdf

Desktop (please complete the following information):

Typora Version 1.7.5

Additional context Interesting, Typora v1.7.5 on Linux doesn't have this problem.

PDF Export Setting

Diagrams.pdf Diagrams.md

siddhpant commented 1 year ago

Can confirm Linux doesn't have this problem.

g4x86 commented 10 months ago

Today, I tested the latest Typora version 1.7.6 on my newly installed macOS Sonoma 14.1.1 (which is a completely fresh installation by wiping out everything on the hard drive including both OS and all app/user data) and this same problem persists. Now I can confirm this is a real bug of Typora on Mac.

abnerlee commented 9 months ago

I cannot reproduce this in 1.8.2-dev (https://typora.io/releases/dev), could you check if it is already fixed in 1.8.2-dev?

g4x86 commented 9 months ago

I just tried the version 1.8.2-d-ev on macOS Sonoma 14.2.1:

  1. first set the Footer in the PDF export dialog to No. $(pageNo} / ${totalPages},
  2. exported a document to PDF,
  3. a colorful lollipop cursor showed up and lasted about 30 seconds,
  4. eventually a PDF file was generated but with a footer text of "footer" at the bottom of each page. So, basically the same problem as before.
abnerlee commented 8 months ago

Is there any error/warning message or popups?

g4x86 commented 8 months ago

There is any error/warning messages either when the lollipop mouse pointer kept spinning without exporting anything or the program exported a PDF file with a footer with the text "Footer"

I just observed another bug of the latest version 1.8.7 on Debian/Ubuntu-based Linux system: PDF export function plainly stopped working (regardless of header/footer are set) with an error message: "Failed to export as PDF: undefined". Before updating, all previous versions of Typora work fine with PDF export. Furthermore, I tested the Flatpak version v1.8.6 for PDF export and surprisingly it works out smoothly. Based this overvation, my guess is that the Deb package of Linux version might use some external libraries to generate PDF, but however the latest versions have some compatibility issue with those external libraries.

So, please fix the PDF export bug in Linux deb package and also the Mac version.

Many thanks!

g4x86 commented 8 months ago

More info regarding the PDF export problem in Debian/Ubuntu-based Linux: when I run Typora from command line and, as soon as I select Export to PDF in menu, the following error message was printed:

[25404:0125/224421.343038:ERROR:platform_shared_memory_region_posix.cc(214)] Creating shared memory in /dev/shm/.org.chromium.Chromium.0RYXNK failed: No such file or directory (2) [25404:0125/224421.343204:ERROR:platform_shared_memory_region_posix.cc(217)] Unable to access(W_OK|X_OK) /dev/shm: No such file or directory (2) [25404:0125/224421.343265:FATAL:platform_shared_memory_region_posix.cc(219)] This is frequently caused by incorrect permissions on /dev/shm. Try 'sudo chmod 1777 /dev/shm' to fix.

However, I checked out the permission of /dev/shm and it looks totally fine:

drwxrwxrwt 2 root root 40 Jan 25 22:46 /dev/shm/

Other programs, like PostgreSQL, have no problem in creating files in this directory. Plus, I rebooted my Linux box after installing Typora, but it didn't help.

g4x86 commented 8 months ago

Updates:

  1. On Debian/Ubntu-based Linux, the issue of PDF export in Typora was resolved after its version was upgraded to v1.8.8.

  2. On the latest macOS 14.3, Typora v1.8.5 (regardless of installation source being either direct downloaded DMG image from official website or Homebrew) still has the same problem: once Header/Footer option was turned on, Typora had a hard time to generating corresponding PDF file with a rainbow lollipop cursor spinning more than 10 seconds and the resulted PDF file only has, e.g. "Footer" text at the bottom of each page. If Header/Footer option was turned off, Typora generated PDF file right away. Moreover, I tested Typora v1.8.5 on another freshly installed macOS 14.3 (without any third-party software installed), and Typora can export PDF files with desired footer text, e.g. page numbers, correctly. I'm wondering if it's because Typora has some compatibility issue with other software, e.g. Homebrew? I tried to remove /usr/localbin directory from the path variable and then launched Typora from command line as /Applications/Typora.app/Contents/MacOS/Typora MarkdownFile.md, but the problem remained and no useful debug information was printed out when Typora started exporting a PDF file with Header/Footer option turned on. Let me know if there's any other way to let Typora print out useful debugging information while it's running. Thanks!

abnerlee commented 8 months ago

still has the same problem: once Header/Footer option was turned on, Typora had a hard time to generating corresponding PDF file with a rainbow lollipop cursor spinning more than 10 seconds and the resulted PDF file only has, e.g. "Footer" text at the bottom of each page.

Possible to attach a screencast for us to use since we cannot reproduce this issue on our mac?

g4x86 commented 8 months ago

Quantum.pdf

When I turned on both header and footer options in PDF Export settings, I ended up with a PDF document with the "footer" text in both header and footer areas.