![PyPI Now Supports iOS and Android Wheels for Mobile Python Development](https://cdn.sanity.io/images/cgdhsj6q/production/96416c872705517a6a65ad9646ce3e7caef623a0-1024x1024.webp?w=400&fit=max&auto=format)
Security News
PyPI Now Supports iOS and Android Wheels for Mobile Python Development
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
pdf2thumbnail
Advanced tools
Generate PDF thumbnails.
You can install this module using npm:
npm i pdf2thumbnail
Requires imagemagick CLI tools to be installed.
There are numerous ways to install them.
For instance, if you're on OS X you can use Homebrew.
brew install imagemagick
For Linux, use yum.
sudo yum -y install ImageMagick
const {getTotalNumberOfPages} = require('pdf2thumbnail');
const totalNumberOfPages = await getTotalNumberOfPages('sample.pdf');
console.log(totalNumberOfPages);// =>29
const {writeThumbnails} = require('pdf2thumbnail');
writeThumbnails('sample.pdf', './dir');
// $ ll dir
// -rw-rw-r-- 1 ec2-user ec2-user 43157 Aug 5 09:17 sample_1.jpg
// -rw-rw-r-- 1 ec2-user ec2-user 24496 Aug 5 09:17 sample_2.jpg
// ...
const {writeThumbnails} = require('pdf2thumbnail');
writeThumbnails('sample.pdf', './dir', {
width: 300,
quality: 100,
format: 'png'
});
// $ ll dir
// -rw-rw-r-- 1 ec2-user ec2-user 42722 Aug 5 09:17 sample_1.png
// -rw-rw-r-- 1 ec2-user ec2-user 22411 Aug 5 09:17 sample_2.png
// ...
const {writeThumbnails} = require('pdf2thumbnail');
writeThumbnails('sample.pdf', './dir', {
start: 1,
end: 1
});
// $ ll dir
// -rw-rw-r-- 1 ec2-user ec2-user 43157 Aug 5 09:17 sample_1.jpg
const {writeThumbnails} = require('pdf2thumbnail');
writeThumbnails('sample.pdf', './dir', {
start: 2,
end: 5
});
// $ ll dir
// -rw-rw-r-- 1 ec2-user ec2-user 24496 Aug 5 09:17 sample_2.jpg
// -rw-rw-r-- 1 ec2-user ec2-user 41054 Aug 5 09:17 sample_3.jpg
// -rw-rw-r-- 1 ec2-user ec2-user 45361 Aug 5 09:17 sample_4.jpg
// -rw-rw-r-- 1 ec2-user ec2-user 38269 Aug 5 09:17 sample_5.jpg
Get the total number of pages in the PDF document.
Parameters:
filePath: string
: Path of the PDF file.Return value:
{Promise<number>}
: Total number of pages in the PDF document.Write a thumbnail for each page of the PDF document.
Parameters:
filePath: string
: Path of the PDF file.outDir: string
: Directory path to output thumbnails.options.width?: number
: Width of output thumbnail (px). Default is 300 (px).options.quality?: number
: The quality of the thumbnail to output (1-100). Default is 100.options.format?: string
: The format of the output thumbnail. Default is jpg.options.start?: number
: Start page position.options.end?: number
: End page position.Takuya Motoshima
FAQs
Generate PDF thumbnails.
We found that pdf2thumbnail demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.