fabiocolacio / Marker

🖊 A gtk3 markdown editor
GNU General Public License v3.0
832 stars 75 forks source link

Exporters are not working. #304

Open mobinmob opened 4 years ago

mobinmob commented 4 years ago

I am trying to update Marker in void linux ( https://github.com/void-linux/void-packages/pull/20727 ) and I can only export to html and latex. Every other exporter is not producing a file. I have the same problem with the flatpak.

fabiocolacio commented 4 years ago

Hi @mobinmob, for formats other than HTML, latex and PDF, Marker uses the pandoc command to export. If pandoc is missing on the host, most of the formats won't work.

I can confirm that it pandoc is missing from the flatpak version (I will work on fixing that). On bare metal, make sure pandoc is installed and try again.

PDF export should work even without pandoc though, so if you are still experiencing problems with that, let me know (I haven't had issues with PDF export so far).

mobinmob commented 4 years ago

Pandoc is installed in my system. Both my package and flatpak exhibit similar behavior unfortunately. I expected problems with my build, but not with the flatpak (I am primarily using flatpaks for proprietary programs with no issues). If I try to export to pdf I get: print failed with error: ?????? ?????????????? ?????????????????? From both my package and the flatpak. If I try to export to docx I get: sh: 1: Syntax error: "(" unexpected from my package and

sh: -c: ?????? 0: ?????????? ?????? ????? ??? ?? ??????????? ??????? <<(>>
sh: -c: ?????? 0: `pandoc -s -c Solarized (Dark).css -o /path/to/test .marker_tmp_markdown.md'

from the flatpak.

The flatpak has an extra warning: Can't open portal file chooser: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.portal.Desktop was not provided by any .service files

The errors above appear if I run the program from cli (bash, with LANG=C).

fabiocolacio commented 4 years ago

Regarding the PDF issue, I haven't encountered that yet but I'll investigate it more. If you have access to a printer, you might try printing a document to see if that works (or simply opening the print dialog and printing to a pdf) to see if you can get errors or info from that. Under the hood PDF generation is done by printing the html view to a pdf.

The syntax error is because the css file Solarized (Dark).css should be wrapped in quotes, so I'll need to fix that. That is also supposed to be a full path to the sheet instead of just the file name, so I suspect it would run into an error regardless of that. I'll work on fixing the pandoc issues and update here with my results.

I'm no flatpak expert but the portal issue sounds like it could be from running an older version of flatpak (just spitballing)? Does the filechooser work properly for the marker flatpak for you when opening/saving/exporting files?

mobinmob commented 4 years ago

Regarding the PDF issue, I haven't encountered that yet but I'll investigate it more. If you have access to a printer, you might try printing a document to see if that works (or simply opening the print dialog and printing to a pdf) to see if you can get errors or info from that. Under the hood PDF generation is done by printing the html view to a pdf.

Printing to a pdf file works for both my package and the flatpak.

The syntax error is because the css file Solarized (Dark).css should be wrapped in quotes, so I'll need to fix that. That is also supposed to be a full path to the sheet instead of just the file name, so I suspect it would run into an error regardless of that. I'll work on fixing the pandoc issues and update here with my results.

Thank you! I am using Marker a lot, but I have not tried exporting to formats other than html until yesterday. I tried them because we attempted to package without the included mathjax (since the in-program preview and the html export seem to work without it).

I'm no flatpak expert but the portal issue sounds like it could be from running an older version of flatpak (just spitballing)? Does the filechooser work properly for the marker flatpak for you when opening/saving/exporting files?

i am running the latest stable release of flatpak (1.6.3). The filechooser does not appear for opening or saving files but it does for exporting.

Gusser93 commented 4 years ago

I'm having the same problem on an arch linux system with version 2020.04.04. Could this be a problem with the locale? Here

gtk_print_settings_set(print_s, GTK_PRINT_SETTINGS_PRINTER, "Print to File");

the name for the printer is "Print to File". On a German system it's called "In Datei drucken". I'm able to export the pdf with the printer dialog without problems.

I found a similar issue in the Tor issue tracker. Maybe the problem stated in the patch applies here too?

BastienBalaud commented 4 years ago

Hello,

I have encounter similar issue with PDF printing with Gnome in French :

marker
scroll 2.0 extension initialized
scroll 2.0 extension initialized
print failed with error: Imprimante non trouvée

But when when I switch to English, it's works fine

export LANGUAGE=en_GB
marker
scroll 2.0 extension initialized
scroll 2.0 extension initialized
fabiocolacio commented 4 years ago

Thanks for the input about the PDF export. GtkPrintSettings has no programmatic way to select "Print to File" as a target (other than using a string). It seems there are a few ways we can fix this:

  1. Provide translations for the string (but there will always be languages that are left out)
  2. Export to PDF through pandoc, but then there is an added requirement on a bloated LaTeX install, and the PDF styling won't match webview's styling
  3. Remove PDF from the export page and hope users are saavy enough to know to go to the print menu and select Print to File themselves.

As much as I think it is not user-friendly, I think option 3 is the way to go. I am really not keen on including a full LaTeX distribution in the package, and option 1 is only a partial fix :/

fabiocolacio commented 4 years ago

The PDF issue seems to be fixed with #321. Feel free to re-open if it isn't fixed for you all (has not been pushed to flatpak yet), so you must build from source).

ghost commented 4 years ago

Hi ! Try #321 patch with the latest zip release. It works ... But if you try to add some charter plots, it fails again with the "no printer detected" message.

nick87720z commented 2 years ago

This seems to be fixed in latest git. If I rename pandoc command to e.g. pandoc_, all but HTML, PDF and LATEX is hidden in export menu.

violetmage commented 2 years ago

pdfs are overrated anyway ;)

@fabiocolacio close this issue?