Closed brodock closed 5 years ago
This example would create a PDF file:
/*
cc ex-gr.c -I/usr/local/gr/include -L/usr/local/gr/lib/ -lGR \
-Wl,-rpath,/usr/local/gr/lib
*/
#include <gr.h>
int main(void) {
double x[] = {0, 0.2, 0.4, 0.6, 0.8, 1.0};
double y[] = {0.3, 0.5, 0.4, 0.2, 0.6, 0.7};
gr_opengks();
gr_openws(1, "ex-gr.pdf", 102);
gr_activatews(1);
gr_polyline(6, x, y);
gr_axes(gr_tick(0, 1), gr_tick(0, 1), 0, 0, 1, 1, -0.01);
gr_updatews();
gr_emergencyclosegks();
return 0;
}
I tried changing from 102
to 322
in order to output a PNG file, but got an error about lacking of Ghostscript support:
GKS: Ghostscript support not compiled in
That doesn't happen when I just use the gr_beginprint("file.png");
.
Am I missing some step here?
Please use 140 (corresponds to a PNG created thru CairoGraphics) - the workstation types are described here.
that worded fine, thanks :)
I was trying to figure out how to run with the C API in "headless" mode. I want to use it only to output image files, not to render to the screen.
So far what I managed to do is run the compiled code with :
Is there a way to open/close something in C that will set this with code?
the
gr_openws()
seems to be the most obvious place but documentation is not clear how to use it.