0

I'm trying to figure out what kind of language and how can I read/convert the following graphic object found inside a pdf

q
0 869 634 -869 re
W n
0 0.9 0.85 0 K
/GS0 gs
q 1 0 0 1 319 606 cm
0 0 m
0 -53.02 -42.98 -96 -96 -96 c
-149.02 -96 -192 -53.02 -192 0 c
-192 53.02 -149.02 96 -96 96 c
-42.98 96 0 53.02 0 0 c
h
S
Q

those seem postfix instructions but I don't know what they are. Can somebody shed some light on it?

David van Driessche
  • 6,602
  • 2
  • 28
  • 41
Dean
  • 6,610
  • 6
  • 40
  • 90

1 Answers1

1

You need to check the Adobe PDF reference; what you have in there is just plain PDF code as can be found in any page description for a page in a PDF document. Download the PDF reference from the Adobe web site here: http://www.adobe.com/devnet/pdf/pdf_reference.html

Loosely translated, the piece of code you have, does the following

  • save graphics state
  • create rectangle
  • add rectangle to clipping path
  • set color to CMYK color
  • set graphics state GS0
  • set current transformation matrix
  • move to point 0, 0
  • add curve, add curve, add curve, add curve
  • close path
  • stroke path
  • restore graphics state
David van Driessche
  • 6,602
  • 2
  • 28
  • 41
  • Thanks, to build up a bit and avoid another question (I'll do it if needed though): any idea on how I could convert this series of instructions in svg or similar vector graphics image file? – Dean Nov 04 '15 at 16:21
  • You would basically have to parse each instruction and convert it into the appropriate instruction for SVG or similar. I'm not super familiar with SVG but I know it's supposedly very close to the PDF imaging model so converting to that should be easy (SVG is XML so it won't be trivial, but closeness of the graphics models does help) – David van Driessche Nov 04 '15 at 17:27
  • See also this question for example: http://stackoverflow.com/questions/10288065/convert-pdf-to-clean-svg – David van Driessche Nov 04 '15 at 17:28