2

Is it possible to create a tiff file from a postscript-file (created from a pdf-document with readable text and images) into a tiff file without the text and only the images?

There is a way to create a tiff with no images, but I don't know how to use that way for my task. I need it to generate two images from a postscript-file - the first one with the images only and the second one with the text only.

Since the text is drawn over the top of the image, simple clipping won't do the job.

Community
  • 1
  • 1
aaggss
  • 23
  • 3

2 Answers2

2

You can hack the text out by redefining the show operators to no-ops. Insert this after the %%Page comment line (where the page code really starts).

/show{pop}def
/ashow{3{pop}repeat}def
/widthshow{4{pop}repeat}def
/awidthshow{6{pop}repeat}def
/kshow{2{pop}repeat}def

/xshow{2{pop}repeat}def
/xyshow{2{pop}repeat}def
/yshow{2{pop}repeat}def
/glyphshow{pop}def
/cshow{2{pop}repeat}def

This will suppress all text-drawing operators. Edit: Now includes level 2 and 3 operators.

If you're trying to selectively suppress different kinds of elements, you may want to redefine only some of these operators. You can add % at the beginning of a line to comment-out a line of the code, keeping the full list intact (for future uses).

luser droog
  • 18,988
  • 3
  • 53
  • 105
  • Thank you for your help! Unfortunately it doesn't work. [Here is](http://dl.dropbox.com/u/16751380/1.ps) the postscript-file. – aaggss Apr 02 '13 at 09:17
  • I've edited to add a few more. Also, you should add more detail to the question to get it reopened. – luser droog Apr 02 '13 at 09:24
  • It really does work! Thank you very much! And wich operators should I redefine to hide boxes, lines and vector graphic? – aaggss Apr 02 '13 at 09:37
  • There are lots of operators that can be used for line drawing. Check the [PLRM](http://www.adobe.com/products/postscript/pdfs/PLRM.pdf) 8.1 Operator Summary, Painting Operators. At some point you're better off clipping out the elements you want, suppressing everything else. – luser droog Apr 02 '13 at 09:54
0

Another way to selectively suppress elements from a ps file is to use the powerful clipping mechanism.

144 288 72 72 rectclip % clip to a 1"x1" square 2" from the left, 4" from the bottom

Clip works with an arbitrary path. So you can even string together points in a connect-the-dots fashion to get the effect of a lasso-clip. Probably easiest if you print the image out and trace a grid to easily plot points for the trajectory.

100 100 moveto
200 200 lineto
300 100 lineto
500 500 lineto
200 700 lineto
closepath clip  % clip to a non-rectangular convex polygon

Clipping will suppress all drawing operations that fall outside of the clippath while the clipping path is in effect.

luser droog
  • 18,988
  • 3
  • 53
  • 105