void ViewCurve::print_to_printer()
{
printer.
setOutputFormat(QPrinter::NativeFormat);
printer.
setOrientation(QPrinter::Landscape);
printer.setFullPage(FALSE);
printer.setCreator("Printertest");
// printf("resolution is %i\n", printer.resolution());
// printf("width is %i\n", printer.pageRect().width());
// printf("height is %i\n", printer.pageRect().height());
// printer.setResolution((int)((double)width() / 10.6));
#ifndef WIN32
// printer.setPrintProgram("lpr");
#endif
printerdialog.setWindowTitle("Print");
if(printerdialog.
exec()==QDialog::Accepted) {
drawCurve(&paint);
}
}
void ViewCurve::print_to_postscript()
{
// double width_factor;
fchooser.setConfirmOverwrite(1);
fchooser.setWindowTitle("Print to PostScript");
fchooser.setDefaultSuffix("ps");
#ifndef WIN32
fchooser.setDirectory(getenv("HOME"));
#endif
fchooser.setFilter("PostScript files (*.ps *.PS)");
fchooser.selectFile("printertest.ps");
if(!(fchooser.
exec() == QDialog::Accepted)) {
return;
}
fileNames = fchooser.selectedFiles();
printer.
setOutputFormat(QPrinter::PostScriptFormat);
printer.
setOrientation(QPrinter::Landscape);
printer.setOutputFileName(fileNames.at(0));
// printer.setResolution((int)((double)width() / 10.6));
// printf("resolution is %i\n", printer.resolution());
// printf("width is %i\n", printer.pageRect().width());
// printf("height is %i\n", printer.pageRect().height());
// width_factor = ((double)printer.pageRect().width()) / ((double)width());
// drawCurve(&paint, printer.pageRect().width(), printer.pageRect().height(), width_factor);
drawCurve(&paint);
}
void ViewCurve::print_to_pdf()
{
fchooser.setConfirmOverwrite(1);
fchooser.setWindowTitle("Print to PDF");
fchooser.setDefaultSuffix("pdf");
#ifndef WIN32
fchooser.setDirectory(getenv("HOME"));
#endif
fchooser.setFilter("PDF files (*.pdf *.PDF)");
fchooser.selectFile("printertest.pdf");
if(!(fchooser.
exec() == QDialog::Accepted)) {
return;
}
fileNames = fchooser.selectedFiles();
printer.
setOutputFormat(QPrinter::PdfFormat);
printer.setOutputFileName(fileNames.at(0));
printer.
setOrientation(QPrinter::Landscape);
// printer.setResolution((int)((double)width() / 10.6));
drawCurve(&paint);
}