LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Change print attributes with (ATTR_EJECT_AFTER, 0)

I am trying to print two text buffers with different print attributes on one page. If I don't use ATTR_EJECT_AFTER, then my printing formats and prints fine but on two separate pages. If I use (ATTR_EJECT_AFTER, 0) then it seems I cannot set the attributes for my second print function. Seems like I should be able to do this. Can't see what I'm doing wrong but then I'm brand new at this. Thanks.
 
/*****************************************************************************/
int CVICALLBACK Callback_Print_Button (int panel, int control, int event,
  void *callbackData, int eventData1, int eventData2)
{
 switch (event)
 {
  case EVENT_COMMIT:
   SetPrintAttribute (ATTR_EJECT_AFTER, 0);
   SetPrintAttribute (ATTR_PRINT_FONT_NAME, "Trebuchet MS");  
   SetPrintAttribute (ATTR_PRINT_POINT_SIZE, 24);
   SetPrintAttribute (ATTR_ORIENTATION, VAL_PORTRAIT);
   SetPrintAttribute (ATTR_PRINT_UNDERLINE, 1);
 
   Print_PassFail("PASS");
    
   SetPrintAttribute (ATTR_PRINT_FONT_NAME, "Trebuchet MS");  
   SetPrintAttribute (ATTR_PRINT_POINT_SIZE, 10);
   SetPrintAttribute (ATTR_ORIENTATION, VAL_LANDSCAPE);
   SetPrintAttribute (ATTR_PRINT_UNDERLINE, 0);
   
   Print_Label("W8413-3","0015",
    'D', '3', "kbrown", "10:31am", "10/26/2006");

   SetPrintAttribute (ATTR_EJECT_AFTER, 1);

   MessagePopup ("Debug Message","Print button pushed"); 
   break;
 }
 return 0;
}
/*****************************************************************************/
void Print_PassFail(char szPassFail[])
{
char szStr[500];
 sprintf(szStr,"  %s  ", szPassFail);
 PrintTextBuffer (szStr, "");
}
/*****************************************************************************/
/*****************************************************************************/
void Print_Label(char szProjectNbr[], char szSerialNbr[],
 char group, char code, char szOperator[],
 char szTestTime[], char szTestDate[])
{
char szStr[500];
char szTemp[100];
 sprintf(szStr,"Project:  %s\nSerial#  %s\n",szProjectNbr, szSerialNbr);
 sprintf(szTemp,"Group:  %c    Code:  %c\nTested By:  %s\n",group, code, szOperator);
 strcat(szStr,szTemp);
 sprintf(szTemp,"%s     %s\n",szTestTime, szTestDate);
 strcat(szStr,szTemp);
  
 PrintTextBuffer (szStr, "");
 }
/*****************************************************************************/
0 Kudos
Message 1 of 2
(2,925 Views)
If I'm not wrong, SetPrintAttribute (ATTR_EJECT_AFTER, xxx) must be set before PrintTextBuffer: when print is produced, that particular attribute is elaborated deciding wether to eject paper or not.


Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 2 of 2
(2,923 Views)