https://github.com/mo7ammedd/download-pdf
download protected pdfs
https://github.com/mo7ammedd/download-pdf
Last synced: 9 months ago
JSON representation
download protected pdfs
- Host: GitHub
- URL: https://github.com/mo7ammedd/download-pdf
- Owner: Mo7ammedd
- Created: 2023-05-03T01:14:39.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2024-03-22T18:28:09.000Z (about 2 years ago)
- Last Synced: 2025-07-13T20:45:03.438Z (11 months ago)
- Language: JavaScript
- Size: 5.86 KB
- Stars: 11
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# JavaScript Image to PDF Converter
This is a JavaScript script that utilizes the jsPDF library to convert images on a webpage into a PDF document and save it as "check.pdf".
## How it Works
The script loads the jsPDF library dynamically from the google drive and then creates a PDF document by looping through all the images on the webpage. It filters out images with invalid sources, and for each valid image, it follows these steps:
1. Create a canvas element and draw the image on the canvas.
2. Convert the canvas content to a base64-encoded image data URL.
3. Add the base64 image data to the PDF document using jsPDF's `addImage` method.
4. Add a new page to the PDF for the next image.
Once all the images have been processed, the PDF is saved as "check.pdf" using the `pdf.save()` method.
## How to Use
1. Include the following script tag in your HTML file to load the jsPDF library:
```html