Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

xmprinttofile(3) [hpux man page]

XmPrintToFile(library call)											       XmPrintToFile(library call)

NAME
XmPrintToFile -- Retrieves and saves data that would normally be printed by the X Print Server. SYNOPSIS
#include <Xm/Print.h> XtEnumXmPrintToFile( Display*dpy, Stringfilename, XPFinishProcfinish_proc, XtPointerclient_data); DESCRIPTION
XmPrintToFile hides the details of X display connection and XpGetDocumentData to the Motif application programmer. This function is a convenience routine that hides the details of the X and Xp internals to the application programmer by calling the XpGet- DocumentData function with appropriate save and finish callbacks. This is used in the context of X Printing when the user has specified the "print-to-file" option from a regular Print Setup Dialog box. XmPrintToFile first tries to open the given filename for writing and returns False if it can't. Else, it uses XpGetDocumentData, giving it a save proc that writes the data received in the file and a finish proc that closes the file or removes it on an unsuccessful termination. It calls finish_proc at that point, passing it the argument received from the Xp layer (status == XPGetDocFinished means the file is valid and was closed, otherwise the file was removed). XmPrintToFile is non-blocking; if it returns successfully, it just means the file was opened successfully, not that all the data was received. dpy Print display connection. filename Name of the file to put the print data in. finish_proc Called when all the data has been received. client_data Passed with the finish_proc. RETURN VALUE
Returns False if the filename could not be created or opened for writing, True otherwise. ERRORS
/WARNINGS Not applicable EXAMPLES
A typical OK callback from a DtPrintSetupBox: PrintOKCallback(widget...) /*-------------*/ { int save_data = XPSpool; pshell = XmPrintSetup (widget, pbs->print_screen, "Print", NULL, 0); XtAddCallback(pshell, XmNstartJobCallback, startJobCB, data); if (pbs->destination == DtPRINT_TO_FILE) save_data = XPGetData; /* start job must precede XpGetDocumentData in XmPrintToFile */ XpStartJob(XtDisplay(pshell), save_data); XFlush(XtDisplay(pshell)); /* maintain the sequence between startjob and getdocument */ /* setup print to file */ if (pbs->destination == DtPRINT_TO_FILE) XmPrintToFile(XtDisplay(pshell), pbs->dest_info, FinishPrintToFile, NULL); } } static void startJobCB(Widget, XtPointer call_data, XtPointer client_data) { print(p); /* rendering happens here */ XpEndJob(XtDisplay(p->print_shell)); /* clean up */ XtDestroyWidget(p->print_shell); XtCloseDisplay(XtDisplay(p->print_shell)); } SEE ALSO
XmPrintSetup(3), XmPrintShell(3), XmRedisplayWidget(3), XmPrintPopupPDM(3) XmPrintToFile(library call)

Check Out this Related Man Page

XmPrintSetup(library call)												XmPrintSetup(library call)

NAME
XmPrintSetup -- setup and create a Print Shell widget SYNOPSIS
#include <Xm/Print.h> Widget XmPrintSetup( Widget video_widget, Screen *print_screen, String print_shell_name, ArgList args, Cardinal num_args); DESCRIPTION
A function that does the appropriate setting and creates a realized XmPrintShell that it returns to the caller. This function hides the details of the Xt to set up a valid print shell heirarchy for the application. It is also meant to encourage consistency in the way appli- cations root their print widget hierarchy. print_screen must belong to a Display connection that has already been initialized with Xt. The video_widget is used to get at the application context, application name and class, and argc/argv stored on the applicationShell that roots this widget. If no applicationShell is found, NULL argv/argc are used. XmPrintSetup then creates an unrealized ApplicationShell with the same name and class as the one given by the video display, on the print display and on the print screen specified. An XmPrintShell is then created as a child of this toplevel shell, using XtCreatePopupShell, with the name print_shell_name, and using the args provided. It then realizes and maps the print shell, using XtPopup with XtGrabNone. This way, application resource files and users can specify print specific attributes using the following syntax (if print_shell_name is "Print"): Dtpad.Print*textFontList: somefont *Print*background:white *Print*highlightThickness:0 video_widget A video widget to fetch app video data from. print_screen A print screen on the print display - specifies the screen onto which the new shell is created. print_shell_name Specifies the name of the XmPrintShell created on the X Print server. args Specifies the argument list from which to get the resources for the XmPrintShell. num_args Specifies the number of arguments in the argument list. RETURN VALUE
The id the XmPrintShell widget created on the X Print Server connection, or NULL if an error has occured. ERRORS
/WARNINGS None. EXAMPLES
From the OK callback and the SetUp callback of the primary print dialog widget: static void printOKCB(Widget, XtPointer call_data, XtPointer client_data) { AppPrint *p = (AppPrint *) client_data; DtPrintSetupCallbackStruct *pbs = (XmPrintCallbackStruct *) call_data; /* connect if not already done. the print dialog callback always provides valid printer name, print display and screen already initialized: XpInitContext called */ */ p->print_shell = XmPrintSetup (widget, pbs->print_screen, "Print", NULL, 0); ... } SEE ALSO
XmPrintShell(3), XmRedisplayWidget(3), XmPrintToFile(3), XmPrintPopupPDM(3) XmPrintSetup(library call)
Man Page