Go to the first, previous, next, last section, table of contents.

9 Programming with the Library

a2ps offers to the programmer an access to its generating routines. This section documents the API.

But since this section is empty, or almost, if I were you, I would go in contrib/sample to see how it works...

9.1 Initialization and Closing of Calls to liba2ps

Function: struct a2ps_job * a2ps_job_new (void)
Build a new storage unit for the library.

Function: void a2ps_read_sys_config (struct a2ps_job * job)
Set job with the default settings defined in the configuration file of the system.

Function: void a2ps_read_config (struct a2ps_job * job, char * path, char * filename)
Set job with the default settings defined in the configuration file `path/filename'. path can be NULL, filename cannot.

9.2 Print Jobs

A print job should be seen as associated to a single output.

Function: void a2ps_open_output_session (struct a2ps_job * job)
Initialize job for a new print job.

Function: void a2ps_close_output_session (struct a2ps_job * job)
Closes the current print job, and sends the output.

9.3 File Jobs

A file job should be seen as a single input.

Function: void a2ps_new_input_session (struct a2ps_job * job, char * name)
Create and open a new file job in job. name can be NULL, in which case its name is defaulted to that of stdin.

Function: void a2ps_close_input_session (struct a2ps_job * job)
End the current input session.

9.4 Printing Functions

These are the functions to be used to send content to liba2ps.

Function: void a2ps_print_char (struct a2ps_job * job, unsigned char c, face_t face)
Print the char c in face in job.

Function: void a2ps_print_string (struct a2ps_job * job, unsigned char * string, face_t face)
Print the C string string in face in job.

Function: void a2ps_print_buffer (struct a2ps_job * job, unsigned char * buffer, size_t len, face_t face)
Print the len first characters contained in buffer with face into job.

Go to the first, previous, next, last section, table of contents.