#include <QApplication>
#include <QPrinter>
#include <QPrintDialog>
#include <QPainter>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QPrinter prn(QPrinter::HighResolution);
prn.setPageMargins(20,20,20,20,QPrinter::Millimeter);
prn.setPageSize(QPrinter::A4);
QPrintDialog pd(&prn, 0);
if(pd.exec()==QPrintDialog::Accepted){
QPainter p(&prn);
p.setPen(QPen(Qt::black, 2));
p.drawRect(prn.pageRect());
p.end();
}
return 0;
}
I2luY2x1ZGUgPFFBcHBsaWNhdGlvbj4KI2luY2x1ZGUgPFFQcmludGVyPgojaW5jbHVkZSA8UVByaW50RGlhbG9nPgojaW5jbHVkZSA8UVBhaW50ZXI+CgppbnQgbWFpbihpbnQgYXJnYywgY2hhciAqYXJndltdKQp7CiAgICBRQXBwbGljYXRpb24gYShhcmdjLCBhcmd2KTsKCiAgICBRUHJpbnRlciBwcm4oUVByaW50ZXI6OkhpZ2hSZXNvbHV0aW9uKTsKICAgIHBybi5zZXRQYWdlTWFyZ2lucygyMCwyMCwyMCwyMCxRUHJpbnRlcjo6TWlsbGltZXRlcik7CiAgICBwcm4uc2V0UGFnZVNpemUoUVByaW50ZXI6OkE0KTsKICAgIFFQcmludERpYWxvZyBwZCgmcHJuLCAwKTsKICAgIGlmKHBkLmV4ZWMoKT09UVByaW50RGlhbG9nOjpBY2NlcHRlZCl7CiAgICAgICAgUVBhaW50ZXIgcCgmcHJuKTsKICAgICAgICBwLnNldFBlbihRUGVuKFF0OjpibGFjaywgMikpOwogICAgICAgIHAuZHJhd1JlY3QocHJuLnBhZ2VSZWN0KCkpOwogICAgICAgIHAuZW5kKCk7CiAgICB9CgogICAgcmV0dXJuIDA7Cn0K