Steps
Requirements
- Visual Studio Code (VS Code)
- Polyglot Notebook Extension
- Basic Setup Knowledge
- Visit Basic Setup for initial setup instructions.
- Install .NET SDK If not Installed From Official Website
File Setup
Install Visual Studio Code
- If not already installed, download and install VS Code.
Open the Folder with Your Image Files
- Navigate to the folder where your image files are located.
Open Terminal in the Folder
- For Windows: Right-click in the folder, select “Show More Options,” and then “Open in Terminal.” Alternatively, type
cmd
in the folder path and press Enter. - In the terminal, type
code .
(code followed by a space and a period) to open VS Code in that folder.
If the above methods don’t work, search for VS Code in your PC’s start menu and open it, then follow the live video for an alternative method:
- For Windows: Right-click in the folder, select “Show More Options,” and then “Open in Terminal.” Alternatively, type
Create a New Folder and Copy Image Files
- Create a new folder and copy all your image files into it.
Create a New Polyglot Notebook File
- Create a new file with a name ending in either
.ipynb
or.dib
. - Open the newly created file, then click on Select Kernel on the top right side of the file and choose .NET Interactive.
- Create a new file with a name ending in either
Library Installation Setup
Copy and paste the following code into the first cell of your notebook:
|
|
Main Program Code
- Add a New Code Cell
- Hover over the middle of the first cell until a “+ code” appears to add a new code cell. Click On Plus Code button
- Copy and Paste the Main Program Code
|
|
Code Modifications
You need to modify the code at line numbers 22 and 59:
Line 22: Specify Image Format
- Default Code:
1
string[] pngFiles = Directory.GetFiles(imageDirectory, "*.*");
- Modified Code (for PNG files):
1
string[] pngFiles = Directory.GetFiles(imageDirectory, "*.png");
- Default Code:
Line 59: Specify Image Folder Path
- Replace the placeholder with your actual image folder path:
1
string imageDirectory = @"replace me with image Folder path";
- Replace the placeholder with your actual image folder path:
Run the Program
- Click on the Run All button at the top of the screen.
After running the program, you should find a PDF file generated in your current directory.