Convert your highlighted code in Visual Studio Code to a PDF file with ease using this extension.
- Convert highlighted code in the active editor to a PDF file.
- Choose the font size, line height, and page orientation for the PDF output.
- Customize the PDF file name and save location.
- Visual Studio Code version 1.60.0 or higher.
-
Open Visual Studio Code.
-
Go to the Extensions view by clicking on the square icon in the sidebar.
-
Search for Highlighted Code to PDF.
-
Click Install to install the extension.
-
Once installed, click Reload to activate the extension.
-
Run the following command in your terminal to install Puppeteer and Chrome:
npx puppeteer browsers install chrome
-
Method 1: Context Menu
- Highlight the code you want to convert to a PDF file in the active editor.
- Right-click on the highlighted code.
- Select Convert to PDF from the context menu.
- Choose the desired options such as font size, line height, page orientation, file name, and save location in the dialog box.
- Click Save to generate the PDF file.
-
Method 2: Command Palette
- Highlight the code you want to convert to a PDF file in the active editor.
- Press
Ctrl + Shift + P
to open the Command Palette. - Type "Convert to PDF" and select it from the list.
- Choose the desired options such as font size, line height, page orientation, file name, and save location in the dialog box.
- Click Save to generate the PDF file.
Contributions are welcome! Please feel free to submit a pull request or open an issue on GitHub.
This extension is licensed under the MIT License.