mptopdf: produces PDF with 'unknown operator' error
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)
Sanjoy Mahajan wrote:
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
You should up- or downgrade your MetaPost installation. Since 0.980 or so, the PostsScript shortcuts have different names. ConTeXt depends on them either using the new names, or being absent altogether. Best, taco
Thanks, that was the problem. I was at mpost 0.970 and with 0.993 the problem vanished. Another problem appeared, which is that pdftk segfaults when uncompressing the new pdf file, but I'll track that down and report it to the pdftk authors. mpost now says it is 0.993. But mpost -v says 0.992. There are a few spots in the source code with 0.992 strings. To find them: find -type f | xargs grep -I '\<0\.99[23]\>' Not sure which are spurious and which need changing. Also, I updated the update-tetex.make. Here's a diff and also the new version is attached. Before running it, I removed the /usr/share/texmf/web2c/mp.pool that the older version of the makefile had installed on the last mpost upgrade; otherwise it would shadow the proper tetex location in /usr/share/texmf-tetex/web2c/. After running it, I did a 'texexec --make --all' (as me) to make sure that my per-user ConTeXt installation knew all about the new metapost. Someday I'll make the latest and greatest ConTeXt a systemwide install. -Sanjoy diff -r d66d0f7eae60 update-tetex.make --- a/update-tetex.make Sun Dec 31 10:37:47 2006 -0700 +++ b/update-tetex.make Sun Dec 31 10:50:22 2006 -0700 @@ -1,18 +1,23 @@ -# For installing mp 0.901 over the tetex-3.0 files (mp 0.641) +# For installing latest mp over the tetex-3.0 equivalents (mp 0.641) .PHONY: install install-exec install-pool install-mplib INSTALL := rsync -ptv -edir1 := metapost-0.901/build/texk/web2c +# directories where the generated executables are put +edir1 := build/texk/web2c edir2 := $(edir1)/mpware +execs := $(edir1)/mpost $(edir1)/dvitomp +execs += $(edir2)/dmp $(edir2)/mpto $(edir2)/newer $(edir2)/makempx + +pool := $(edir1)/mp.pool install: install-exec install-pool install-mplib - fmtutil-sys --refresh + fmtutil-sys --all -install-exec: $(edir1)/mpost $(edir1)/dvitomp $(edir2)/dmp $(edir2)/mpto $(edir2)/newer $(edir2)/makempx +install-exec: $(execs) $(INSTALL) $^ /usr/bin/ -install-pool: $(edir1)/mp.pool - $(INSTALL) $^ /usr/share/texmf/web2c/ -install-mplib: - $(INSTALL) -r metapost-0.901/texmf/metapost /usr/share/texmf-tetex/ +install-pool: $(pool) + $(INSTALL) $^ /usr/share/texmf-tetex/web2c/ +install-mplib: + $(INSTALL) -r texmf/metapost /usr/share/texmf-tetex/ -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) # For installing latest mp over the tetex-3.0 equivalents (mp 0.641) .PHONY: install install-exec install-pool install-mplib INSTALL := rsync -ptv # directories where the generated executables are put edir1 := build/texk/web2c edir2 := $(edir1)/mpware execs := $(edir1)/mpost $(edir1)/dvitomp execs += $(edir2)/dmp $(edir2)/mpto $(edir2)/newer $(edir2)/makempx pool := $(edir1)/mp.pool install: install-exec install-pool install-mplib fmtutil-sys --all install-exec: $(execs) $(INSTALL) $^ /usr/bin/ install-pool: $(pool) $(INSTALL) $^ /usr/share/texmf-tetex/web2c/ install-mplib: $(INSTALL) -r texmf/metapost /usr/share/texmf-tetex/
Sanjoy Mahajan wrote:
Thanks, that was the problem. I was at mpost 0.970 and with 0.993 the problem vanished. Another problem appeared, which is that pdftk segfaults when uncompressing the new pdf file, but I'll track that down and report it to the pdftk authors.
mpost now says it is 0.993. But mpost -v says 0.992. There are a few spots in the source code with 0.992 strings. To find them:
find -type f | xargs grep -I '\<0\.99[23]\>'
Not sure which are spurious and which need changing.
The problem is that there is this independant C file that is used by web2c for the messages created by --version, and I keep forgetting to update that thing. Thanks for the warning.
Also, I updated the update-tetex.make. Here's a diff and also the new version is attached.
Before running it, I removed the /usr/share/texmf/web2c/mp.pool that the older version of the makefile had installed on the last mpost upgrade;
Just delete the thing completely. The pool file is only needed during the creation of the mpost executable proper, never afterwards. There is absolutely no need to install it anywhere. Best wishes, Taco
[mp.pool] Just delete the thing completely. The pool file is only needed during the creation of the mpost executable proper, never afterwards.
Thanks, that explains it. I thought I remembered a line in the docs about the new metapost not needing the pool file. But when I saw that pool file was generated, I figured better safe than sorry so I installed it anyway. Updated makefile attached that does not mention pool. -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) # For installing latest mp over the tetex-3.0 equivalents (mp 0.641) .PHONY: install install-exec install-mplib INSTALL := rsync -ptv # directories where the generated executables are put edir1 := build/texk/web2c edir2 := $(edir1)/mpware # executables to install execs := $(edir1)/mpost $(edir1)/dvitomp execs += $(edir2)/dmp $(edir2)/mpto $(edir2)/newer $(edir2)/makempx # the "fmtutil-sys --all" might be overkill install: install-exec install-mplib fmtutil-sys --all install-exec: $(execs) $(INSTALL) $^ /usr/bin/ install-mplib: $(INSTALL) -r texmf/metapost /usr/share/texmf-tetex/
participants (2)
-
Sanjoy Mahajan
-
Taco Hoekwater