libpostscriptbarcode  0.20190805
C Library and Bindings for Barcode Writer in Pure PostScript
Typedefs | Functions
postscriptbarcode.h File Reference

BWIPP C Library API

Public API for libpostscriptbarcode - a C library providing a functional interface to Barcode Writer in Pure PostScript.

The basic workflow is to firstly initialise the library to obtain a BWIPP context by loading the BWIPP resources using either bwipp_load() or bwipp_load_from_file(). The context is provided as the first argument to all subsequent function calls. You can then query the available barcode families with bwipp_list_families() and list each family's members using bwipp_list_family_members() to obtain the list of all supported barcode symbologies. The available properties of each barcode symbology can be enumerated using bwipp_list_properties() and read with bwipp_get_property(). To create a PostScript document concatenate together your own PostScript prolog with the output of either bwipp_emit_required_resources() (minimal set of resources for a specific barcode symbology) or bwipp_emit_all_resources() and you own PostScript code interspersed with calls to bwipp_emit_exec() to render a barcode. Finally, all resources can be freed using bwipp_unload().

The library should be thread-safe provided that the calling code is limited to one thread per context until the resources for the context have finished loading.

Typedefs

typedef struct BWIPP BWIPP
 A BWIPP context.
 

Functions

BWIPPbwipp_load (void)
 Load the BWIPP resources by searching for barcode.ps in default locations. More...
 
BWIPPbwipp_load_from_file (const char *filename)
 Load the BWIPP resources from a given resource file. More...
 
void bwipp_unload (BWIPP *ctx)
 Unload the BWIPP resources. More...
 
const char * bwipp_get_version (BWIPP *ctx)
 Provide the version of BWIPP that has been loaded. More...
 
char * bwipp_emit_required_resources (BWIPP *ctx, const char *name)
 Provides the set of BWIPP resources required to generate a barcode of the specified type. More...
 
char * bwipp_emit_all_resources (BWIPP *ctx)
 Provides the complete set of BWIPP resources. More...
 
char * bwipp_emit_exec (BWIPP *ctx, const char *barcode, const char *contents, const char *options)
 Provide the PostScript code that invokes a barcode with given parameters. More...
 
unsigned short bwipp_list_families (BWIPP *ctx, char ***families)
 List all known barcode families. More...
 
char * bwipp_list_families_as_string (BWIPP *ctx)
 List all known barcode families as a comma seperated string. More...
 
unsigned short bwipp_list_family_members (BWIPP *ctx, char ***members, const char *family)
 List all members of a given barcode family. More...
 
char * bwipp_list_family_members_as_string (BWIPP *ctx, const char *family)
 List all members of a given barcode family as a comma seperated string. More...
 
unsigned short bwipp_list_properties (BWIPP *ctx, char ***properties, const char *barcode)
 List all properties of a given barcode symbology. More...
 
char * bwipp_list_properties_as_string (BWIPP *ctx, const char *barcode)
 List all properties of a given barcode symbology as a comma seperated string. More...
 
const char * bwipp_get_property (BWIPP *ctx, const char *barcode, const char *property)
 Get the value of a given property of a given barcode symbology. More...
 
void bwipp_free (void *p)
 Free memory belonging to a BWIPP provided allocation. More...
 

Function Documentation

char* bwipp_emit_all_resources ( BWIPP ctx)

Provides the complete set of BWIPP resources.

Parameters
ctxBWIPP context.
Returns
A string containing the set of all PostScript resources, which the caller should release with bwipp_free().
char* bwipp_emit_exec ( BWIPP ctx,
const char *  barcode,
const char *  contents,
const char *  options 
)

Provide the PostScript code that invokes a barcode with given parameters.

Parameters
ctxBWIPP context.
barcodeThe type of barcode.
contentsThe contents of the barcode.
optionsThe formatting options for the barcode.
Returns
The PostScript code that invokes the barcode, which the caller should release with bwipp_free().
char* bwipp_emit_required_resources ( BWIPP ctx,
const char *  name 
)

Provides the set of BWIPP resources required to generate a barcode of the specified type.

Parameters
ctxBWIPP context.
namePath to the barcode.ps resources file.
Returns
A string containing a set of PostScript resources, which the caller should release with bwipp_free().
void bwipp_free ( void *  p)

Free memory belonging to a BWIPP provided allocation.

Parameters
pPointer to memory to free.
const char* bwipp_get_property ( BWIPP ctx,
const char *  barcode,
const char *  property 
)

Get the value of a given property of a given barcode symbology.

Parameters
ctxBWIPP context.
barcodeThe type of barcode symbology.
propertyThe name of the property to query.
Returns
The value of the given property.
const char* bwipp_get_version ( BWIPP ctx)

Provide the version of BWIPP that has been loaded.

Parameters
ctxBWIPP context.
Returns
A string containing the version.
unsigned short bwipp_list_families ( BWIPP ctx,
char ***  families 
)

List all known barcode families.

Parameters
ctxBWIPP context.
familiesReturns list of all barcode families by reference, which the caller should release with bwipp_free().
Returns
Number of barcode families returned.
char* bwipp_list_families_as_string ( BWIPP ctx)

List all known barcode families as a comma seperated string.

Parameters
ctxBWIPP context.
Returns
A comma seperated list of all barcode families, which the caller should release with bwipp_free().
unsigned short bwipp_list_family_members ( BWIPP ctx,
char ***  members,
const char *  family 
)

List all members of a given barcode family.

Parameters
ctxBWIPP context.
membersReturns list of all barcode family members by reference, which the caller should release with bwipp_free().
familyThe name of a barcode family.
Returns
Number of barcode family members returned.
char* bwipp_list_family_members_as_string ( BWIPP ctx,
const char *  family 
)

List all members of a given barcode family as a comma seperated string.

Parameters
ctxBWIPP context.
familyThe name of a barcode family.
Returns
A comma seperated list of all barcode family members, which the caller should release with bwipp_free().
unsigned short bwipp_list_properties ( BWIPP ctx,
char ***  properties,
const char *  barcode 
)

List all properties of a given barcode symbology.

Parameters
ctxBWIPP context.
propertiesReturns list of all barcode properties by reference, which the caller should release with bwipp_free().
barcodeThe type of barcode symbology.
Returns
Number of properties returned.
char* bwipp_list_properties_as_string ( BWIPP ctx,
const char *  barcode 
)

List all properties of a given barcode symbology as a comma seperated string.

Parameters
ctxBWIPP context.
barcodeThe type of barcode symbology.
Returns
A comma seperated list of all barcode properties, which the caller should release with bwipp_free().
BWIPP* bwipp_load ( void  )

Load the BWIPP resources by searching for barcode.ps in default locations.

Returns
BWIPP context on success, else NULL.
BWIPP* bwipp_load_from_file ( const char *  filename)

Load the BWIPP resources from a given resource file.

Parameters
filenamePath to the barcode.ps resources file.
Returns
BWIPP context on success, else NULL.
void bwipp_unload ( BWIPP ctx)

Unload the BWIPP resources.

Parameters
ctxBWIPP context.
Returns
Void.