Bug 690659 - renders to blank pages
Summary: renders to blank pages
Status: RESOLVED WORKSFORME
Alias: None
Product: Ghostscript
Classification: Unclassified
Component: General (show other bugs)
Version: 8.60
Hardware: Other other
: P4 critical
Assignee: Default assignee
URL: http://www.fsi-language-courses.com/C...
Keywords:
Depends on:
Blocks:
 
Reported: 2009-07-27 15:17 UTC by lazer100
Modified: 2009-07-28 15:23 UTC (History)
0 users

See Also:
Customer:
Word Size: ---


Attachments
jpeg file xyz4.jpg output by the gs command mentioned (8.08 KB, image/jpeg)
2009-07-27 17:12 UTC, lazer100
Details
upload of the downloaded file (4.71 MB, application/pdf)
2009-07-27 17:21 UTC, lazer100
Details

Note You need to log in before you can comment on or make changes to this bug.
Description lazer100 2009-07-27 15:17:17 UTC
the above document doesnt render at all here with Ghostscript 8.60

with Acrobat it is fine, but its a bit unusual.

is there any way to get at least the pages of the document?

the gadgetry is irrelevant to me
Comment 1 lazer100 2009-07-27 15:23:11 UTC
if there is any problem with the URL, visit 

http://www.fsi-language-courses.com/Twi.aspx

and download the document from the "Student Text" link
Comment 2 lazer100 2009-07-27 15:27:32 UTC
looks like you have to download it first from the above link,

ie visit

http://www.fsi-language-courses.com/Twi.aspx

and then download it from the "Student Text" link using the right mouse button,

just clicking that link can be problematic
Comment 3 Alex Cherepanov 2009-07-27 15:37:59 UTC
I've downloaded the file using the URL field.
The file works for me. Please provide more information about your system
and your version of Ghostscript.
Comment 4 Ray Johnston 2009-07-27 15:52:57 UTC
Please download 8.64, or wait a week or so for the next release and download
tha, or download and build the current HEAD svn version.
Comment 5 lazer100 2009-07-27 17:12:43 UTC
Created attachment 5245 [details]
jpeg file xyz4.jpg output by the gs command mentioned


@Alex,

if it works for you then it is probably a build error,

can you verify that it was 8.60 and also what was the command line you used?

the command line I used and the error messages are:

gs -sDEVICE=jpeg -dBATCH -dNOPAUSE -dFirstPage=100 -dLastPage=105
-sOutputFile=xyz%d.jpg twi.pdf
GPL Ghostscript 8.60 (2007-08-01)
Copyright (C) 2007 Artifex Software, Inc.  All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
**** Warning:  An error occurred while reading an XREF table.
**** The file has been damaged.  This may have been caused
**** by a problem while converting or transfering the file.
**** Ghostscript will attempt to recover the data.
Processing pages 100 through 105.
Page 100
   **** ERROR: Unable to process JBIG2Decode data. Page will be missing data.
Page 101
   **** ERROR: Unable to process JBIG2Decode data. Page will be missing data.
Page 102
   **** ERROR: Unable to process JBIG2Decode data. Page will be missing data.
Page 103
   **** ERROR: Unable to process JBIG2Decode data. Page will be missing data.
Page 104
   **** ERROR: Unable to process JBIG2Decode data. Page will be missing data.
Page 105
   **** ERROR: Unable to process JBIG2Decode data. Page will be missing data.

   **** This file had errors that were repaired or ignored.
   **** The file was produced by: 
   **** >>>> Adobe Acrobat 8.1 Image Conversion Plug-in <<<<
   **** Please notify the author of the software that produced this
   **** file that it does not conform to Adobe's published PDF
   **** specification.
			


I have attached output file xyz4.jpg
Comment 6 lazer100 2009-07-27 17:21:08 UTC
Created attachment 5246 [details]
upload of the downloaded file

@Alex

this is an upload of the downloaded file, renamed as twi.pdf

can you verify this is bytewise the same as the file you correctly 

processed, just to determine if the browser damaged the file.

diff -Naur file1 file2

being one way to verify the files are the same
Comment 7 Marcos H. Woehrmann 2009-07-27 18:24:57 UTC
I just tried the attached file with gs860 on my iMac and get a non-blank page as output (and don't see 
the JPEG2Decode error messages):

marcos@imac:[125]% gs860 -sDEVICE=jpeg -sOutputFile=test%d.jpg -dBATCH -dNOPAUSE -
dFirstPage=100 -dLastPage=105 twi.pdf
GPL Ghostscript 8.60 (2007-08-01)
Copyright (C) 2007 Artifex Software, Inc.  All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
   **** Warning:  An error occurred while reading an XREF table.
   **** The file has been damaged.  This may have been caused
   **** by a problem while converting or transfering the file.
   **** Ghostscript will attempt to recover the data.
Processing pages 100 through 105.
Page 100
Page 101
Page 102
Page 103
Page 104
Page 105

   **** This file had errors that were repaired or ignored.
   **** The file was produced by: 
   **** >>>> Adobe Acrobat 8.1 Image Conversion Plug-in <<<<
   **** Please notify the author of the software that produced this
   **** file that it does not conform to Adobe's published PDF
   **** specification.


What platform are you running on?  Also, you mention a possible build error.  Does this mean you built 
the executable yourself?  What compiler did you use?
Comment 8 Alex Cherepanov 2009-07-27 18:48:33 UTC
The file pointed by the URL and the attached files are identical.
Initially, I used the command line "gswin32c FILE.PS" on Windows.

Now I've tried the command line from the comment #5 on 32-bit Windows
an 64-bit GNU+Linux using v. 8.60 configured with default settings and
built in release mode. Everything works OK as in the comment #7.
Comment 9 lazer100 2009-07-28 07:12:48 UTC
ok, the further feedback PROVES its a build error ie

the Ghostscript status is "RESOLVED WORKSFORME" 

yes I did build it myself, as I know now the bug is here and not 

with the source I will try to debug the build. I modified some 

parameters because originally I was building GS 8 on a very low memory machine,

and I have maintained those changes across versions even though now I have 

plenty of memory. I will revert those to the defaults for a start and see if the
problem vanishes.

is the JBIG2Decode done in Ghostscript or by an auxiliary program?

Comment 10 Ken Sharp 2009-07-28 07:19:49 UTC
Ghostscript uses a version of the JasPer decoder, which is built-in. The sources
are supplied as part of the GS distribution.
Comment 11 Ray Johnston 2009-07-28 08:46:11 UTC
Ken mentioned that 'jasper' is used, but that is used for JPXDecode (and
JPXEncode).

In comment 9, the question was:
> is the JBIG2Decode done in Ghostscript or by an auxiliary program?

For JBIB2 decoding, we use one that one of our staff members (Ralph Giles)
developed which is in the 'jbig2dec' directory.

You mention 'low memory' as a clue in comment 9...

BOTH jasper JPXDecode nad our JBIG2 decoder can use large amounts of RAM
in decoding images. Examination of the output from:

   gs -dPDFDEBUG bug690649.pdf

shows that JBIG2 is used in the source file.
Comment 12 lazer100 2009-07-28 12:41:01 UTC
@ Ray @#11

you are saying there IS an auxiliary program?

my build here builds the ghostscript binary but breaks after that and there

is no such auxiliary program, because of the break.

what is the build command to build the jbig2dec auxiliary programs directly?

perhaps if I get the auxiliary programs built the file will render correctly


(the break occurs because of some X11 dependency and there is no X11 available here)
Comment 13 Ken Sharp 2009-07-28 13:15:58 UTC
Apologies for introducing this confusion. ghostscript uses JasPer for JPXDecode
(JPEG 2000), and uses our own code for JBIG2Decode (JBIG2).

In both cases the source is supplied as part of the Ghostscript source
distribution. If you build Ghostscript from source these libraries should also
be built and statically linked to form the Ghostscript executable. So there is
no external application, its all part of GS.

I don't know which OS you are using, the report says 'Other', on Linux configure
should detect the absence of X and create an appropriate makefile, on Windows X
is never present and so should not be a problem. It is possible to build GS
without X11 support, but you may need help with the build system if you are on
some other OS, and I'm not an expert on that area.
Comment 14 Ray Johnston 2009-07-28 13:30:11 UTC
I have no idea what you mean by 'auxiliiary program'.

To automatically create a Makefile that has all of the parameters appropriate
for your installation, please first run:

  ./autogen.sh

then

  make

The autogen.sh runs autoconf to test for libraries and compiler flags so that
if your system doesn't have X11 it won't be included.
Comment 15 lazer100 2009-07-28 15:23:48 UTC
@Ray @#14

an auxiliary program is where one program calls another,

typically with C's system() call

eg prog.c

int main(int argc, char **argv)
{
char *command = "gs -sDEVICE=jpeg -sOutputFile=tiger%d.jpg tiger.eps" ;
return( system( command ) ) ;
}

here gs is an auxiliary program to prog, its a useful way of dealing with
self reference eg gs could create a PS file then call itself as an auxiliary
program. And then process the output of the external call of gs.

this is often much easier than internal self reference as it is highly meta
level being based on ascii. internal self reference can become very complicated
where external self reference is straightforward.

auxiliary programs are also an alternative to scripts, if written in standard C
they will run on ALL platforms whereas script files usually wont. eg you could
redo ps2pdf as a small C program which calls gs as an auxiliary program.

that way instead of having a Mac and a Unix and a Windows version of ps2pdf
you just have ONE C version ps2pdf.c

all the different gs script files can then be replaced by auxiliary programs

As far as the bug goes, looks like I have to debug the build further