Hi,

I'm trying to set the paper size of a QPrinter but I'm having an issue.
The printer I'm using is a photo printer (mitsubishi cp9550dw) and it supports photo strips. I'm trying to set the paper size to the photo strip but it doesn't work, I can set it to all other values though.
When I list all the supported sizes I get this as a result.

QPageSize("9x13 (3.5x5")", key="Custom.258x377", 258x377pt, id=30)
QPageSize("10x15 (4x6")", key="Custom.295x448", 295x448pt, id=30)
QPageSize("13x18 (5x7")", key="Custom.377x510", 377x510pt, id=30)
QPageSize("15x20 (6x8")", key="Custom.448x581", 448x581pt, id=30)
QPageSize("15x21 (6x8.5")", key="Custom.448x615", 448x615pt, id=30)
QPageSize("15x23 (6x9")", key="Custom.448x652", 448x652pt, id=30)
QPageSize("5x15x2 Type1(2x6"x2)", key="Custom.295x448", 295x448pt, id=30)
QPageSize("5x15x2 Type2(2x6"x2)", key="Custom.147x448", 147x448pt, id=30)

As you can see They all have a different keys except the two in Bold. I thing what's happening is that when I call printer->setPageSize(pageSize);, It looks in a table and selects the first match of the key which is a regular photo and not the photo strip I want. The dimensions are the same but the photostrip gets cut in half, wich isn't happening because of this issue.


Any ideas on how to fix this? Is there another way to change the paper size?

Code:

Qt Code:
  1. QPrinter *printer;
  2. QPrinterInfo _pinfo;
  3.  
  4. QList<QPrinterInfo> printers = QPrinterInfo::availablePrinters();
  5. foreach (const QPrinterInfo &printerInfo, printers){
  6. if( printerInfo.description() == _printer_name ){
  7. printer = new QPrinter(printerInfo);
  8. _pinfo = printerInfo;
  9. }
  10. }
  11. QList<QPageSize> sizes = _pinfo.supportedPageSizes();
  12. qDebug() << printer->paperName();
  13. qDebug() << _paper_name;
  14. foreach (const QPageSize &pageSize, sizes){
  15. qDebug() << pageSize;// + ", "+pageSize.key() + ", "+pageSize.id() + ", "+pageSize.isValid();
  16. if( pageSize.name() == _paper_name ){
  17. printer->setPageSize(pageSize);
  18. qDebug() << "set paper size to " + pageSize.name()<<" -> "<< printer->paperName();
  19. }
  20. }
To copy to clipboard, switch view to plain text mode