postscript

Ghostscript postscript pswrite is encoding text

一曲冷凌霜 提交于 2019-12-10 11:38:58
问题 Why is Ghostscript pswrite encoding my text in its output? Consider the following MWE: %!PS-Adobe-3.0 %%Title: mwe.ps %%Pages: 001 %%BoundingBox: 0 0 595 842 %%EndComments %%Page: 1 1 %%PageBoundingBox: 0 0 595 842 0 0 1 setrgbcolor 0 0 595 842 rectfill 1 0 0 setrgbcolor 247 371 100 100 rectfill /Times-Roman findfont 72 scalefont setfont newpath 247 300 moveto (Chris) show showpage Saving this MWE to file and viewing in GSview will display a blue page with red square and my name underneath.

Ghostscript ps to jpg output without white space

烈酒焚心 提交于 2019-12-10 10:32:25
问题 What I am trying to do is convert a ps which is just a image to a jpg using ghostcript here is what I started with gswin32c.exe -sDEVICE=jpeg -sOutputFile="test.png" example.ps however when I run this the jpg comes out with a lot of white space to the right and the bottom Also the picture comes out huge is there any way to crop out the whitespace in ghostscript? I tried this code gswin32c.exe -sDEVICE=jpeg -dBATCH -dNOPAUSE -dSAFER -r72x72 -g200x900 -sOutputFile="test.jpg" example.ps which

bold enhanced text in gnuplot

核能气质少年 提交于 2019-12-10 06:06:12
问题 UPDATE: this issue has been resolved in newer versions (>5.0) of gnuplot; see @andyras' answer. I am having difficulty getting gnuplot to create labels with bold and enhanced text in non-postscript terminals. The following script #!/usr/bin/env gnuplot reset set terminal pdfcairo enhanced color lw 3 size 3,2 font 'Arial-Bold' set output 'output.pdf' set tics scale 0 plot -x title 'normal text', \ -2*x t 'enhanced_{text}', \ -3*x t '{/Arial-Bold attempt to specify_{font}}' set terminal

Can transparency be used with PostScript/EPS?

烂漫一生 提交于 2019-12-09 14:50:09
问题 I am trying to save an R plot as an EPS file but I have a problem with the following component of the plot - the gray transparent polygon (transparent black = gray effect): polygon(x.polygon, y.polygon.6, col="#00000022", border=NA) This line of code works fine when saving the plot as PDF but not as EPS. Looks like EPS does not support transparency? What other choice would I have? Here is the code for the full plot: postscript(file="Figure.eps", width=5.5, height=5.5, onefile=F, horizontal=F)

Automatic paper selection using PostScript

懵懂的女人 提交于 2019-12-08 08:12:24
问题 I have a problem with a PostScript 3 printer with multiple trays which are loaded with A4 and A3 paper. Under Linux using the CUPS system I am now manually setting the right paper size by specifying a media=a4 option or defining two separate printers: one for A4 and one for A3. However this situation is far from being optimal as you always have to remember to pick the right printer. As PostScript is a turing-complete language and after reading a bit in the Red Book and the Blue Book I have a

Extract a bitmap from PostScript

时间秒杀一切 提交于 2019-12-08 06:08:47
问题 I need to extract a bitmap from a PostScript file (.ppf). It is compressed with RLE and encoded with ASCIIHexEncode. I will call it from PHP. I wonder if there is an elegant way to do that. I don't want to reinvent wheel, but I would like to use existing libraries. Is there a way how to call compression filters from PostScript, Ghostscript or imagick? 回答1: You can write a PostScript program to run compression/decompression filters on input. So, if you have the bitmap data already extracted in

Postscript - forcing a text search

↘锁芯ラ 提交于 2019-12-07 00:25:30
Okay, I now "know" postscript, everything makes a lot more sense now. I've found that if I change the colour though it affects backgrounds in other areas, I now know that sc, SC, cs and CS are procedures: /cs { /pdfFillXform exch def dup /pdfFillCS exch def setcolorspace } def /CS { /pdfStrokeXform exch def dup /pdfStrokeCS exch def setcolorspace } def /sc { pdfLastFill not { pdfFillCS setcolorspace } if dup /pdfFill exch def aload pop pdfFillXform setcolor /pdfLastFill true def /pdfLastStroke false def } def /SC { pdfLastStroke not { pdfStrokeCS setcolorspace } if dup /pdfStroke exch def

PostScript String Token

痞子三分冷 提交于 2019-12-06 13:35:40
I have a loop that takes out each word in a string using token, then I want to be able to do computations on it like this: (1 2 add 3 4 add) But any way you code it i keep getting 7 add 2 1 I want it to be 7 3 This is what I am working with { %loop pstack (repl> )print flush (%lineedit)(r)file dup bytesavailable string readstring pop { token {}{exit}ifelse exch dup () eq {pop exec exit}if exec }loop }loop I would advise you to write stack comments at the end of each line. It really helps. { %loop pstack (repl> )print flush (%lineedit)(r)file % f dup bytesavailable string readstring pop % s {

How to resize an EPS file with free software or command line utility

£可爱£侵袭症+ 提交于 2019-12-06 12:14:56
问题 I use Matlab to generate EPS (Encapsulated PostScript) files. I would like to resize these files so they render at a different size than they are generated. I would like to specify the resized dimensions in inches or centimeters, ideally. Is there an option for doing this using free software or a command line utility? I am looking for something compatible with OSX, but would settle for Windows. I am aware of EPSViewer.org but it only works in pixels and constrains the dimensions to be

Thumbnail generation with Ghostscript rotates my device size definition for landscape pdf pages

三世轮回 提交于 2019-12-06 11:22:12
I want to use GS to generate thumbnails from pdf files. The thumbnail must fit a 90x120 pixel rectangle The image should not be rotated The image should be resized to fit the rectangle with keeping aspect ratio I use the following command: gswin32 -dPDFFitPage -dPARANOIDSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=0 -dDEVICEWIDTH=90 -dDEVICEHEIGHT=120 -dORIENT1=true -sDEVICE=jpeg -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sOutputFile=output.%d.jpg input.pdf Result: If I use some PDF with portrait pages like this example , which you can download, then the