vscode-markdown-pdf icon indicating copy to clipboard operation
vscode-markdown-pdf copied to clipboard

Unable to export to pdf from markdown

Open akhilparimi97 opened this issue 5 years ago • 10 comments

I dont know much about this stuff, im using VS code for a project and im facing a problem while converting the markdown file to pdf.

I'm using WSL Remote in VScode I,ve opened the .md file from my project folder then i right click and select Markdown PDF: export from the list

it gives out 2 errors 1. ERROR: exportPdf() 2.

Error: Failed to launch chrome! [1202/125726.601876:FATAL:zygote_host_impl_linux.cc(116)] No usable sandbox! Update your kernel or see https://chromium.googlesource.com/chromium/src/+/master/docs/linux_suid_sandbox_development.md for more information on developing with the SUID sandbox. If you want to live dangerously and need an immediate workaround, you can try using --no-sandbox. #0 0x7fb01cc86879 #1 0x7fb01cbe3c63 #2 0x7fb01cbf8013 #3 0x7fb01e39295e #4 0x7fb01c827adc #5 0x7fb01c87372c #6 0x7fb01c8260b1 #7 0x7fb01c87299d #8 0x7fb01c87270b #9 0x7fb01a6031b8 #10 0x7fb011241b97 #11 0x7fb01a60302a

Received signal 6 #0 0x7fb01cc86879 #1 0x7fb01cbe3c63 #2 0x7fb01cc86401 #3 0x7fb0175e2890 #4 0x7fb01125ee97 #5 0x7fb011260801 #6 0x7fb01cc85265 #7 0x7fb01cbf8461 #8 0x7fb01e39295e #9 0x7fb01c827adc #10 0x7fb01c87372c #11 0x7fb01c8260b1 #12 0x7fb01c87299d #13 0x7fb01c87270b #14 0x7fb01a6031b8 #15 0x7fb011241b97 #16 0x7fb01a60302a r8: 0000000000000000 r9: 00007fffc4b96da0 r10: 0000000000000008 r11: 0000000000000008 r12: 00007fffc4b98068 r13: 00007fffc4b97048 r14: 00007fffc4b97048 r15: 00007fffc4b97060 di: 0000000000000002 si: 00007fffc4b96da0 bp: 00007fffc4b96ff0 bx: 00007fb01160c840 dx: 0000000000000000 ax: 0000000000000000 cx: 0000000000000008 sp: 00007fffc4b96da0 ip: 00007fb01125ee97 efl: 0000000000000246 cgf: 00000053002b0033 erf: 0000000000000000 trp: 0000000000000000 msk: 0000000000000000 cr2: 0000000000000000 [end of stack trace] Calling _exit(1). Core file will not be generated.

TROUBLESHOOTING: https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md

please tell me how to fix this

Extension version: 1.4.1 VS Code version: Code 1.40.2 (f359dd69833dd8800b54d458f6d37ab7c78df520, 2019-11-25T14:54:45.096Z) OS version: Windows_NT x64 10.0.18362 Remote OS version: Linux x64 4.4.0-18362-Microsoft

System Info
Item Value
CPUs Intel(R) Core(TM) i7-7500U CPU @ 2.70GHz (4 x 2904)
GPU Status 2d_canvas: enabled
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
metal: disabled_off
multiple_raster_threads: enabled_on
oop_rasterization: disabled_off
protected_video_decode: enabled
rasterization: enabled
skia_renderer: disabled_off
surface_control: disabled_off
surface_synchronization: enabled_on
video_decode: enabled
viz_display_compositor: enabled_on
viz_hit_test_surface_layer: disabled_off
webgl: enabled
webgl2: enabled
Load (avg) undefined
Memory (System) 15.90GB (8.98GB free)
Process Argv --folder-uri vscode-remote://wsl%2Bubuntu-18.04/mnt/c/Users/Parimi/Desktop/homeworks/CFD/cricket%20ball%20project
Screen Reader no
VM 0%
Item Value
Remote WSL: Ubuntu-18.04
OS Linux x64 4.4.0-18362-Microsoft
CPUs Intel(R) Core(TM) i7-7500U CPU @ 2.70GHz (4 x 2901)
Memory (System) 15.90GB (8.98GB free)
VM 0%
Process Info
CPU %	Mem MB	   PID	Process
    0	    87	 10976	code main
    0	    14	  2208	   electron-crash-reporter
    0	   230	 10788	   window (main-project-readme.md - Untitled (Workspace) - Visual Studio Code)
    0	    52	 15216	     extensionHost
    0	    29	  7884	       electron_node wslDaemon.js 
    0	     6	 17580	         C:\WINDOWS\System32\wsl.exe -d ubuntu-18.04 sh -c '"$VSCODE_WSL_EXT_LOCATION/scripts/wslServer.sh" f359dd69833dd8800b54d458f6d37ab7c78df520 stable .vscode-server 0  '
    0	    11	  8944	           console-window-host (Windows internal process)
    0	     5	 11844	           C:\WINDOWS\System32\lxss\wslhost.exe {09e56f22-914e-4f1f-8dd6-a83b31e0a4dc} 460 468 472
    0	    12	  6944	             console-window-host (Windows internal process)
    0	   307	 13280	   gpu-process
    0	    76	 18156	   shared-process
    0	    77	 21272	   window (Issue Reporter)

Remote: WSL: Ubuntu-18.04
CPU %	Mem MB	   PID	Process
    0	     0	 12617	remote agent
    0	     0	  1230	   watcherService
    0	     0	  1960	   /bin/sh -c /bin/ps -ax -o pid=,ppid=,pcpu=,pmem=,command=
    0	     0	  1961	     /bin/ps -ax -o pid=,ppid=,pcpu=,pmem=,command=
    0	     0	 12680	   watcherService
    0	     0	 13216	   extensionHost
    0	     0	  1231	     /home/akhilparimi/.vscode-server/bin/f359dd69833dd8800b54d458f6d37ab7c78df520/node /home/akhilparimi/.vscode-server/bin/f359dd69833dd8800b54d458f6d37ab7c78df520/extensions/json-language-features/server/dist/jsonServerMain --node-ipc --clientProcessId=13216
    0	     0	  1270	     /bin/bash
    0	     0	 13229	     /bin/bash
    0	     0	 15082	     /bin/bash
    0	     0	   350	       freecad orifice.FCStd
    0	     0	 18187	     /bin/bash
Workspace Info

|  Remote: WSL: Ubuntu-18.04|    Folder (exercise1): 8 files|      File types: gitignore(1) md(1) html(1) pdf(1)
|      Conf files: makefile(1)|    Folder (project01): 61 files|      File types: stl(2) foam(2) py(2) md(1) html(1) FCStd(1) FCStd1(1)
|                  fms(1) cartesianMesh(1) surfaceFeatureEdges(1)
|      Conf files:;

akhilparimi97 avatar Dec 02 '19 12:12 akhilparimi97

Please upgrade Markdown PDF to ver1.4.3 and try.

yzane avatar Mar 11 '20 18:03 yzane

I'm afraid I am still getting the above error in WSL Ubuntu, using v1.4.4.

vituslehner avatar Jun 23 '20 11:06 vituslehner

I was getting a very similar issue and was able to fix it by installing dependencies that puppeteer needed that were missing on my WSL installation. So I was able to solve it by apt-geting some packages. The specific calls that I made were this:

sudo apt-get update
sudo apt-get install gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget x11vnc x11-xkb-utils xfonts-100dpi xfonts-75dpi xfonts-scalable xfonts-cyrillic x11-apps xvfb

I got this from this issue on puppeteer: https://github.com/puppeteer/puppeteer/issues/5468

If I had the error I would paste it here as well, but unfortunately I just fixed it and I don't want to unfix it to show the error. However, I do know that the one dependency it was complaining about was libnss3 (which is in the long list of dependencies above). Not sure if that was the only one that was missing or not, but maybe someone else can do some more debugging on this issue to find out if there are other dependencies required.

jacknbeans avatar Jun 25 '20 20:06 jacknbeans

On v.1.4.4 in VS Code . Mac OS

I get the following new errors today: Error: ENOENT: no such file or directory, open (it includes my file and '_tmp.html' appended to the end)

followed by

ERROR: exportPdf()

Error: net::ERR_FILE_NOT_FOUND at file:///Users/....

Anyone else experiencing this new error? It was working fine before but seems to have just started throwing errors.

alanwunsche avatar Aug 05 '20 21:08 alanwunsche

I was getting a very similar issue and was able to fix it by installing dependencies that puppeteer needed that were missing on my WSL installation. So I was able to solve it by apt-geting some packages. The specific calls that I made were this:

sudo apt-get update
sudo apt-get install gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget x11vnc x11-xkb-utils xfonts-100dpi xfonts-75dpi xfonts-scalable xfonts-cyrillic x11-apps xvfb

I got this from this issue on puppeteer: puppeteer/puppeteer#5468

If I had the error I would paste it here as well, but unfortunately I just fixed it and I don't want to unfix it to show the error. However, I do know that the one dependency it was complaining about was libnss3 (which is in the long list of dependencies above). Not sure if that was the only one that was missing or not, but maybe someone else can do some more debugging on this issue to find out if there are other dependencies required.

I was experiencing this same issue in a new WSL 2 install with Ubuntu running v 1.4.4 of this extension and the above solution worked for me.

The exact error I received leading me here in case this helps further track this issue was:

Error: Failed to launch the browser process! /home/collint/.vscode-server/extensions/yzane.markdown-pdf-1.4.4/node_modules/puppeteer-core/.local-chromium/linux-722234/chrome-linux/chrome: error while loading shared libraries: libXcursor.so.1: cannot open shared object file: No such file or directory TROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/master/docs/troubleshooting.md

collinticer avatar May 11 '21 15:05 collinticer

i had this same error trying to export to pdf from a dev-container based on mcr.microsoft.com/vscode/devcontainers/dotnet:0-6.0-bullseye-slim, but that apt-get install command failed with a message E: Unable to locate package libappindicator1

i just removed libappindicator1 from the long list and it worked:

$ sudo apt-get install gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libnss3 lsb-release xdg-utils wget x11vnc x11-xkb-utils xfonts-100dpi xfonts-75dpi xfonts-scalable xfonts-cyrillic x11-apps xvfb

now it works!

this leads me to suspect that more in that long list of things to install could be removed, but i haven't the inclination to go through it.

TomasEkeli avatar Apr 12 '22 11:04 TomasEkeli

this leads me to suspect that more in that long list of things to install could be removed, but i haven't the inclination to go through it.

The following sufficed for me (Windows 10, WSL2, Ubuntu Focal):

sudo apt install libxdamage1 libcups2 libatk1.0-0 libatk-bridge2.0-0 libgtk-3-0

kthy avatar Sep 12 '22 13:09 kthy

Faced the same issue on Windows 11 (WSL2)

Actually it is not an issue of an extention. The problem here as many have pointed is with missing packages.

What you have to do is to look at error message in VSCode.

The error message is quite generic image

In my case it states that I'm missing lib libgtk-3.so.0 And it also shows location of chrome that is used to render html "/home/[youruser]/.vscode-server/extensions/yzane.markdown-pdf-1.4.4/node_modules/puppeteer-core/.local-chromium/linux-722234/chrome-linux/chrome: error while"

What's next run sudo apt install -y libgtk-3-0

Then you have to validate that package installation have fixed the issue One way is to generate your pdf/html again

Or you can use terminal to validate that chrome is ready to be used copy path with chrome location and run following command ldd /home/[youruser]/.vscode-server/extensions/yzane.markdown-pdf-1.4.4/node_modules/puppeteer-core/.local-chromium/linux-722234/chrome-linux/chrome | grep not

When there are missing dependencies output will look similar to this libgtk-3.so.0 => not found libgdk-3.so.0 => not found If all is good output will be empty.

No matter which way you will use to find out which dependecies are missing, just follow the error message to find out all dependencies that are missing. Happy dependencies hunting :)

in my case I had to install sudo apt install -y libxdamage1 libnss3 libcups2 libxss1 libasound2 libatk1.0-0 libatk-bridge2.0-0 libgtk-3 libgdk-3 libgtk-3-0

and that solved pdf generation issue.

SergeiYevteyev avatar Jul 06 '23 08:07 SergeiYevteyev

solved by

before_script:
  - apt-get update
  - apt-get install -yq gconf-service libasound2 libatk1.0-0 libc6 libcairo2 \
    libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 \
    libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 \
    libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 \
    libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 \
    libxss1 libxtst6 ca-certificates fonts-liberation libnss3 lsb-release \
    xdg-utils wget

from https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md

zhanglongqi avatar Sep 25 '23 15:09 zhanglongqi