rkrug / plantuml

R package to build UML graphs using plantuml
https://rkrug.github.io/plantuml/index.html
GNU General Public License v3.0
76 stars 7 forks source link

Ghostscript error with knitr engine #17

Closed retorquere closed 4 years ago

retorquere commented 4 years ago

With this document: https://gist.github.com/bb8584b40032742b0c275405a7a0ba4a I get

GPL Ghostscript 9.52: Unrecoverable error, exit code 1
Error in grImport::PostScriptTrace(file = fn, outfilename = fnrgl) : 
  status 1 in running command 'gs -q -dBATCH -dNOPAUSE -dNOSAFER -sDEVICE=ps2write -sOutputFile=/dev/null -sstdout=/var/folders/4w/n0_41y251ld3zzgs_lx6gkq80000gn/T//RtmpAkSnIE/filebca53e1af1d.rgml /var/folders/4w/n0_41y251ld3zzgs_lx6gkq80000gn/T//RtmpAkSnIE/filebca57be3214a.ps'

If I remove the legend block, I see no error, but when running plantuml directly, I see no error with the legend.

retorquere commented 4 years ago

Also without the engine:

```{r cdm, echo=FALSE}
erd <- paste(readLines(here::here('ReaderDB/erd.plantuml')), collapse="\n")
erd <- plantuml::plantuml(erd)
plot(erd)
rkrug commented 4 years ago

This is caused by the way that the display is generated. It works, if you say plantuml.preview = FALSE.

retorquere commented 4 years ago

It does. But what about the one without the engine, where I call plot?

rkrug commented 4 years ago

Also without the engine:

```{r cdm, echo=FALSE}
erd <- paste(readLines(here::here('ReaderDB/erd.plantuml')), collapse="\n")
erd <- plantuml::plantuml(erd)
plot(erd)

Yes - as expected - well. - partly. The preview in the knit_engine is using vector = TRUE, and the default for plutons.plantuml is vector = FALSE. And Ghostscript is only used hewn using vectors. I should change to vector = FALSE in the preview.

It is a bug in the grImport::PostScriptTrace() function, or in Ghostscript..... or in plantuml, which is producing an not completely valid eps file.

retorquere commented 4 years ago

Is there something I can set currently that will knit-and-preview?

rkrug commented 4 years ago

No - give me a few minutes, and I will change the default.

rkrug commented 4 years ago

OK - in the dev branch - could you please test, if it works as expected and let me know?

rkrug commented 4 years ago

Wait - I will put it in master, as there are other changes in dev as well.

rkrug commented 4 years ago

It is in m aster - sorry.

retorquere commented 4 years ago

I've updated -- knitting works, but preview doesn't.

rkrug commented 4 years ago

Yup. Just realised it as well. I will look into it.

rkrug commented 4 years ago

OK - fix on master (and one dependency less). Please check if the preview is working and close this if it is.

retorquere commented 4 years ago

Works!

rkrug commented 4 years ago

Thanks.