[dev-context] mptopdf: produces PDF with 'unknown operator' error
Sanjoy Mahajan
sanjoy at mrao.cam.ac.uk
Sat Dec 30 20:23:36 CET 2006
The following test file (included in the attached .zip) produces errors
when test.pdf is viewed in xpdf (v3.0):
Error (1004): Unknown operator 'D'
Error (1006): Too few (0) args to 'J' operator
=================== begin: test.tex ==================
% xpdf error:
% Error (1004): Unknown operator 'D'
% Error (1006): Too few (0) args to 'J' operator
\pdfcompresslevel=0
\defineoverlay [foregraphics] [\positionoverlay{foregraphics}]
\setupbackgrounds
[page]
[background={foreground,foregraphics}]
\starttext
\hpos{r13}{4}
\hpos{r23}{7} \quad \hpos{r24}{11}
\startMPpositiongraphic{mypos:line}
path pa, pb, pab ; numeric na, nb ;
initialize_box(\MPpos{\MPvar{from}}) ;
na := nxy ; pa := llxy..lrxy..urxy..ulxy..cycle ;
initialize_box(\MPpos{\MPvar{to}}) ;
nb := nxy ; pb := llxy..lrxy..urxy..ulxy..cycle ;
if na=nb :
pab := center pa -- center pb ;
pab := pab cutbefore (pab intersectionpoint pa) ;
pab := pab cutafter (pab intersectionpoint pb) ;
pickup pencircle scaled 1pt ;
draw pab withcolor .625yellow ;
anchor_box(\MPanchor{\MPvar{from}}) ;
fi ;
\stopMPpositiongraphic
\startpositionoverlay{foregraphics}
\setMPpositiongraphic{r13}{mypos:line}{to=r24}
\setMPpositiongraphic{r23}{mypos:line}{to=r24}
\stoppositionoverlay
hi
\stoptext
=================== end: test.tex ==================
The simplest way to see the problem is to convert the intermediate EPS
graphic to pdf by hand (with mptopdf), and that pdf file shows the same
problem. So I run the following to get an uncompressed pdf file:
texexec test.tex
mptopdf test-mpgraph.1
pdftk test-mpgraph-1.pdf output test-mpgraph-1-uncompressed.pdf uncompress
Then view either test-mpgraph-1.pdf or test-mpgraph-1-uncompressed.pdf
(in xpdf).
It's line 19 (" D J") in test-mpgraph-1-uncompressed.pdf that causes the
problem. The original eps file (test-mpgraph.1) has a definition for D,
which I think is "/D{[] 0 setdash}bd" (if I parsed the postscript
right). But the converted PDF doesn't know the definition. Which may
cause the J operator to have too few arguments.
The attached zip file has all the files that result from running the
above commands, including a (GNU) Makefile to reproduce the whole thing.
I'm using the 2006.12.27 version of ConTeXt, with mptopdf 1.3.2, on
Ubuntu Linux (tetex 3.0, xpdf 3.0).
The files display correctly despite the warnings, but a more complex
example (from which this came) has misplaced connecting lines. I don't
know if it is caused by these operator problems. However, I figured
it's worth worrying about this simpler case first, and only then seeing
what problems remain in the more complex example.
-Sanjoy
`A nation of slaves is always prepared to applaud the clemency of their
master who, in the abuse of absolute power, does not proceed to the
last extremes of injustice and oppression.' (Gibbon)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: unknown-operator.zip
Type: application/x-zip
Size: 33123 bytes
Desc: test and resulting files
URL: <http://mailman.ntg.nl/pipermail/dev-context/attachments/20061230/7d8f8da1/attachment.bin>
More information about the dev-context
mailing list