[Kst] branches/work/kst/portto4/kst/src/libkstapp

Barth Netterfield netterfield at astro.utoronto.ca
Fri Apr 8 14:57:25 CEST 2011


SVN commit 1227395 by netterfield:

Implement vector export to eps and export to pdf.


 M  +9 -4      exportgraphicsdialog.cpp  
 M  +22 -0     mainwindow.cpp  


--- branches/work/kst/portto4/kst/src/libkstapp/exportgraphicsdialog.cpp #1227394:1227395
@@ -63,16 +63,21 @@
 void ExportGraphicsDialog::updateFormats() {
   QStringList formats;// = QPictureIO::outputFormats();
 
-  if (_listVectorFormats->isChecked()) {
-    formats.append(QString("svg"));
-  }
-
   if (_listBitmapFormats->isChecked()) {
     foreach(QByteArray array, QImageWriter::supportedImageFormats()) {
       formats.append(QString(array));
     }
+    formats.removeAll(QString("eps"));
+    formats.removeAll(QString("EPS"));
   }
 
+  if (_listVectorFormats->isChecked()) {
+    formats.append(QString("svg"));
+    formats.append(QString("eps"));
+    formats.append(QString("pdf"));
+  }
+
+
   _comboBoxFormats->clear();
   _comboBoxFormats->addItems(formats);
 
--- branches/work/kst/portto4/kst/src/libkstapp/mainwindow.cpp #1227394:1227395
@@ -478,6 +478,28 @@
       view->processResize(currentSize);
 
 
+    } else if (format == QString("eps")) {
+      QPrinter printer(QPrinter::ScreenResolution);
+      printer.setOutputFormat(QPrinter::PostScriptFormat);
+      printer.setOutputFileName(file);
+      setPrinterDefaults(&printer);
+
+      printer.setPrintRange(QPrinter::CurrentPage);
+
+      printer.setPaperSize(size, QPrinter::DevicePixel);
+      printToPrinter(&printer);
+
+    } else if (format == QString("pdf")) {
+      QPrinter printer(QPrinter::ScreenResolution);
+      printer.setOutputFormat(QPrinter::PdfFormat);
+      printer.setOutputFileName(file);
+      setPrinterDefaults(&printer);
+
+      printer.setPrintRange(QPrinter::CurrentPage);
+
+      printer.setPaperSize(size, QPrinter::DevicePixel);
+      printToPrinter(&printer);
+
     } else {
       QPainter painter;
       QImage image(size, QImage::Format_ARGB32);


More information about the Kst mailing list