IPB
>  Man Pages > Unix > FreeBSD 6.2 > Section 3 > libXp man page

libXp man page

Section 3 - FreeBSD 6.2 Man Pages

Other operating system man pages available here


Advanced Search

Hopefully, this page is exactly what you are looking for, but if not, you can always find further assistance on Unix/Linux Forum!


libXp(3Xp)		       XPRINT FUNCTIONS 		    libXp(3Xp)




NAME

       libXp - X Print Client Library


SYNOPSIS

       cc [ flag...  ] file...-lXp [ library...  ]
       #include <X11/extensions/Print.h>


DESCRIPTION

       libXp  provides	public	APIs to allow client applications to render to
       non-display devices.

       When an application wishes to print, it makes a display	connection  to
       the  X print server and asks to see the list of printers available with
       an XpGetPrinterList() request. Once  the  application  has  selected  a
       printer,  it  creates  and sets a print context using XpCreateContext()
       and XpSetContext().

       The Print Context represents the embodiment of the printer selected. It
       is  initialized	by the Xprint server at XpCreateContext() time to con-
       tain a printer's default capabilities, as well as, the  description  of
       its  overall  capabilties, and to maintain the state of settings on the
       printer, the state of rendering against the printer, and  the  rendered
       output.

       The  Print  Context  affects  how  the  DDX  driver  generates its page
       description language (PDL) and how the PDL is submitted to  a  spooler.
       The  print  context may also affect fonts and other elements in the dix
       layer of the X Print Server. The print contexts	can  be  shared  among
       processes.  Applications  can enlist the help of secondary processes to
       manipulate print options in the Print context rather than taking on the
       task directly.

       Once  an application has set options within the print context, it makes
       calls such as XpStartJob() to  delineate  jobs,	documents,  and  pages
       within a sequence of normal X calls.

       A  job  is  a collection of documents, where each document is in turn a
       collection of pages. When XpEndJob() is called, the  resulting  PDL  is
       either  sent  to a print spooler or can be retrieved by the application
       itself.

       The developer basically has to make changes to  the  X  application  to
       make use of the X Print Service.


       A  simple  X  application  supplemented with some of the libXp routines
       might look like this:




       #include <X11/Xlib.h>
       #include <X11/extensions/Print.h>

       main()
       {
	   Display *pdpy;
	   Screen *pscreen;
	   Window pwin;
	   XPPrinterList plist;
	   XPContext pcontext;
	   int plistCnt;
	   char *attrPool;
       #define NPOOLTYPES 5
	   XPAttributes poolType[NPOOLTYPES] = {XPJobAttr,XPDocAttr,XPPageAttr,
				 XPPrinterAttr,XPServerAttr};
	   int i;
	   unsigned short width, height;
	   XRectangle rect;
	   char *printServerName = ":1";
	   char *mylaser = "varos";

	   /*
	    * connect to the X print server
	    */
	   pdpy = XOpenDisplay( printServerName );

	   /*
	    * see if the printer "mylaser" is available
	    */

	   plist =  XpGetPrinterList (pdpy, mylaser, &plistCnt );

	   /*
	    * Initialize a print context representing "mylaser"
	    */

	   pcontext = XpCreateContext( pdpy, plist[0].name );
	   XpFreePrinterList( plist );

	    /*
	     * Possibly modify attributes in the print context
	     */
	   for(i=0;i < NPOOLTYPES;i++) {
	    if(attrPool = XpGetAttributes( pdpy, pcontext, poolType[i] )) {
		/* twiddle attributes */
		/*
		  XpSetAttributes( pdpy, pcontext, poolType[i],
				   attrPool, XPAttrMerge );
		*/
		XFree(attrPool);
	    }
	   }


	   /*
	    * Set a print server, then start a print job against it
	    */

	   XpSetContext( pdpy, pcontext );
	   XpStartJob( pdpy, XPSpool );

	   /*
	    * Generate the first page
	    */

	   pscreen = XpGetScreenOfContext( pdpy, pcontext );
	   XpGetPageDimensions( pdpy, pcontext, &width, &height,
		       &rect);
	   pwin = XCreateSimpleWindow( pdpy, RootWindowOfScreen( pscreen ),
			   rect.x, rect.y, rect.width, rect.height, 2,
			   BlackPixelOfScreen( pscreen),
			   WhitePixelOfScreen( pscreen));

	   XpStartPage( pdpy, pwin );
	   /* usual rendering stuff..... */
	   XpEndPage( pdpy );

	   XpStartPage( pdpy, pwin );
	   /* some more rendering.....	 */
	   XpEndPage( pdpy );

	   /*
	    * End the print job - the final results are sent by the X print
	    * server to the spooler sub system.
	    */

	   XpEndJob( pdpy );
	   XpDestroyContext( pdpy, pcontext );
	   XCloseDisplay( pdpy );
       }



SEE ALSO

       Xprt(1),  XpCreateContext(3Xp),	XpDestroyContext(3Xp),	XpEndJob(3Xp),
       XpEndPage(3Xp),	XpFreePrinterList(3Xp),  XpGetAttributes(3Xp),	XpGet-
       PageDimensions(3Xp),    XpGetPrinterList(3Xp),	 XpSetAttributes(3Xp),
       XpSetContext(3Xp), XpStartJob(3Xp), XpStartPage(3Xp)

       X Print Service Extension Library



X Version 11			 Version 6.9.0			    libXp(3Xp)


Man(1) output converted with man2html and wrapped by fishsponge

This page was generated on Wed Sep 19 20:25:10 BST 2007

Your favourite pages:

No pages logged yet.
Trying to save cookie...

Top 10 most popular pages:

CPAN man page (4210 hits)
(Suse Linux 10.1)

ssh man page (4117 hits)
(Suse Linux 10.1)

svn man page (2479 hits)
(FreeBSD 6.2)

adv_cap_autoneg man page (1782 hits)
(Solaris 10 11_06)

startproc man page (1711 hits)
(Suse Linux 10.1)

sqlite3 man page (1663 hits)
(openSUSE 10.2)

signal man page (1393 hits)
(Suse Linux 10.1)

pprosetup man page (1241 hits)
(Solaris 10 11_06)

netcat man page (1237 hits)
(Suse Linux 10.1)

ssh-socks5-proxy-connect man page (1126 hits)
(Solaris 10 11_06)

Useful Links

Go Back

Visitor Statistics


Valid XHTML 1.0 Transitional     Valid CSS!

Partners: Cambridge Plus :: Pyrenees Accomodation :: Touch Sensor Chip :: <Link Available>
Unix Man Pages / Linux Man Pages :: HiFi Forum :: SIP VoIP Phone & Provider Reviews :: UNIX/Linux Forum Archives

More info on advertising on Unix/Linux Forum