shd101wyy / vscode-markdown-preview-enhanced

One of the "BEST" markdown preview extensions for Visual Studio Code
https://shd101wyy.github.io/markdown-preview-enhanced
Other
1.47k stars 173 forks source link

[BUG] Cannot transform to pdf successfully. #2025

Open EkSulfur opened 3 months ago

EkSulfur commented 3 months ago

Describe the bug I tried to export pdf though Puppeteer after I set the correct Chorme path. But there is no reaction.

Environment

To Reproduce Steps to reproduce the behavior:

  1. set chorme path
  2. right click the preview page
  3. select Export
  4. select Chorme(Puppeteer)
  5. select PDF

Expected behavior PDF exported successfully

engelhro commented 3 months ago

I have the same problem – I don't know since when it exists, but I recently upgraded two Chrome installations to v127.0.6533.x, and with both I see the same behaviour (VSCode v1.91.1, Markdown Preview Enhanced v0.8.13).

I see in the task explorer that several Chrome instances have been started, but they seem to "hang" and don't finish the MD → PDF conversion, thus producing no output 😢.

Bavarian-Barbarian commented 1 week ago

Same here.

VS shows the follwoing error:

RG: Protocol error (Page.printToPDF): Invalid parameters Failed to deserialize params.pageRanges - BINDINGS: string value expected at position 833

Bavarian-Barbarian commented 1 week ago

Hi @engelhro , @EkSulfur

I found out, that I had pageRanges with no value defined in the yaml settings

puppeteer:
    format: "A4"
    landscape: false
    timeout: 3000 # <= Special config, which means waitFor 3000 ms
    pageRanges: # e.g. 1-5 <-- this line caused the error
    printBackground: false #true
    margin:
      top: '15mm'
      bottom: '15mm'
      left: '20mm' 
      right: '20mm'

according to https://github.com/puppeteer/puppeteer/blob/v1.9.0/docs/api.md#pagepdfoptions:

pageRanges <string> Paper ranges to print, e.g., '1-5, 8, 11-13'. Defaults to the empty string, which means print all pages.

emtpy strings would be allowed.

I did not change the settings recently but pdf export did stop working. Maybe Markdown Preview Enhanced does not like "empty strings" anymore.

Maybe you have the same issue?