π Assignment PDF Generator with HTML2Canvas and jsPDF#
This project is a Next.js-based tool that generates a well-structured PDF file by capturing sections of a webpage using
html2canvas
and jsPDF
. It is designed specifically for students who want to submit programming assignments in a uniform PDF format, featuring code, questions, and terminal outputs. The tool allows adding multiple questions, changing the code theme, and selecting the programming language.π₯ Demo#
β¨ Features#
- β Question and Answer Input: Add multiple questions with corresponding code snippets and terminal outputs.
- π Customizable Themes: Choose different programming language themes for syntax highlighting.
- π PDF Generation: Generate professional PDFs with customizable layouts.
- π Dynamic Content Capture: Include only relevant sections like code and output, excluding unnecessary parts.
- βοΈ Standardized Format: Ensure consistent assignment formatting for ease of grading.
π¨ Tech Stack#
- Frontend: Next.js π
- Code Highlighting: React-Syntax-Highlighter π
- PDF Generation: html2canvas and jsPDF π
- TypeScript: For enhanced development experience π
- CSS Modules: Styled components for scoped CSS π
π How to Use#
1.Clone the Repository:
git clone https://github.com/idityaGE/Assignment-Code-to-PDF.git
cd Assignment - Code - to - PDF
2.Install Dependencies:
npm install
3.Run the Application:
npm start
Access the app at
http://localhost:3000
.- Generate PDFs: Add questions, code snippets, and terminal outputs.Click "Generate PDF" to download a structured PDF.
π§ Customization#
Modify PDF Layout#
- Adjust margins and page sizes in the
handleGeneratePDF()
function. - Include additional DOM elements by updating
document.querySelector()
logic.
Themes and Languages#
- Modify supported languages and themes by updating the
React-Syntax-Highlighter
configuration.
β€οΈ Support Me#
- β Buy Me a Coffee: If you appreciate this tool, consider supporting my work.
- π¦ Follow Me on Twitter: Stay updated with my latest projects and innovations.
π Contributions#
Contributions are welcome! Submit issues, fork the repository, and open pull requests.Letβs improve this project together.
π License#
This project is licensed under the MIT License.See the LICENSE file for more details.