# Ghostscript errors



## trumee (Apr 1, 2018)

I have a scanner (ADS-1500W) which produces pdf which are readable in Linux but fail in FreeBSD.

Under linux,


```
# gs Report_002768.pdf
GPL Ghostscript 9.21 (2017-03-16)
Copyright (C) 2017 Artifex Software, Inc.  All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
Processing pages 1 through 2.
Page 1
>>showpage, press <return> to continue<<


# identify Report_002768.pdf 
Report_002768.pdf[0] PDF 599x791 599x791+0+0 16-bit sRGB 182715B 0.000u 0:00.000
Report_002768.pdf[1] PDF 599x791 599x791+0+0 16-bit sRGB 182715B 0.000u 0:00.000
```

However, FreeBSD gives


```
gs /tmp/Report_002768.pdf 
GPL Ghostscript 9.16 (2015-03-30)
Copyright (C) 2015 Artifex Software, Inc.  All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
Processing pages 1 through 2.
Page 1
   **** Error reading a content stream. The page may be incomplete.
   **** File did not complete the page properly and may be damaged.
%%BoundingBox: 0 0 0 0
%%HiResBoundingBox: 0.000000 0.000000 0.000000 0.000000
>>showpage, press <return> to continue<<

# identify  /tmp/Report_002768.pdf
   **** Error reading a content stream. The page may be incomplete.
   **** File did not complete the page properly and may be damaged.
   **** Error reading a content stream. The page may be incomplete.
   **** File did not complete the page properly and may be damaged.

   **** This file had errors that were repaired or ignored.
   **** Please notify the author of the software that produced this
   **** file that it does not conform to Adobe's published PDF
   **** specification.

/tmp/Report_002768.pdf[0] PDF 599x791 599x791+0+0 16-bit sRGB 3726B 0.000u 0:00.000
/tmp/Report_002768.pdf[1] PDF 599x791 599x791+0+0 16-bit sRGB 3726B 0.000u 0:00.000
```


Linux has app-text/ghostscript-gpl-9.21 whereas FreeBSD has ghostscript9-agpl-base-9.16_5 installed.

Anybody knows what could be the issue?


----------



## trumee (May 21, 2018)

I tried the same document with  _print/ghostscript9-base_ and _print/ghostscript7-x11_ in FreeBSD and 'gs' was able to process the document properly. Something is odd with the agpl version of ghostscript in ports tree.

In addition to _print/ghostscript9-base _i also need Imagemagick. All the Imagemagick packages depend on the 'agpl' version of ghostscript rather than the standard versions.

With _print/ghostscript9-base_, it works

```
$ gs -sDEVICE=pdfwrite -sOutputFile=x13.pdf 20180318161400-report_002764.pdf
GPL Ghostscript 9.06 (2012-08-08)
Copyright (C) 2012 Artifex Software, Inc.  All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
Processing pages 1 through 2.
Page 1
>>showpage, press <return> to continue<<

Page 2

>>showpage, press <return> to continue<<
GS>
```

With _print/ghostscript9-agpl-base_, it bombs

```
$ gs -sDEVICE=pdfwrite -sOutputFile=x13.pdf 20180318161400-report_002764.pdf
GPL Ghostscript 9.16 (2015-03-30)
Copyright (C) 2015 Artifex Software, Inc.  All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
Processing pages 1 through 2.
Page 1
   **** Error reading a content stream. The page may be incomplete.
   **** File did not complete the page properly and may be damaged.
>>showpage, press <return> to continue<<

Page 2
   **** Error reading a content stream. The page may be incomplete.
   **** File did not complete the page properly and may be damaged.
>>showpage, press <return> to continue<<


   **** This file had errors that were repaired or ignored.
   **** Please notify the author of the software that produced this
   **** file that it does not conform to Adobe's published PDF
   **** specification.

GS>
```

It is a scanned document with no embedded fonts,

```
$ pdffonts 20180318161400-report_002764.pdf
name                                 type              encoding         emb sub uni object ID
------------------------------------ ----------------- ---------------- --- --- --- ---------


$ pdfinfo 20180318161400-report_002764.pdf
Tagged:         no
UserProperties: no
Suspects:       no
Form:           none
JavaScript:     no
Pages:          2
Encrypted:      no
Page size:      599.4 x 790.56 pts
Page rot:       0
File size:      479947 bytes
Optimized:      no
PDF version:    1.3
```

Is it possible to build _graphics/ImageMagick7-nox11_ with _print/ghostscript9-base_ rather than _print/ghostscript9-agpl-base_?


----------



## tobik@ (May 21, 2018)

trumee said:


> Is it possible to build _graphics/ImageMagick7-nox11_ with _print/ghostscript9-base_ rather than _print/ghostscript9-agpl-base_?


You should be able to do that by setting `DEFAULT_VERSIONS+=ghostscript=9` in your make.conf.


----------

