Skip to content

Cannot export PDF just with vscode extension (other methods work) #16590

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
CNDY1390 opened this issue Apr 29, 2025 · 0 comments · May be fixed by #16651
Closed

Cannot export PDF just with vscode extension (other methods work) #16590

CNDY1390 opened this issue Apr 29, 2025 · 0 comments · May be fixed by #16651
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug triage-needed Issue needs to be triaged

Comments

@CNDY1390
Copy link

CNDY1390 commented Apr 29, 2025

Environment Data

  • VS Code version: 1.99.3.0(not relevant)
  • Jupyter Extension version: 2025.3.0 (however, even 2020.2.0 applies, so it doesn't matter)
  • Python Extension version: 2025.4.0(not relevant)
  • OS: Windows 11 24H2
  • Python and/or Anaconda version: 3.8, 3.11 and 3.12(not relevant)
  • Type of virtual environment used: conda(not relevant)
  • Jupyter server running: Local and Remote(not relevant)

Expected Behavior

Exporting a Jupyter notebook to PDF from the VS Code Jupyter extension bar, and get a pdf.

Actual Behavior

Failed to export.

Steps to Reproduce

  1. Open any .ipynb file in VS Code.
  2. Right-click and select "Export as PDF".
  3. Observe the export failure, despite a valid PDF existing in the temp directory (for example "C:\Users...\AppData\Local\Temp\tmp-53764aZammKviOmV0.pdf.pdf").

Additional Information

  1. available options
Source To Via Success?
Web Server GUI PDF Download
Command Line TEX Command Line
Command Line PDF Command Line
VS Code Extension HTML VS Code Extension
VS Code Extension PY VS Code Extension
VS Code Extension PDF VS Code Extension
  1. This issue is distinct from Can't export a pdf. The html export works fine. #13912, xelatex (TeX) installed but still giving error #10910, and Export to pdf failed #12742, which suggest pandoc or nbconvert problems. These are not the root cause.
  2. root cause: pdf is actually generated, however, the extension failed to get his name. For example, the true ath is ...\AppData\Local\Temp\tmp-54084AG2zf2BvEQSm.pdf.pdf, but the extension accesses ...\AppData\Local\Temp\tmp-54084AG2zf2BvEQSm.pdf and thus got a failure.
  3. The code snippet from src/notebooks/export/exportBase.node.ts, if((await this.fs.stat(Uri.file(tempTarget.filePath))).size > 1) await this.fs.copy(Uri.file(tempTarget.filePath), target); is the source of the error. tempTarget.filePath contains the correct temporary filename (e.g., ...\AppData\Local\Temp\tmp-54084AG2zf2BvEQSm.pdf), but the extension is looking for a file with an extra .pdf extension.
  4. A temporary workaround is to modify the code to if((await this.fs.stat(Uri.file(pdfFilePath + '.pdf'))).size > 1) await this.fs.copy(Uri.file(pdfFilePath + '.pdf'), target);.
@CNDY1390 CNDY1390 added the bug Issue identified by VS Code Team member as probable bug label Apr 29, 2025
@CNDY1390 CNDY1390 changed the title Cannot export PDF just with vscode extension (other methods work) Cannot export PDF just with vscode extension (other methods work), **root cause** found Apr 29, 2025
@CNDY1390 CNDY1390 changed the title Cannot export PDF just with vscode extension (other methods work), **root cause** found [Root cause found] Cannot export PDF just with vscode extension (other methods work) Apr 29, 2025
@CNDY1390 CNDY1390 changed the title [Root cause found] Cannot export PDF just with vscode extension (other methods work) Cannot export PDF just with vscode extension (other methods work) Apr 29, 2025
@vs-code-engineering vs-code-engineering bot added the triage-needed Issue needs to be triaged label Apr 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue identified by VS Code Team member as probable bug triage-needed Issue needs to be triaged
Projects
None yet
3 participants