
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
This package allows an easy way to convert a pdf file into images of a given size and quality of the desired pages.
All of the convert operations return a Promise that in success returns a list of the processed pages. in case of an error returns the list of errors.
The following programs need to de installed for this module to work.
var pdf2image = require('pdf2image');
//converts all the pages of the given pdf using the default options
pdf2image.convertPDF('example.pdf').then(
function(pageList){
console.log(pageList);
}
);
[
{
"page" : 1,
"index": 1,
"name" : "page_1.jpg",
"path" : "path/to/page_1.jpg"
}
,{
"page" : 2,
"index": 2,
"name" : "page_2.jpg",
"path" : "path/to/page_2.jpg"
}
,{
"page" : 5,
"index": 3,
"name" : "page_5.jpg",
"path" : "path/to/page_5.jpg"
}
]
Note: the result list is always sorted.
The converter has the given options:
As a string, that can contain several tokens. A token always starts with the character '%'. If an invalid token is detected it will be ignored. The list of tokens is the following:
As a function, with the following parameters (pageNum, pageIndex, totalPagesProcessed, totalPDFPages, name, path) where:
The pages option allows an easy way to define the pages to be converted using any combination of the rules seperated by commas.
(X and Y represent an postive integer number)
Example: '1,3,7-9' will convert pages 1,3,7,8 and 9.
var pdf2image = require('pdf2image');
//converts the pages 1,3,5,6,7,9 and above with quality 100, density 200, and with the name "example_page_X.jpg"
pdf2image.convertPDF('example.pdf',{
density : 200,
quality : 100,
outputFormat : '%s_page_%d',
outputType : 'jpg',
pages : '1,3,5-7,9-'
});
This allows to have a set of options that can be used repeatedly on various pdfs.
var pdf2image = require('pdf2image');
//The converter uses the same options as the convertPDF function
var converter = pdf2image.compileConverter({
density : 200,
quality : 100,
outputFormat : '%s_page_%d',
outputType : 'png',
pages : 'even'
});
//Converts a single pdf
converter.convertPDF('example.pdf');
//Converts multiple pdfs
converter.convertPDFList(['example1.pdf','example1.pdf']);
Tested on Ubuntu 16.10 with node v6.10.0
FAQs
Converts a given pdf to the desired images
The npm package pdf2image receives a total of 1,409 weekly downloads. As such, pdf2image popularity was classified as popular.
We found that pdf2image demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.