Skip to content

Commit

Permalink
Merge branch 'master' into feature/refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
w3nl committed Dec 23, 2020
2 parents 2d27d00 + b8e41ff commit c5543d8
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
4 changes: 4 additions & 0 deletions changelog.md
@@ -1,3 +1,7 @@
0.7.3 2020-12-23
=====
* Made it possible to add density and width and height

0.8.0 2020-12-18
=====
* Refactor so the code is more testable and readable
Expand Down
10 changes: 6 additions & 4 deletions js/pdf2image.js
Expand Up @@ -322,12 +322,13 @@ function processOptions(receivedOptions) {

if (receivedOptions.density) {
options.density = positiveIntOrDefault(receivedOptions.density, 96);
} else if (receivedOptions.width || receivedOptions.height) {
options.width = positiveIntOrDefault(receivedOptions.width, '');
options.height = positiveIntOrDefault(receivedOptions.height, '');
} else {
options.density = 96;
}
if (receivedOptions.width || receivedOptions.height) {
options.width = positiveIntOrDefault(receivedOptions.width, '');
options.height = positiveIntOrDefault(receivedOptions.height, '');
}

// Its a jpg file
if (options.outputType == '.jpg') {
Expand Down Expand Up @@ -480,7 +481,8 @@ function createPagePromise(pageNum, pageIndex, totalPagesProcessed, totalPDFPage

if (options.density) {
convertOptions.push('-density ' + options.density);
} else {
}
if (options.width) {
convertOptions.push('-resize ' + options.width + (options.height ? 'X' + options.height : ''));
}
if (options.quality) {
Expand Down
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit c5543d8

Please sign in to comment.