1,621 questions
Score of 3
0 answers
62 views
GridAlpha/FaceAlpha on contourf + bar tiles rendered as solid opaque lines when exporting to EPS (works fine in PNG/PDF)
I have a MATLAB (R2024a) figure combining bar charts and filled contour plots (contourf) in a tiledlayout, with a semi-transparent grid overlay (GridAlpha) on the contour tiles.
When exported with ...
Score of 0
1 answer
75 views
Using copypage in PostScript
I have some not-so-old PostScript programs that create an animation using the copypage operator. See a simple example below [*].
They worked fine in macOS using Preview and pstopdf while Apple ...
Score of 0
0 answers
68 views
What causes rangecheck in --image-- in Ghostscript
I am trying to write a simple PostScript program to display a logo using the 'image' function (rather than the 'colorimage'). The PostScript code is very simple. I have tried reading the file, I have ...
Score of 2
1 answer
182 views
How are ghostscript and ps2pdf related?
My initial problem was: How can I use my Mac's system fonts in a PostScript file; that is, a font that is NOT among the standard 35 (?) PostScript fonts.
It is no longer my problem because I stumbled ...
Score of 1
0 answers
92 views
Trying to migrate script for Ghostscript over from 9.55 to 10.05
I have an old script from a few years ago I've been trying to migrate over to the latest version of Ghostscript. Its main job is to print checks.
$AccountingScalingArgs = "<</BeginPage{0....
Score of 0
0 answers
93 views
PDF: Embedding a document yields a /rangecheck error
From the official pdfmark documentation I copy-pasted into a file named example.ps:
[ /NamespacePush pdfmark
[ /_objdef {fstream} /type /stream /OBJ pdfmark
[ {fstream} << /Type ...
Score of 2
1 answer
300 views
Create PDF/UA from Postscript-File using Ghostscript
I use Ghostscript to create PDFs from PostScript files.
Starting in June, there is an obligation to create accessible PDFs (PDF/UA-Standard).
The closest related post how to make Accessibiity pdf from ...
Score of 0
0 answers
110 views
Generating EPS Files with Clipping Paths that Photoshop Correctly Recognizes as Vector Paths
I'm working on a web application (Vue.js) that removes backgrounds from images. An important component is exporting EPS files with clipping paths that are correctly recognized in Adobe Photoshop.
The ...
Score of 2
0 answers
62 views
PostScript - defining a namespace for a library
I've been coding in PostScript for a couple of months, and I'm wondering how one would implement namespaces, and use libraries.
As usual, the idea is to address:
name collisions
keeping separate ...
Score of 2
1 answer
99 views
Is %%EOF more than a comment in EPS?
Contrary to regular PostScript (PS) files, some comments in Encapsulated PostScript (EPS) file have a special meaning. For example, they must start with %!PS-Adobe-3.0 EPSF-3.0 and have a special %%...
Score of 0
0 answers
85 views
How can a .dsc file (as generated by pdf2dsc) be distinguished from a real PostScript document?
The pdf2dsc utility from Ghostscript generates a .dsc file consisting of a PostScript page list of a PDF document. How can such a file be distinguished from a real PostScript document?
The issue is ...
Score of 1
0 answers
33 views
PostScript - text outline doesn't match the text [duplicate]
In PostScript, I'm trying to get a precise bounding box for rendered text.
I believe I'm using the built-in PostScript operators correctly, but the results are unexpected.
The outline doesn't match ...
Score of 2
0 answers
140 views
Adobe Illustrator postscript weird syntax lonely bracket
I'm trying to parse an Adobe Illustrator file, which in essence is a postscript file with additional comments for structure, it even starts with %PS-Adobe (after extracting it out of the PDF "...
Score of 1
1 answer
137 views
Pass argument from GhostScript CLI to PostScript
I'm using Ghostscript to convert PDF to PDF/A files, which works fine. I want to use the -dSAFER option, which forces me to use absolute path name for the ICCProfile in the file PDFA_def.ps:
% in the ...
Score of 2
1 answer
97 views
Not understanding dictionary semantics, key-value defining and visability
I am not sure I understand the semantics of Postscript dictionaries. What is the difference if a 'def' is used when defining an entry to a dictionary as opposed to just listing the key value pair. ...
Score of 0
0 answers
346 views
Detect /OpenAction in a PDF with Ghostscript
I have a pdf with a Pages dictionary like this
<< /Type /Pages /Kids [
5 0 R
142 0 R
225 0 R
296 0 R
302 0 R
308 0 R
314 0 R
4 0 R
336 0 R
] /Count 9
...
Score of 1
0 answers
117 views
PostScript: Explain the difference between "newpath 0 0 moveto" and "newpath 0 0 moveto closepath"
Well I wanted to draw a "point" in PostScript (ghostscript 9.52) (using 1 setlinecap), so I tried (after 36 dup translate and 4 setlinewidth):
0 dup moveto stroke
But nothing appeared.
...
Score of 0
1 answer
56 views
How do I get a large integer value from the REALTIME operator in postscript? miliseconds?
The REALTIME operator is supposed to output the time in miliseconds.
I want to use that as a seed for RAND, but the output is always a two digit number between 24 and 31. How am I misunderstanding the ...
Score of 0
0 answers
91 views
How do I create RANDOM character strings in postscript?
I am trying to write a postscript document that will output strings of 5 random characters.
I can make an array of 26 upper case letter A-Z, but I cannot work out how to concatenate five random ...
Score of 0
0 answers
66 views
PostScript: Suppress/hide charpath outline
The following PostScript code generates the y axis of a diagram.
I just need the charpath for getting the bounding box of the text to align it.
How can I prevent the charpath from being be shown?
%!PS
...
Score of 1
2 answers
135 views
postscript: how to make two nested for loops
Want to print a raster of circles in a rectangular frame. Found example of one loop, worked fine. Added a second loop inside, no good; I only get a single column of circles. Suggestions welcome!
% ...
Score of 1
1 answer
267 views
Ranges in CMap files
In a CMap file (for use in PostScript or PDF documents), is it allowed to have CID ranges where the start end end codes differ in more than the last byte? For example, would the following be valid?
1 ...
Score of 0
0 answers
78 views
Fix PostScript file in Java (Missing %%EOF marker)
I have an Fortran application that can output PostScript files. When trying to read in the files using the ghost4j library, I get the following error
ERROR: %%EOF not found. File is not well-formed.
...
Score of 2
1 answer
310 views
Using Ghostscript to add page numbers via batch
I am trying to add pages to PDFs in the format page out of total_num_pages, I have about 100K documents to process, so I need to figure out a way to do this with many documents.
I have a batch file ...
Score of 0
0 answers
105 views
How to add Overprint Fill on text in PostScript file
I have a ghost command that gets PGB PDF as input and generates CMYK PDF. What I need to achive is to make the text overprinted, so when I open the PDF in Adobe Acrobat -> Use print production ->...
Score of 1
0 answers
68 views
In Postscript, does loading a dictionary to run a procedure have the same overhead as doing a lookup of the procedure name in the dict?
/myDict<<
/myProc {
(Hello world) =
}
>>def
myDict begin %A
myProc %A
end %A
myDict /myProc get exec %B
Given the above Postscript ...
Score of 0
0 answers
374 views
Ghostscript (ps2pdf) Not Handling UTF-8 Input File
I'm trying to use ps2pdf to convert a Postscript file to PDF, but the Postscript file has a UTF-8 character in it which is not rendered properly.
We have a website with a database, where users can ...
Score of 0
0 answers
86 views
Is it possible to export the width and height of a string to an external program writing native Postscript
I have a program that writes Postscript code to draw various diagrams using a Postscript graphics library. I would like to know in the main program what the actual size (height and length) of the text ...
Score of 0
1 answer
148 views
How approximate {X[z],Y[z]} functions as Bézier cubic
A user has smooth mathematical functions X[z] and Y[z] which define a smooth path over a range of z. My use case is that these functions define an Archimedes spiral, but the question can be more ...
Score of 1
1 answer
201 views
PostScript circles: how accurate, how improve?
The PostScript command arc can draw circles, and part circles. Adobe Distiller draws angles ≤90° as a single Bézier cubic. How accurate is this; how can it be made more accurate?
Similar content to ...
Score of 0
0 answers
91 views
Debug option INITDEBUG, output format
Ghostscript has the debug option INITDEBUG which outputs this:
END PROCS 0 1523912 211486 1330832 36164 true 662 3 <0>
gs_std_e.ps 0 1523912 217533 1330832 38644 true 670 3 <0>
gs_il1_e.ps ...
Score of 0
0 answers
184 views
how to extract location state from postscript?
I am writing a quiz generator, started using HTML which turns out to be hard to deterministically decide where things will be. So I am going to use postscript.
When I write out a question, and the box ...
Score of 2
1 answer
195 views
make two-sided pdf layout with multiple pages per sheet
Say I have the attached pdf with eight A6 (i.e., 105 x 74.25 mm) pages (marked, e.g., A A' B B' C C' D D'), I want to make a pdf with two A5 (i.e., 210 x 148.5 mm) page that can be two-sided printed. ...
Score of 1
0 answers
210 views
how to make Accessibiity pdf from postscript file
I came to knew from one thread "ghostscript ps pdfmark command /BDC for content tagging (PDF/UA and WCAG 2.0)" that it is possible to create Accessibility PDF from postscript file. is there ...
Score of 2
1 answer
568 views
Ghostscript: Stop image rotating when converting PDF to Image
I am using Ghostscript 10.02.0 to convert a PDF to a PNG with the following command:
gs -o ./test.png -dNumRenderingThreads=1 -sDEVICE=png16m -r72 -dLastPage=1 -dFitPage -dDEVICEWIDTHPOINTS=125 -...
Score of 0
0 answers
238 views
convert postscript file to eps file that is in a vector format
I want to generate an eps file (.eps) that contains vector data rather than rasterized data. I am trying to do so by converting a postscript file (.ps) into an eps file using ps2eps like so:
ps2eps ...
Score of 1
1 answer
290 views
How to use /AlwaysOutline command in ghostscript pdf processing?
I have PDF with different fonts embedded. One of them is color emoji font. For some unknown reason the font with emoji crashes my printing software. The only way I found is to convert all fonts to ...
Score of 0
0 answers
837 views
How to embed unembedded fonts in a PDF?
I am currently working on a project where I need to embed fonts into an existing PDF file that has some fonts that are not embedded. My primary goal is to ensure that all fonts used in the PDF are ...
Score of 3
1 answer
177 views
How do I embed a page of postscript (but not Encapsulated Postscript) into another document
In a sense, I'm asking how psnup works.
Say I have an existing document that follows the document structuring conventions. I can scan it, pull out the prolog, trailer, and individual pages. I want to ...
Score of 2
1 answer
68 views
How to use postscripts from metapost as images in graphviz?
I produce two postscript files runing metapost on the file example.mp containing:
beginfig(1);
u=1cm;
draw (2u,2u)--(0,0)--(0,3u)--(3u,0)--(0,0);
pickup pencircle scaled 4pt;
for i=0 upto 2:
for j=0 ...
Score of 0
0 answers
2214 views
Producing a PDF file with "CID TrueType" fonts
I'm looking for a step-by-step guide to create a PDF file with sample text, referencing fonts of type "CID TrueType", while not having those fonts embedded.
For context, I'm debugging a ...
Score of 2
0 answers
130 views
PostScript to PDF conversion problem with shfill
I have a PostScript file with a shfill in it that views fine in tools such as gv and converts fine to png using ghostscript however the shfill disappears when using ps2pdf on Linux (which uses gs ...
Score of 2
1 answer
320 views
How to import a PostScript file into PIL with a transparent background?
Using Pillow 9.5.0, Python 3.11.4, Tk 8.6, and Windows 11 (version 22H2)
On the program i'm working on, I have a tkinter canvas that saves a postscript file, which is then imported into a PIL Image ...
Score of 3
1 answer
128 views
PostScript "half stroke"?
In PostScript, once a path is defined, one can stroke it with the current linewidth. I imagine a pen of that width drawn along the path to create the line, the "ink" from this pen is ...
Score of 0
0 answers
106 views
Can a PostScript (.ps) file detect whether or not it's going to a screen (via ghostscript), as opposed to a (hardware) printer (with or without gs)?
I wish a PostScript file to be able to behave differently depending on whether it's going to a screen (via ghostscript) or to a (hardware) printer (with or without Ghostscript). I'm thinking of things ...
Score of 3
1 answer
430 views
compute bounding box for arbitrary PostScript code, from within PostScript
I want to be able to run some arbitrary PostScript code, and find out what its bounding box is, for the purpose of centering and/or scaling that PostScript code when I run it again. This needs to all ...
Score of 1
2 answers
720 views
Adding images in raw PDF
I am trying to make pdf's manually. I got the basics but the one thing I cannot figure out is images.
The thing I am trying right now, as a start, is adding a simple image in the form of binary code. ...
Score of 0
0 answers
320 views
Printing multiple-page PDF file, using different trays
As part of my current project, I am creating an app in C# to generate multi-page invoices in PDF format. I also merge 100 invoices into a single PDF file using the PDFSharp library. However, I am ...
Score of 0
0 answers
594 views
How to use Ghostscript to embed fonts (ttf) into PDFs?
I modify my pdf structure adding this:
/F1 <<
/Type /Font /Subtype /TrueType /BaseFont /MyFont /Encoding /WinAnsiEncoding /FontDescriptor 3 0 R /FirstChar 32 /LastChar 255 >>
Then, I ...
Score of 2
1 answer
242 views
Combine string and variable to create text label in postscript
I have this Label definition in postscript:
/Label { % i dx dy (text) Label
% write text at base i plus offset dx, dy
4 3 roll 1 sub coor exch get aload pop moveto
3 1 roll fsize mul exch fsize mul ...