2013-09-25 80 views
0

這是我目前的方法,不能按預期工作。它只在所有三種情況下打印單面。什麼是通過libcups以編程方式打印雙工的正確方法?

#include <cups/cups.h> 

int main(int argc, char *argv[]) 
{ 
cupsSetUser("myuser"); 
cups_dest_t *defaultP = cupsGetDest (NULL, NULL,num_dests,dests); 

int jobid; 
int num_options = 0; 
cups_option_t *options=NULL; 

//SIMPLEX 
num_options = cupsAddOption ("Duplex", "None",num_options,&options); 
jobid = cupsPrintFile(defaultP->name,"/home/myuser/work/TEST.ps","Test Print SIMPLEX", 
         defaultP->num_options,defaultP->options); 
num_options = cupsRemoveOption("Duplex",num_options,&options); 

//DUPLEX Long Edge 
num_options = cupsAddOption ("Duplex", "DuplexNoTumble",num_options,&options); 
jobid = cupsPrintFile(defaultP->name,"/home/myuser/work/TEST.ps","Test Print DUPLEX Long Edge ", 
         defaultP->num_options,defaultP->options); 
num_options = cupsRemoveOption("Duplex",num_options,&options); 

//DUPLEX Short Edge 
num_options = cupsAddOption ("Duplex", "DuplexTumble",num_options,&options); 
jobid = cupsPrintFile(defaultP->name,"/home/myuser/work/TEST.ps","Test Print DUPLEX Short Edge ", 
         defaultP->num_options,defaultP->options); 
num_options = cupsRemoveOption("Duplex",num_options,&options); 
} 

回答

1

這是正確的方法。每個cupsPrintFile(...)的第二行有錯誤的參數。應該是num_options, &options而不是defaultP->num_options,defaultP->options

相關問題