[poppler] utils/pdftocairo.cc utils/pdftoppm.cc

2022-09-06 Thread GitLab Mirror
 utils/pdftocairo.cc |1 +
 utils/pdftoppm.cc   |1 +
 2 files changed, 2 insertions(+)

New commits:
commit 2cd23e7e6de1e854e22c7fd666a9167a58662211
Author: Albert Astals Cid 
Date:   Wed Sep 7 01:03:57 2022 +0200

Update (C)

diff --git a/utils/pdftocairo.cc b/utils/pdftocairo.cc
index 9e92f774..8a5f08fd 100644
--- a/utils/pdftocairo.cc
+++ b/utils/pdftocairo.cc
@@ -39,6 +39,7 @@
 // Copyright (C) 2020 Salvo Miosi 
 // Copyright (C) 2021 Peter Williams 
 // Copyright (C) 2021 Christian Persch 
+// Copyright (C) 2022 James Cloos 
 //
 // To see a description of the changes please see the Changelog file that
 // came with your tarball or type make ChangeLog if you are building from git
diff --git a/utils/pdftoppm.cc b/utils/pdftoppm.cc
index b1aa9248..b0f0120c 100644
--- a/utils/pdftoppm.cc
+++ b/utils/pdftoppm.cc
@@ -37,6 +37,7 @@
 // Copyright (C) 2020 Philipp Knechtges 
 // Copyright (C) 2021 Diogo Kollross 
 // Copyright (C) 2021 Peter Williams 
+// Copyright (C) 2022 James Cloos 
 //
 // To see a description of the changes please see the Changelog file that
 // came with your tarball or type make ChangeLog if you are building from git


[poppler] utils/pdftocairo.cc utils/pdftoppm.cc

2022-09-06 Thread GitLab Mirror
 utils/pdftocairo.cc |2 +-
 utils/pdftoppm.cc   |4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 119af9e894a928d9bad7d4f9e1681e54c9923439
Author: James Cloos 
Date:   Tue Aug 9 23:37:07 2022 +0200

Avoid round-off errors when determining raster dimensions.

The code in pdftoppm.cc and pdftocairo.cc carefully avoided overflow
when converting page sizes from points to pixels.

This worked well when the math was performed at extended precision,
as is done when using x387 opcodes, but could lead to results too
large by a ulp when computed without extra precision.

The code then needs to call ceil(3) to round fractional results up
to the next larger integer, resulting in an off-by-one error if the
computed size is even one ulp more than an integer.

The initial size is already a multiple of 72, so rearranging the math
to multiply before dividing by 72 avoids that imprecision.

Issue #253

diff --git a/utils/pdftocairo.cc b/utils/pdftocairo.cc
index 476f0be2..9e92f774 100644
--- a/utils/pdftocairo.cc
+++ b/utils/pdftocairo.cc
@@ -527,7 +527,7 @@ static void getOutputSize(double page_w, double page_h, 
double *width, double *h
 }
 }
 } else {
-getCropSize(page_w * (x_resolution / 72.0), page_h * (y_resolution / 
72.0), width, height);
+getCropSize(page_w * x_resolution / 72.0, page_h * y_resolution / 
72.0, width, height);
 }
 }
 
diff --git a/utils/pdftoppm.cc b/utils/pdftoppm.cc
index 69e56a72..b1aa9248 100644
--- a/utils/pdftoppm.cc
+++ b/utils/pdftoppm.cc
@@ -666,10 +666,10 @@ int main(int argc, char *argv[])
 
 // No specific image size requested---compute the size from the 
resolution
 if (x_scaleTo <= 0) {
-pg_w = pg_w * (x_resolution / 72.0);
+pg_w = pg_w * x_resolution / 72.0;
 }
 if (y_scaleTo <= 0) {
-pg_h = pg_h * (y_resolution / 72.0);
+pg_h = pg_h * y_resolution / 72.0;
 }
 }
 


[poppler] utils/pdftocairo.cc utils/pdftoppm.cc

2020-02-25 Thread GitLab Mirror
 utils/pdftocairo.cc |4 ++--
 utils/pdftoppm.cc   |4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

New commits:
commit afa0528e1dfaafeb09ad9fb52902b13b378e0250
Author: Albert Astals Cid 
Date:   Sat Feb 22 01:00:05 2020 +0100

pdftoppm/pdftocairo: Fix more odd/even mismatch

diff --git a/utils/pdftocairo.cc b/utils/pdftocairo.cc
index db12a421..e6e282a5 100644
--- a/utils/pdftocairo.cc
+++ b/utils/pdftocairo.cc
@@ -1175,8 +1175,8 @@ int main(int argc, char *argv[]) {
   // outputting a single page, ensure that even/odd page selection doesn't
   // filter out that single page.
   if (firstPage == lastPage &&
-   ((printOnlyEven && firstPage % 2 == 0) ||
-(printOnlyOdd && firstPage % 2 == 1))) {
+   ((printOnlyEven && firstPage % 2 == 1) ||
+(printOnlyOdd && firstPage % 2 == 0))) {
 fprintf(stderr, "Invalid even/odd page selection, no pages match 
criteria.\n");
 exit(99);
   }
diff --git a/utils/pdftoppm.cc b/utils/pdftoppm.cc
index fb5a363a..7605276d 100644
--- a/utils/pdftoppm.cc
+++ b/utils/pdftoppm.cc
@@ -532,8 +532,8 @@ int main(int argc, char *argv[]) {
   // outputting a single page, ensure that even/odd page selection doesn't
   // filter out that single page.
   if (firstPage == lastPage &&
-   ((printOnlyEven && firstPage % 2 == 0) ||
-(printOnlyOdd && firstPage % 2 == 1))) {
+   ((printOnlyEven && firstPage % 2 == 1) ||
+(printOnlyOdd && firstPage % 2 == 0))) {
 fprintf(stderr, "Invalid even/odd page selection, no pages match 
criteria.\n");
 goto err1;
   }
___
poppler mailing list
poppler@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/poppler


[poppler] utils/pdftocairo.cc utils/pdftoppm.cc

2020-01-13 Thread GitLab Mirror
 utils/pdftocairo.cc |6 +++---
 utils/pdftoppm.cc   |6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

New commits:
commit 4b063f84124a13f0561d871e43a08e0cf181ced5
Author: Albert Astals Cid 
Date:   Sun Jan 12 23:44:25 2020 +0100

pdftoppm/pdftocairo: Fix -e/-o printing the wrong pages

Fixes #873

diff --git a/utils/pdftocairo.cc b/utils/pdftocairo.cc
index fe9ceea4..db12a421 100644
--- a/utils/pdftocairo.cc
+++ b/utils/pdftocairo.cc
@@ -18,7 +18,7 @@
 // Copyright (C) 2009 Michael K. Johnson 
 // Copyright (C) 2009 Shen Liang 
 // Copyright (C) 2009 Stefan Thomas 
-// Copyright (C) 2009, 2010, 2017-2019 Albert Astals Cid 
+// Copyright (C) 2009, 2010, 2017-2020 Albert Astals Cid 
 // Copyright (C) 2010, 2011-2017 Adrian Johnson 
 // Copyright (C) 2010, 2014 Hib Eris 
 // Copyright (C) 2010 Jonathan Liu 
@@ -1215,8 +1215,8 @@ int main(int argc, char *argv[]) {
 crop_w = crop_h = sz;
   pg_num_len = numberOfCharacters(doc->getNumPages());
   for (pg = firstPage; pg <= lastPage; ++pg) {
-if (printOnlyEven && pg % 2 == 0) continue;
-if (printOnlyOdd && pg % 2 == 1) continue;
+if (printOnlyEven && pg % 2 == 1) continue;
+if (printOnlyOdd && pg % 2 == 0) continue;
 if (useCropBox) {
   pg_w = doc->getPageCropWidth(pg);
   pg_h = doc->getPageCropHeight(pg);
diff --git a/utils/pdftoppm.cc b/utils/pdftoppm.cc
index 44abd107..fb5a363a 100644
--- a/utils/pdftoppm.cc
+++ b/utils/pdftoppm.cc
@@ -18,7 +18,7 @@
 // Copyright (C) 2009 Michael K. Johnson 
 // Copyright (C) 2009 Shen Liang 
 // Copyright (C) 2009 Stefan Thomas 
-// Copyright (C) 2009-2011, 2015, 2018, 2019 Albert Astals Cid 
+// Copyright (C) 2009-2011, 2015, 2018-2020 Albert Astals Cid 
 // Copyright (C) 2010, 2012, 2017 Adrian Johnson 
 // Copyright (C) 2010 Hib Eris 
 // Copyright (C) 2010 Jonathan Liu 
@@ -578,8 +578,8 @@ int main(int argc, char *argv[]) {
   if (sz != 0) param_w = param_h = sz;
   pg_num_len = numberOfCharacters(doc->getNumPages());
   for (pg = firstPage; pg <= lastPage; ++pg) {
-if (printOnlyEven && pg % 2 == 0) continue;
-if (printOnlyOdd && pg % 2 == 1) continue;
+if (printOnlyEven && pg % 2 == 1) continue;
+if (printOnlyOdd && pg % 2 == 0) continue;
 if (useCropBox) {
   pg_w = doc->getPageCropWidth(pg);
   pg_h = doc->getPageCropHeight(pg);
___
poppler mailing list
poppler@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/poppler


[poppler] utils/pdftocairo.cc utils/pdftoppm.cc

2019-12-05 Thread GitLab Mirror
 utils/pdftocairo.cc |1 +
 utils/pdftoppm.cc   |2 ++
 2 files changed, 3 insertions(+)

New commits:
commit af86c7460a1e3bfc63d2868306ed712fa432dcb1
Author: Albert Astals Cid 
Date:   Fri Dec 6 00:43:45 2019 +0100

Update (C)

diff --git a/utils/pdftocairo.cc b/utils/pdftocairo.cc
index b096cad3..fe9ceea4 100644
--- a/utils/pdftocairo.cc
+++ b/utils/pdftocairo.cc
@@ -33,6 +33,7 @@
 // Copyright (C) 2018 Martin Packman 
 // Copyright (C) 2018 Adam Reichold 
 // Copyright (C) 2019 Oliver Sander 
+// Copyright (C) 2019 Kris Jurka 
 //
 // To see a description of the changes please see the Changelog file that
 // came with your tarball or type make ChangeLog if you are building from git
diff --git a/utils/pdftoppm.cc b/utils/pdftoppm.cc
index b14312fe..68006c5b 100644
--- a/utils/pdftoppm.cc
+++ b/utils/pdftoppm.cc
@@ -30,6 +30,8 @@
 // Copyright (C) 2018 Martin Packman 
 // Copyright (C) 2019 Yves-Gaël Chény 
 // Copyright (C) 2019 Oliver Sander 
+// Copyright (C) 2019 
+// Copyright (C) 2019 Kris Jurka 
 //
 // To see a description of the changes please see the Changelog file that
 // came with your tarball or type make ChangeLog if you are building from git
___
poppler mailing list
poppler@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/poppler

[poppler] utils/pdftocairo.cc utils/pdftoppm.cc

2019-12-05 Thread GitLab Mirror
 utils/pdftocairo.cc |   13 ++---
 utils/pdftoppm.cc   |   11 +++
 2 files changed, 21 insertions(+), 3 deletions(-)

New commits:
commit d8da6fd3b4c92651092d0a73f54b244bb45e1711
Author: Kris Jurka 
Date:   Wed Dec 4 22:51:16 2019 -0800

pdftoxxx: error out when even/odd selects 0 pages

When page selection options and/or document length result in planned
output of a single page, further even/odd page selection can then
result in no pages being output.  Error out instead of producing no
output which is confusing to the user.

Closes: https://gitlab.freedesktop.org/poppler/poppler/issues/815

diff --git a/utils/pdftocairo.cc b/utils/pdftocairo.cc
index 04b9f047..b096cad3 100644
--- a/utils/pdftocairo.cc
+++ b/utils/pdftocairo.cc
@@ -1170,6 +1170,16 @@ int main(int argc, char *argv[]) {
 exit(99);
   }
 
+  // If our page range selection and document size indicate we're only
+  // outputting a single page, ensure that even/odd page selection doesn't
+  // filter out that single page.
+  if (firstPage == lastPage &&
+   ((printOnlyEven && firstPage % 2 == 0) ||
+(printOnlyOdd && firstPage % 2 == 1))) {
+fprintf(stderr, "Invalid even/odd page selection, no pages match 
criteria.\n");
+exit(99);
+  }
+
   if (singleFile && firstPage < lastPage) {
 if (!quiet) {
   fprintf(stderr,
@@ -1197,9 +1207,6 @@ int main(int argc, char *argv[]) {
 }
 #endif
 
-  // Make sure firstPage is always used so that beginDocument() is called
-  if ((printOnlyEven && firstPage % 2 == 0) || (printOnlyOdd && firstPage % 2 
== 1))
-firstPage++;
 
   cairoOut = new CairoOutputDev();
   cairoOut->startDoc(doc);
diff --git a/utils/pdftoppm.cc b/utils/pdftoppm.cc
index aac1f743..b14312fe 100644
--- a/utils/pdftoppm.cc
+++ b/utils/pdftoppm.cc
@@ -517,6 +517,17 @@ int main(int argc, char *argv[]) {
 goto err1;
   }
 
+  // If our page range selection and document size indicate we're only
+  // outputting a single page, ensure that even/odd page selection doesn't
+  // filter out that single page.
+  if (firstPage == lastPage &&
+   ((printOnlyEven && firstPage % 2 == 0) ||
+(printOnlyOdd && firstPage % 2 == 1))) {
+fprintf(stderr, "Invalid even/odd page selection, no pages match 
criteria.\n");
+goto err1;
+  }
+
+
   if (singleFile && firstPage < lastPage) {
 if (!quiet) {
   fprintf(stderr,
___
poppler mailing list
poppler@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/poppler