[gs-devel] Asking for a application oriented API for libgs

Albert Astals Cid aacid at kde.org
Fri Jul 6 09:25:26 PDT 2007


Hi, i am one of the KDE[1] people working on okular[2], the KDE4 document 
viewer. 

We are using libgs instead of gs because we think using a library is much 
better than a binary.

The problem is that libgs API [3] is much more oriented to writing a ps 
interpreter than oriented to what a viewer application needs. Or at least 
that's my opinion as a viewer developer ;-)

What we would like to have is something like:
* Document *openDocument(char *filename);
* int getNumberOfPages(Document *doc);
* void getPageSize(Document *doc, int page, int *width, int *height);  // 
width and height as return values
* unsigned char *getImage(Document *doc, int page);
* some minor methods to set antialias, use local fonts, etc.

For getting images we are just using the unsigned char * that comes in the 
display_size callback.

For number of pages, we are using a parser that gets the "%%Pages:" stuff. 
That is easy :-)

The actual problem is knowing the page size. The problem exists because we 
need to know the page size before the actual rendering of the page to 
allocate the space in the page area, if not we could just use also the values 
that come with the display_size callback.

Is there any possibility of you adding that layer over the current libgs API 
or you instructing me how to get the size of the pages before rendering them, 
or maybe "rendering" them in a "fake" backend so i can get the sizes but it 
does not do the actual rendering so it's fast?

Any suggestion and comment will be appreciated.

Thanks a lot,
  Albert

[1] http://www.kde.org
[2] http://www.okular.org/
[3] http://pages.cs.wisc.edu/~ghost/doc/cvs/API.htm



More information about the gs-devel mailing list