Hello, All:

I have a question about printing, specifically about discovering print capabilities. My code first:
Qt Code:
  1. int numPrinters = QPrinterInfo::availablePrinters().size();
  2. qDebug() << "Number of Printers=" << numPrinters;
  3. for( int i=0; i<numPrinters; ++i )
  4. {
  5. qDebug() << "Printer " << i << " name=" << QPrinterInfo::availablePrinters().at(i).printerName();
  6. QList<QPrinter::PaperSize> paperSizes = QPrinterInfo::availablePrinters().at(i).supportedPaperSizes();
  7. int numPapers = paperSizes.size();
  8. qDebug() << " numPapers=" << numPapers;
  9. QString temp;
  10. for( int j=0; j<numPapers; ++j)
  11. {
  12. QPrinter::PaperSize paper = paperSizes.at(j);
  13. temp += QString("%1 ").arg(paper);
  14. }
  15. qDebug() << " ->" << temp;
  16. }
To copy to clipboard, switch view to plain text mode 
And I get the following output (truncated to just one printer):
Qt Code:
  1. Number of Printers= 9
  2. Printer 0 name= "Microsoft XPS Document Writer"
  3. numPapers= 106
  4. -> "2 2 29 28 3 30 4 8 0 0 9 19 1 27 30 30 30 30 30 25 30 30 30 30 30 30 26 30 24 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 2 3 0 2 0 2 0 8 2 0 9 1 8 9 1 7 8 8 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 "
To copy to clipboard, switch view to plain text mode 
My first question is why is the paperSize duplicated to much? I can understand the "30", which refers to Custom, but why is "2" repeated 6 times? My second question is how to specify to the system which, eg, "2" or "30" I'm referring to? My third question how to query the specific page size for its actual size? I want to show the user the available print area. My last question is what is the best practice with respect to finding printer capabilities? Is there another way to get this information?

Thank you,
Eric.