[Poppler-bugs] [Bug 30692] pdftops does not crop
bugzilla-daemon at freedesktop.org
bugzilla-daemon at freedesktop.org
Wed Oct 13 14:04:08 PDT 2010
https://bugs.freedesktop.org/show_bug.cgi?id=30692
--- Comment #8 from William Bader <williambader at hotmail.com> 2010-10-13 14:04:07 PDT ---
Thanks for testing with xpdf. I'm not sure why you had problems, because it
works for me.
I am using xpdf-3.02pl4, which I think is the latest release. I think that
earlier versions work the same as this one.
I am using gs9.00. I am running Fedora 13, and the distributed gs8.71 can also
view the eps.
I can send the eps files or gv screen captures or other information if you
want.
Here is what happens if I run normally and with -nocrop and then compare the
results. "re" makes a rectangular path from four numbers. "/W" clips and then
starts a new path.
$ /usr/local/bin/pdftops-3.02pl4 -v
pdftops version 3.02
Copyright 1996-2007 Glyph & Cog, LLC
$ /usr/local/bin/pdftops-3.02pl4 -eps 20185846-cropbug.pdf crop.eps
$ /usr/local/bin/pdftops-3.02pl4 -eps -nocrop 20185846-cropbug.pdf nocrop.eps
$ ls -l crop.eps nocrop.eps
-rw-rw-rw- 1 william william 1254692 Oct 13 22:40 crop.eps
-rw-rw-rw- 1 william william 1254653 Oct 13 22:40 nocrop.eps
$ diff -U 10 crop.eps nocrop.eps
--- crop.eps 2010-10-13 22:40:14.022258605 +0200
+++ nocrop.eps 2010-10-13 22:40:18.782008510 +0200
@@ -412,22 +412,20 @@
0 J
10 M
1 w
/DeviceGray {} cs
[0] sc
/DeviceGray {} CS
[0] SC
false op
false OP
{} settransfer
-7.8891 16.1876 415.7905 1009.8124 re
-W
q
q
1 i
9.072 17.001 413.856 1008 re
W
/DeviceCMYK {} cs
[0 0 0 0.2] sc
false OP
false op
{} settransfer
$
If you have gs9.00, try the patch
--- gs9.00/base/gxccman.c- 2010-08-10 12:20:19.000000000 -0400
+++ gs9.00/base/gxccman.c 2010-09-28 15:50:14.053145974 -0400
@@ -609,7 +609,7 @@
gs_make_mem_mono_device(pdev, pdev->memory, target);
rc_decrement_only(target, "gx_alloc_char_bits"); /* can't go to 0 */
/* Decrement the ICC profile also. Same device is getting
reinitialized */
- rc_decrement(target->device_icc_profile,"gx_alloc_char_bits(icc
profile)");
+ if (target != NULL)
rc_decrement(target->device_icc_profile,"gx_alloc_char_bits(icc profile)");
pdev->rc = rc;
pdev->retained = retained;
pdev->width = iwidth;
If you have gs8.71, try the patch
--- gs8.71/lib/pdf2dsc.ps- 2008-02-25 06:48:45.000000000 +0100
+++ gs8.71/lib/pdf2dsc.ps 2010-02-19 22:14:55.000000000 +0100
@@ -116,7 +116,7 @@
DSCfile PDFname write==only
( \(r\) file { DELAYSAFER { .setsafe } if } stopped pop\n) puts
( pdfopen begin\n) puts
- ( copy_trailer_attrs\n) puts
+ ( process_trailer_attrs\n) puts
(%%EndSetup\n) puts
/.hasPageLabels false def % see "Page Labels" in the PDF Reference
If you have gs8.70, try the patch
--- gs8.70/Resource/Init/pdf_draw.ps- 2009-07-08 20:28:02.000000000 -0400
+++ gs8.70/Resource/Init/pdf_draw.ps 2009-08-17 17:42:54.000000000 -0400
@@ -262,7 +262,7 @@
} bdef
/resolvehalftone { % <dict> resolvehalftone <halftone>
- dup /HalftoneType get
+ dup /HalftoneType oget
dup //htrdict exch .knownget {
exch pop exec
} {
If gs crashes with a floating point exception, try the patch below (I can give
you versions for other versions of gs).
--- gs9.00/base/gsmisc.c- 2010-05-06 12:04:27.000000000 -0400
+++ gs9.00/base/gsmisc.c 2010-09-28 14:17:42.677102939 -0400
@@ -883,17 +883,25 @@
*/
static double const_90_degrees = 90.;
+/* const_90_degrees no longer works for GCC 4.1.2.
+ * As old fortran programmers know, to avoid rounding problems,
+ * real numbers must be compared as "fabs(x-y) < eps"
+ * and not for equality like "floor(x) == y".
+ */
+
+#define is_integer(x) (fabs(floor((x) + 0.5) - (x)) <= 1.0e-15)
+
double
gs_sin_degrees(double ang)
{
double quot = ang / const_90_degrees;
- if (floor(quot) == quot) {
+ if (is_integer(quot)) {
/*
* We need 4.0, rather than 4, here because of non-ANSI compilers.
* The & 3 is because quot might be negative.
*/
- return isincos[(int)fmod(quot, 4.0) & 3];
+ return isincos[(int)fmod(floor(quot+0.5), 4.0) & 3];
}
return sin(ang * (M_PI / 180));
}
@@ -903,9 +911,9 @@
{
double quot = ang / const_90_degrees;
- if (floor(quot) == quot) {
+ if (is_integer(quot)) {
/* See above re the following line. */
- return isincos[((int)fmod(quot, 4.0) & 3) + 1];
+ return isincos[((int)fmod(floor(quot+0.5), 4.0) & 3) + 1];
}
return cos(ang * (M_PI / 180));
}
@@ -915,9 +923,9 @@
{
double quot = ang / const_90_degrees;
- if (floor(quot) == quot) {
+ if (is_integer(quot)) {
/* See above re the following line. */
- int quads = (int)fmod(quot, 4.0) & 3;
+ int quads = (int)fmod(floor(quot+0.5), 4.0) & 3;
psincos->sin = isincos[quads];
psincos->cos = isincos[quads + 1];
--
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
More information about the Poppler-bugs
mailing list