Ken Sharp | 22 May 19:00 2015

Re: Fwd: Odd form of comment: "%Begin Resource"

At 17:56 22/05/2015 +0100, Ken Sharp wrote:

>I have been using [%%Creator: GPL Ghostscript GIT PRERELEASE 908 (ps2write)]

Try using a more recent version of Ghostscript.

Mike Breeden | 22 May 17:12 2015

Odd form of comment: "%Begin Resource"

I have been using [%%Creator: GPL Ghostscript GIT PRERELEASE 908 (ps2write)] 
to process PDF files to PostScript. Sometimes viewing them in GhostView, I get a warning dialog box:

Document Structuring Conventions

DSC Warning at line 3613:

%%BeginResource: /%%EndResource 

The number of Begin and End comments do not match

Sure enough, looking in the PostScript file with a text editor shows that sometimes there is a tag "%BeginResource" with only a single leading '%' sign instead of the usual two '%' characters. It seems to happen only in tags like:
%BeginResource: file (PDF FontFile obj_30)
30 0 obj
/Length1 33844/Length 38146>>stream
That type of code block seems always to preceed a large block of characters that probably is actually a character representation of hex data.

The "%%EndResource" tag always has both leading '%' characters.

If I select "Ok" at the warning in GhostView, I will see the page displayed correctly. Also, the file prints correctly.
The first question is why would this happen? Why the missing '%'?
If I then manually go in and insert the (5 out of 30 tags) missing '%' characters, GhostView will open the document without any warnings. I can live with that. I wrote some code to automatically correct the document by converting "%BeginResource" to "%%BeginResource". The documents print fine.
Now how we process documents for printing is to concatenate a bunch of files together (maybe 20 Meg) and send them to the printer as a single job. 
If I do that with the corrected files, I get an error after or during the printing of the second corrected document. It does not happen with uncorrected documents. Before stopping, the printer does print a message:

Does anyone have any idea what that means?

Thank you, Michael

gs-devel mailing list
gs-devel <at>
Paolo Bolzoni | 14 May 05:29 2015

Anonymize a pdf

Dear list,

Some conferences want anonymous paper.

Using LaTeX hyperref package it is easy to remove some metadata, like:
Title, Subject, Author... but in the .pdf stays an annoying metadata
called "PTEX.Fullbanner." Besides the fonts names are still visible.

So my question is, using gs it is possible to print a .pdf into
another .pdf so that:
- all not strictly necessary metadata is removed
- the fonts names are replaces with gibberish

About the last point, all the fonts are embedded subfonts, so the name
is not important.

Your faithfully,
Ken Sharp | 27 Apr 12:34 2015

Re: Using gs it is possible to scale a PDF printing it larger

At 18:27 27/04/2015 +0900, Paolo Bolzoni wrote:

>It is possible to scale as losslessy as possible (overall in term of
>vectors) a pdf from a4 to a0?

Very well phrased question :-)

Yes, set the media size to the desired size, set -dFIXEDMEDIA to prevent 
the input PDF resetting it, and set -dPDFFitPage to have the PDF scaled to 
fit the page.

If you use the pdfwrite device the result will be (as lossless as currently 
possible) a new PDF file scaled to the desired size.

Certain aspects of the new PDF file may not reflect the original, some 
metadata is not carried forwards, images may be recompressed in the same 
format (beware of JPEG images in the input, specify Flate compression for 
colour images if this is likely), there may be some other things I haven't 
thought of.

Paolo Bolzoni | 27 Apr 11:27 2015

Using gs it is possible to scale a PDF printing it larger

Dear list,

It is possible to scale as losslessy as possible (overall in term of
vectors) a pdf from a4 to a0?

Yours faithfully,
Ian Lord | 17 Apr 18:27 2015

Problem with accents on freebsd but not on windows



I’m writing here hoping someone will be able to help me with a problem we have using gs to convert pdf documents to png.


We have pdf documents where fonts are embedded into them that do not render correctly (Some accents are missing) when using GS On  freebsd.

If we take the same pdf and use GS on windows instead, all accents are fine.


Strangely, other documents have accents fine on FreeBSD so it seems somewhat related to the specific font used in the document. But the same font works on windows… Total mystery to me L


If we open the document in Adobe Reader on windows, everything is fine.

If we convert the document to png using Xpdf on FreeBSD, instead of Gs on freeBSD, accents are fine


We tried playing with the fontmap, but from what I understood, if the font is embedded the fontmap is of no use ?


I enclosed a copy of the problematic file (see bad.pdf)


and the example of the accent problem that we have only on freebsd (see capture.jpg)

I highlighted in yellow the missing accents from page 1.

Also, I circled in red other accents that are working which makes me suspect the problem comes from the font itself, but just on freebsd not windows build…


Any help would be greatly appreciated.








Ian Lord

MSD Informatique

143 Rue des Fauvettes

St-Colomban (Québec) J5K 0E2

Tél: (514) 776-6734 #201

Sans Frais: 1(877) 776-6734 #201


Attachment (bad.pdf): application/pdf, 290 KiB
gs-devel mailing list
gs-devel <at>
Ben Bristow | 1 Apr 11:23 2015

Can anyone point me in the right direction here?

Hey guys,

I don't know if this is the right place for this, but I really need some help here.

I have a Rails app using Docsplit, on a RHEL 6.5 box, tried using multiple versions of Ghostscript (including the latest one) and keep getting this error:

Completed 500 Internal Server Error in 2440ms

Docsplit::ExtractionFailed (Error: /rangecheck in --run--
Operand stack:
   0   --nostringval--   -1
Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   --nostringval--   false   1   %stopped_push   1951   1   3   %oparray_pop   1950   1   3   %oparray_pop   1934   1   3   %oparray_pop   --nostringval--   --nostringval--   1   1   0   --nostringval--   %for_pos_int_continue   --nostringval--   --nostringval--
Dictionary stack:
   --dict:1190/1684(ro)(G)--   --dict:1/20(G)--   --dict:84/200(L)--   --dict:84/200(L)--   --dict:117/127(ro)(G)--   --dict:280/300(ro)(G)--   --dict:26/32(L)--
Current allocation mode is local
GPL Ghostscript 9.16: Unrecoverable error, exit code 1
gm convert: "gs" "-q" "-dBATCH" "-dMaxBitmap=50000000" "-dNOPAUSE" "-sDEVICE=ppmraw" "-dTextAlphaBits=4" "-dGraphicsAlphaBits=4" "-r150x150" "-dUseCropBox" "-dFirstPage=0" "-dLastPage=0" "-sOutputFile=/tmp/d20150401-46662-13srsns/gmsJYXto" "--" "/tmp/d20150401-46662-13srsns/gmZCyIc1" "-c" "quit".
gm convert: Postscript delegate failed (/home/app/production/tmp/18-1427879935/w9CLCkXYerSTUIxtktQNdKXKh1kXUA.pdf).):
  lib/pdf_tasks.rb:157:in `extract_images'
  app/uploaders/docs_uploader.rb:155:in `generate_page_images'
  app/models/document_signer_observer.rb:93:in `after_update'
  app/controllers/document_signers_controller.rb:85:in `sign_document'
  app/controllers/document_signers_controller.rb:20:in `update'

The same issue does not occur on a different machine. I can't for the life of me figure out why this is happening.

Can anyone point me to a solution?

gs-devel mailing list
gs-devel <at>
Chris Liddell | 30 Mar 16:52 2015

Ghostscript 9.16 and GhostPDL 9.16

The GPL Ghostscript 9.16 and GPL GhostPDL 9.16 releases are now available.

Get it here:

For a release summary see:

Thanks to everyone whose hard work made this release possible!


Artifex Software, Inc.
Lee Howard | 26 Mar 17:31 2015

interpreting gray-scale text as black

I use Ghostscript in HylaFAX to produce faxable TIFF image data.  A 
simplified example of what HylaFAX does with Ghostscript is this...

gs -q -sDEVICE=tiffg4 -dNOPAUSE -dSAFER=true -dBATCH -r204x196 
-sOutputFile=output.tif input.pdf

Occasionally users send faxes which originate as PDFs with color or 
gray-scale text in them.  Naturally, Ghostscript has to produce a 
dithered image result since ITU G4 data is monochrome.

Often the user who sends faxes from PDFs with color or gray-scale text 
will complain that the text is either not readable (dark-enough) or that 
the document takes too long to transmit (due to the increased data 
size).  Ghostscript does an excellent job of rendering blue as a shade 
of gray, but many users seem to prefer if the blue text is translated to 

I would like to implement a way to help those users that does not 
require them to reproduce their source document with black-only text 
(which is what I currently have to do).

I've attached a sample PDF with text in black and then various shades of 

Using Ghostscript, how would you "shift" the interpretation of the 
gray-scale text such that the output image text would be noticeably 
darker for the gray-scale text or all simply made to be black?



Attachment (grey-scale.pdf): application/pdf, 15 KiB
gs-devel mailing list
gs-devel <at>
John Culleton | 4 Mar 21:28 2015

Converting text from blue to black in pdf.

I have tried various games listed on the internet
but either the text ends up in a shade of gray or
it gets seriously distorted. Just to complicate
things there are plenty of illos where
conversion to grayscale is appropriate. Any

John Culleton
Wexford Press
Free list of books for self-publishers:
Updated PDF e-book: "Create Book Covers with
Scribus 1.4.5" coming soon at!
Edward Mendelson | 28 Feb 21:42 2015

Font specification question (for modifying plftable.h)

Is there documentation for the font descriptors in plftable.h?

The GhostPDL documentation here -

- says

"To use a new set of TrueType fonts requires modifying the C code in 
the file pl/plftable.c. The C structure
resident table contains a list of Windows TrueType font names. In the 
released package these names will
correspond with the Windows True Type font names in the URW font set. To 
use a different font set these
names must be replaced with the new font names and the code (at least 
the plftable.c module) should be
recompiled and linked."

I've had no trouble adding monospace fonts to plftable.h (I use a 
licensed Prestige Elite TTF), but I'm baffled by one thing about 
proportional fonts. The code in plftable.h includes lines like this for 
each font (this example is from Albertus Medium):

{0, 1, {313.0, 720000.0 / 313.0}, 0, REGULAR, MEDIUMBOLD, 4362, 27},

My question is: what does "313.0" measure? And, since I'm asking, what 
does 720000 measure? (I understand that the printer internal unit is 
1/7200 inch, but I don't know whether this is another way of indicating 
that same unit.)

Many thanks for any help with this.

Edward Mendelson
Contributing Editor
PC Magazine/