diff --git a/PdfForQtLib/sources/pdfrenderer.cpp b/PdfForQtLib/sources/pdfrenderer.cpp index 880021b..30719b2 100644 --- a/PdfForQtLib/sources/pdfrenderer.cpp +++ b/PdfForQtLib/sources/pdfrenderer.cpp @@ -336,4 +336,203 @@ void PDFRasterizer::releaseOpenGL() } } +PDFImageWriterSettings::PDFImageWriterSettings() +{ + m_formats = QImageWriter::supportedImageFormats(); + selectFormat(m_formats.front()); +} + +void PDFImageWriterSettings::selectFormat(const QByteArray& format) +{ + if (m_currentFormat != format) + { + m_currentFormat = format; + + QImageWriter writer; + writer.setFormat(format); + + m_compression = 0; + m_quality = 0; + m_gamma = 0; + m_optimizedWrite = false; + m_progressiveScanWrite = false; + m_subtypes = writer.supportedSubTypes(); + m_currentSubtype = !m_subtypes.isEmpty() ? m_subtypes.front() : QByteArray(); + + // Jakub Melka: init default values based on image handler. Unfortunately, + // image writer doesn't give us access to these values, so they are hardcoded. + if (format == "jpeg" || format == "jpg") + { + m_quality = 75; + m_optimizedWrite = false; + m_progressiveScanWrite = false; + } + else if (format == "png") + { + m_compression = 50; + m_quality = 50; + m_gamma = 0; + } + else if (format == "tif" || format == "tiff") + { + m_compression = 1; + } + else if (format == "webp") + { + m_quality = 75; + } + + m_supportedOptions.clear(); + for (QImageIOHandler::ImageOption imageOption : { QImageIOHandler::CompressionRatio, QImageIOHandler::Quality, + QImageIOHandler::Gamma, QImageIOHandler::OptimizedWrite, + QImageIOHandler::ProgressiveScanWrite, QImageIOHandler::SupportedSubTypes }) + { + if (writer.supportsOption(imageOption)) + { + m_supportedOptions.insert(imageOption); + } + } + } +} + +int PDFImageWriterSettings::getCompression() const +{ + return m_compression; +} + +void PDFImageWriterSettings::setCompression(int compression) +{ + m_compression = compression; +} + +int PDFImageWriterSettings::getQuality() const +{ + return m_quality; +} + +void PDFImageWriterSettings::setQuality(int quality) +{ + m_quality = quality; +} + +float PDFImageWriterSettings::getGamma() const +{ + return m_gamma; +} + +void PDFImageWriterSettings::setGamma(float gamma) +{ + m_gamma = gamma; +} + +bool PDFImageWriterSettings::hasOptimizedWrite() const +{ + return m_optimizedWrite; +} + +void PDFImageWriterSettings::setOptimizedWrite(bool optimizedWrite) +{ + m_optimizedWrite = optimizedWrite; +} + +bool PDFImageWriterSettings::hasProgressiveScanWrite() const +{ + return m_progressiveScanWrite; +} + +void PDFImageWriterSettings::setProgressiveScanWrite(bool progressiveScanWrite) +{ + m_progressiveScanWrite = progressiveScanWrite; +} + +QByteArray PDFImageWriterSettings::getCurrentFormat() const +{ + return m_currentFormat; +} + +QByteArray PDFImageWriterSettings::getCurrentSubtype() const +{ + return m_currentSubtype; +} + +void PDFImageWriterSettings::setCurrentSubtype(const QByteArray& currentSubtype) +{ + m_currentSubtype = currentSubtype; +} + +PDFPageImageExportSettings::PDFPageImageExportSettings() +{ + m_fileTemplate = PDFTranslationContext::tr("Image_%"); +} + +PDFPageImageExportSettings::ResolutionMode PDFPageImageExportSettings::getResolutionMode() const +{ + return m_resolutionMode; +} + +void PDFPageImageExportSettings::setResolutionMode(ResolutionMode resolution) +{ + m_resolutionMode = resolution; +} + +PDFPageImageExportSettings::PageSelectionMode PDFPageImageExportSettings::getPageSelectionMode() const +{ + return m_pageSelectionMode; +} + +void PDFPageImageExportSettings::setPageSelectionMode(PageSelectionMode pageSelectionMode) +{ + m_pageSelectionMode = pageSelectionMode; +} + +QString PDFPageImageExportSettings::getDirectory() const +{ + return m_directory; +} + +void PDFPageImageExportSettings::setDirectory(const QString& directory) +{ + m_directory = directory; +} + +QString PDFPageImageExportSettings::getFileTemplate() const +{ + return m_fileTemplate; +} + +void PDFPageImageExportSettings::setFileTemplate(const QString& fileTemplate) +{ + m_fileTemplate = fileTemplate; +} + +QString PDFPageImageExportSettings::getPageSelection() const +{ + return m_pageSelection; +} + +void PDFPageImageExportSettings::setPageSelection(const QString& pageSelection) +{ + m_pageSelection = pageSelection; +} + +int PDFPageImageExportSettings::getDpiResolution() const +{ + return m_dpiResolution; +} + +void PDFPageImageExportSettings::setDpiResolution(int dpiResolution) +{ + m_dpiResolution = dpiResolution; +} + +int PDFPageImageExportSettings::getPixelResolution() const +{ + return m_pixelResolution; +} + +void PDFPageImageExportSettings::setPixelResolution(int pixelResolution) +{ + m_pixelResolution = pixelResolution; +} + } // namespace pdf diff --git a/PdfForQtLib/sources/pdfrenderer.h b/PdfForQtLib/sources/pdfrenderer.h index 034eb85..32522aa 100644 --- a/PdfForQtLib/sources/pdfrenderer.h +++ b/PdfForQtLib/sources/pdfrenderer.h @@ -22,6 +22,7 @@ #include "pdfexception.h" #include "pdfmeshqualitysettings.h" +#include #include class QPainter; @@ -154,6 +155,107 @@ private: QOpenGLFramebufferObject* m_fbo; }; +/// Settings object for image writer +class PDFFORQTLIBSHARED_EXPORT PDFImageWriterSettings +{ +public: + explicit PDFImageWriterSettings(); + + /// Returns true, if image option is supported + bool isOptionSupported(QImageIOHandler::ImageOption option) const { return m_supportedOptions.count(option); } + + /// Returns a list of available image formats + const QList& getFormats() const { return m_formats; } + + /// Returns a list of available subtypes + const QList& getSubtypes() const { return m_subtypes; } + + /// Selects image format (and initializes default values) + void selectFormat(const QByteArray& format); + + int getCompression() const; + void setCompression(int compression); + + int getQuality() const; + void setQuality(int quality); + + float getGamma() const; + void setGamma(float gamma); + + bool hasOptimizedWrite() const; + void setOptimizedWrite(bool optimizedWrite); + + bool hasProgressiveScanWrite() const; + void setProgressiveScanWrite(bool progressiveScanWrite); + + QByteArray getCurrentFormat() const; + + QByteArray getCurrentSubtype() const; + void setCurrentSubtype(const QByteArray& currentSubtype); + +private: + int m_compression = 9; + int m_quality = 100; + float m_gamma = 1.0; + bool m_optimizedWrite = false; + bool m_progressiveScanWrite = false; + QByteArray m_currentFormat; + QByteArray m_currentSubtype; + std::set m_supportedOptions; + + QList m_formats; + QList m_subtypes; +}; + +/// This class is for setup of page image exporter +class PDFFORQTLIBSHARED_EXPORT PDFPageImageExportSettings +{ +public: + explicit PDFPageImageExportSettings(); + + enum class PageSelectionMode + { + All, + Selection + }; + + enum class ResolutionMode + { + DPI, + Pixels + }; + + ResolutionMode getResolutionMode() const; + void setResolutionMode(ResolutionMode resolution); + + PageSelectionMode getPageSelectionMode() const; + void setPageSelectionMode(PageSelectionMode pageSelectionMode); + + QString getDirectory() const; + void setDirectory(const QString& directory); + + QString getFileTemplate() const; + void setFileTemplate(const QString& fileTemplate); + + QString getPageSelection() const; + void setPageSelection(const QString& pageSelection); + + int getDpiResolution() const; + void setDpiResolution(int dpiResolution); + + int getPixelResolution() const; + void setPixelResolution(int pixelResolution); + +private: + ResolutionMode m_resolutionMode = ResolutionMode::DPI; + PageSelectionMode m_pageSelectionMode = PageSelectionMode::All; + QString m_directory; + QString m_fileTemplate; + QString m_pageSelection; + int m_dpiResolution = 300; + int m_pixelResolution = 100; +}; + } // namespace pdf Q_DECLARE_OPERATORS_FOR_FLAGS(pdf::PDFRenderer::Features) diff --git a/PdfForQtViewer/PdfForQtViewer.pro b/PdfForQtViewer/PdfForQtViewer.pro index 0e95fdf..c737b8d 100644 --- a/PdfForQtViewer/PdfForQtViewer.pro +++ b/PdfForQtViewer/PdfForQtViewer.pro @@ -38,6 +38,7 @@ SOURCES += \ pdfadvancedfindwidget.cpp \ pdfdocumentpropertiesdialog.cpp \ pdfrecentfilemanager.cpp \ + pdfrendertoimagesdialog.cpp \ pdfsendmail.cpp \ pdfsidebarwidget.cpp \ pdfviewermainwindow.cpp \ @@ -50,6 +51,7 @@ HEADERS += \ pdfadvancedfindwidget.h \ pdfdocumentpropertiesdialog.h \ pdfrecentfilemanager.h \ + pdfrendertoimagesdialog.h \ pdfsendmail.h \ pdfsidebarwidget.h \ pdfviewermainwindow.h \ @@ -61,6 +63,7 @@ FORMS += \ pdfaboutdialog.ui \ pdfadvancedfindwidget.ui \ pdfdocumentpropertiesdialog.ui \ + pdfrendertoimagesdialog.ui \ pdfsidebarwidget.ui \ pdfviewermainwindow.ui \ pdfviewersettingsdialog.ui diff --git a/PdfForQtViewer/pdfrendertoimagesdialog.cpp b/PdfForQtViewer/pdfrendertoimagesdialog.cpp new file mode 100644 index 0000000..a6956cc --- /dev/null +++ b/PdfForQtViewer/pdfrendertoimagesdialog.cpp @@ -0,0 +1,233 @@ +// Copyright (C) 2020 Jakub Melka +// +// This file is part of PdfForQt. +// +// PdfForQt is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// PdfForQt is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with PDFForQt. If not, see . + +#include "pdfrendertoimagesdialog.h" +#include "ui_pdfrendertoimagesdialog.h" + +#include "pdfutils.h" +#include "pdfwidgetutils.h" + +#include + +namespace pdfviewer +{ + +PDFRenderToImagesDialog::PDFRenderToImagesDialog(QWidget* parent) : + QDialog(parent), + ui(new Ui::PDFRenderToImagesDialog), + m_isLoadingData(false) +{ + ui->setupUi(this); + + // Load image formats + for (const QByteArray& format : m_imageWriterSettings.getFormats()) + { + ui->formatComboBox->addItem(QString::fromLatin1(format), format); + } + + connect(ui->pagesAllButton, &QRadioButton::clicked, this, &PDFRenderToImagesDialog::onPagesButtonClicked); + connect(ui->pagesSelectButton, &QRadioButton::clicked, this, &PDFRenderToImagesDialog::onPagesButtonClicked); + connect(ui->selectedPagesEdit, &QLineEdit::textChanged, this, &PDFRenderToImagesDialog::onSelectedPagesChanged); + connect(ui->directoryEdit, &QLineEdit::textChanged, this, &PDFRenderToImagesDialog::onDirectoryChanged); + connect(ui->fileTemplateEdit, &QLineEdit::textChanged, this, &PDFRenderToImagesDialog::onFileTemplateChanged); + connect(ui->resolutionDPIButton, &QRadioButton::clicked, this, &PDFRenderToImagesDialog::onResolutionButtonClicked); + connect(ui->resolutionPixelsButton, &QRadioButton::clicked, this, &PDFRenderToImagesDialog::onResolutionButtonClicked); + connect(ui->resolutionDPIEdit, QOverload::of(&QSpinBox::valueChanged), this, &PDFRenderToImagesDialog::onResolutionDPIChanged); + connect(ui->resolutionPixelsEdit, QOverload::of(&QSpinBox::valueChanged), this, &PDFRenderToImagesDialog::onResolutionPixelsChanged); + connect(ui->formatComboBox, QOverload::of(&QComboBox::currentIndexChanged), this, &PDFRenderToImagesDialog::onFormatChanged); + connect(ui->subtypeComboBox, QOverload::of(&QComboBox::currentIndexChanged), this, &PDFRenderToImagesDialog::onSubtypeChanged); + connect(ui->compressionEdit, QOverload::of(&QSpinBox::valueChanged), this, &PDFRenderToImagesDialog::onCompressionChanged); + connect(ui->qualityEdit, QOverload::of(&QSpinBox::valueChanged), this, &PDFRenderToImagesDialog::onQualityChanged); + connect(ui->gammaEdit, QOverload::of(&QDoubleSpinBox::valueChanged), this, &PDFRenderToImagesDialog::onGammaChanged); + connect(ui->optimizedWriteCheckBox, &QCheckBox::clicked, this, &PDFRenderToImagesDialog::onOptimizedWriteChanged); + connect(ui->progressiveScanWriteCheckBox, &QCheckBox::clicked, this, &PDFRenderToImagesDialog::onProgressiveScanWriteChanged); + + loadImageWriterSettings(); + loadImageExportSettings(); + + PDFWidgetUtils::scaleWidget(this, QSize(1000, 600)); +} + +PDFRenderToImagesDialog::~PDFRenderToImagesDialog() +{ + delete ui; +} + +void PDFRenderToImagesDialog::loadImageWriterSettings() +{ + if (m_isLoadingData) + { + return; + } + + pdf::PDFTemporaryValueChange guard(&m_isLoadingData, true); + ui->formatComboBox->setCurrentIndex(ui->formatComboBox->findData(m_imageWriterSettings.getCurrentFormat())); + + ui->subtypeComboBox->setUpdatesEnabled(false); + ui->subtypeComboBox->clear(); + for (const QByteArray& subtype : m_imageWriterSettings.getSubtypes()) + { + ui->subtypeComboBox->addItem(QString::fromLatin1(subtype), subtype); + } + ui->subtypeComboBox->setCurrentIndex(ui->subtypeComboBox->findData(m_imageWriterSettings.getCurrentSubtype())); + ui->subtypeComboBox->setUpdatesEnabled(true); + + ui->compressionEdit->setValue(m_imageWriterSettings.getCompression()); + ui->qualityEdit->setValue(m_imageWriterSettings.getQuality()); + ui->gammaEdit->setValue(m_imageWriterSettings.getGamma()); + ui->optimizedWriteCheckBox->setChecked(m_imageWriterSettings.hasOptimizedWrite()); + ui->progressiveScanWriteCheckBox->setChecked(m_imageWriterSettings.hasProgressiveScanWrite()); + + ui->subtypeComboBox->setEnabled(m_imageWriterSettings.isOptionSupported(QImageIOHandler::SupportedSubTypes)); + ui->compressionEdit->setEnabled(m_imageWriterSettings.isOptionSupported(QImageIOHandler::CompressionRatio)); + ui->qualityEdit->setEnabled(m_imageWriterSettings.isOptionSupported(QImageIOHandler::Quality)); + ui->gammaEdit->setEnabled(m_imageWriterSettings.isOptionSupported(QImageIOHandler::Gamma)); + ui->optimizedWriteCheckBox->setEnabled(m_imageWriterSettings.isOptionSupported(QImageIOHandler::OptimizedWrite)); + ui->progressiveScanWriteCheckBox->setEnabled(m_imageWriterSettings.isOptionSupported(QImageIOHandler::ProgressiveScanWrite)); +} + +void PDFRenderToImagesDialog::loadImageExportSettings() +{ + if (m_isLoadingData) + { + return; + } + + pdf::PDFTemporaryValueChange guard(&m_isLoadingData, true); + + const pdf::PDFPageImageExportSettings::PageSelectionMode pageSelectionMode = m_imageExportSettings.getPageSelectionMode(); + ui->pagesAllButton->setChecked(pageSelectionMode == pdf::PDFPageImageExportSettings::PageSelectionMode::All); + ui->pagesSelectButton->setChecked(pageSelectionMode == pdf::PDFPageImageExportSettings::PageSelectionMode::Selection); + + if (pageSelectionMode == pdf::PDFPageImageExportSettings::PageSelectionMode::Selection) + { + ui->selectedPagesEdit->setEnabled(true); + ui->selectedPagesEdit->setText(m_imageExportSettings.getPageSelection()); + } + else + { + ui->selectedPagesEdit->setEnabled(false); + ui->selectedPagesEdit->setText(QString()); + } + + ui->directoryEdit->setText(m_imageExportSettings.getDirectory()); + ui->fileTemplateEdit->setText(m_imageExportSettings.getFileTemplate()); + + const pdf::PDFPageImageExportSettings::ResolutionMode resolutionMode = m_imageExportSettings.getResolutionMode(); + ui->resolutionDPIButton->setChecked(resolutionMode == pdf::PDFPageImageExportSettings::ResolutionMode::DPI); + ui->resolutionPixelsButton->setChecked(resolutionMode == pdf::PDFPageImageExportSettings::ResolutionMode::Pixels); + ui->resolutionDPIEdit->setValue(m_imageExportSettings.getDpiResolution()); + ui->resolutionPixelsEdit->setValue(m_imageExportSettings.getPixelResolution()); + ui->resolutionDPIEdit->setEnabled(resolutionMode == pdf::PDFPageImageExportSettings::ResolutionMode::DPI); + ui->resolutionPixelsEdit->setEnabled(resolutionMode == pdf::PDFPageImageExportSettings::ResolutionMode::Pixels); +} + +void PDFRenderToImagesDialog::onFormatChanged() +{ + m_imageWriterSettings.selectFormat(ui->formatComboBox->currentData().toByteArray()); + loadImageWriterSettings(); +} + +void PDFRenderToImagesDialog::onSubtypeChanged() +{ + m_imageWriterSettings.setCurrentSubtype(ui->subtypeComboBox->currentData().toByteArray()); +} + +void PDFRenderToImagesDialog::onPagesButtonClicked(bool checked) +{ + if (checked) + { + const pdf::PDFPageImageExportSettings::PageSelectionMode pageSelectionMode = (sender() == ui->pagesAllButton) ? pdf::PDFPageImageExportSettings::PageSelectionMode::All + : pdf::PDFPageImageExportSettings::PageSelectionMode::Selection; + m_imageExportSettings.setPageSelectionMode(pageSelectionMode); + loadImageExportSettings(); + } +} + +void PDFRenderToImagesDialog::onSelectedPagesChanged(const QString& text) +{ + m_imageExportSettings.setPageSelection(text); +} + +void PDFRenderToImagesDialog::onDirectoryChanged(const QString& text) +{ + m_imageExportSettings.setDirectory(text); +} + +void PDFRenderToImagesDialog::onFileTemplateChanged(const QString& text) +{ + m_imageExportSettings.setFileTemplate(text); +} + +void PDFRenderToImagesDialog::onResolutionButtonClicked(bool checked) +{ + if (checked) + { + const pdf::PDFPageImageExportSettings::ResolutionMode resolutionMode = (sender() == ui->resolutionDPIButton) ? pdf::PDFPageImageExportSettings::ResolutionMode::DPI + : pdf::PDFPageImageExportSettings::ResolutionMode::Pixels; + m_imageExportSettings.setResolutionMode(resolutionMode); + loadImageExportSettings(); + } +} + +void PDFRenderToImagesDialog::onResolutionDPIChanged(int value) +{ + m_imageExportSettings.setDpiResolution(value); +} + +void PDFRenderToImagesDialog::onResolutionPixelsChanged(int value) +{ + m_imageExportSettings.setPixelResolution(value); +} + +void PDFRenderToImagesDialog::onCompressionChanged(int value) +{ + m_imageWriterSettings.setCompression(value); +} + +void PDFRenderToImagesDialog::onQualityChanged(int value) +{ + m_imageWriterSettings.setQuality(value); +} + +void PDFRenderToImagesDialog::onGammaChanged(double value) +{ + m_imageWriterSettings.setGamma(value); +} + +void PDFRenderToImagesDialog::onOptimizedWriteChanged(bool value) +{ + m_imageWriterSettings.setOptimizedWrite(value); +} + +void PDFRenderToImagesDialog::onProgressiveScanWriteChanged(bool value) +{ + m_imageWriterSettings.setProgressiveScanWrite(value); +} + +void PDFRenderToImagesDialog::on_selectDirectoryButton_clicked() +{ + QString directory = QFileDialog::getExistingDirectory(this, tr("Select output directory"), ui->directoryEdit->text()); + if (!directory.isEmpty()) + { + ui->directoryEdit->setText(directory); + } +} + +} // namespace pdfviewer + + diff --git a/PdfForQtViewer/pdfrendertoimagesdialog.h b/PdfForQtViewer/pdfrendertoimagesdialog.h new file mode 100644 index 0000000..ed14840 --- /dev/null +++ b/PdfForQtViewer/pdfrendertoimagesdialog.h @@ -0,0 +1,74 @@ +// Copyright (C) 2020 Jakub Melka +// +// This file is part of PdfForQt. +// +// PdfForQt is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// PdfForQt is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with PDFForQt. If not, see . + +#ifndef PDFRENDERTOIMAGESDIALOG_H +#define PDFRENDERTOIMAGESDIALOG_H + +#include "pdfrenderer.h" + +#include + +namespace Ui +{ +class PDFRenderToImagesDialog; +} + +namespace pdfviewer +{ + +class PDFRenderToImagesDialog : public QDialog +{ + Q_OBJECT + +public: + explicit PDFRenderToImagesDialog(QWidget* parent); + virtual ~PDFRenderToImagesDialog() override; + +private slots: + void on_selectDirectoryButton_clicked(); + +private: + /// Loads image writer settings to the ui + void loadImageWriterSettings(); + + /// Load image export settigns to the ui + void loadImageExportSettings(); + + void onFormatChanged(); + void onSubtypeChanged(); + void onPagesButtonClicked(bool checked); + void onSelectedPagesChanged(const QString& text); + void onDirectoryChanged(const QString& text); + void onFileTemplateChanged(const QString& text); + void onResolutionButtonClicked(bool checked); + void onResolutionDPIChanged(int value); + void onResolutionPixelsChanged(int value); + void onCompressionChanged(int value); + void onQualityChanged(int value); + void onGammaChanged(double value); + void onOptimizedWriteChanged(bool value); + void onProgressiveScanWriteChanged(bool value); + + Ui::PDFRenderToImagesDialog* ui; + pdf::PDFImageWriterSettings m_imageWriterSettings; + pdf::PDFPageImageExportSettings m_imageExportSettings; + bool m_isLoadingData; +}; + +} // namespace pdfviewer + +#endif // PDFRENDERTOIMAGESDIALOG_H diff --git a/PdfForQtViewer/pdfrendertoimagesdialog.ui b/PdfForQtViewer/pdfrendertoimagesdialog.ui new file mode 100644 index 0000000..625e095 --- /dev/null +++ b/PdfForQtViewer/pdfrendertoimagesdialog.ui @@ -0,0 +1,286 @@ + + + PDFRenderToImagesDialog + + + + 0 + 0 + 690 + 593 + + + + Render Document to Images + + + + + + Output Files Settings + + + + + + Pages to render + + + + + + + File template + + + + + + + All + + + + + + + Generate into directory + + + + + + + ... + + + + + + + + + + + + + Pages: + + + + + + + + + + + + + Image Resolution + + + + + + Resolution + + + + + + + Pixels + + + + + + + DPI + + + + + + + dots/inch + + + 72 + + + 6000 + + + 36 + + + 300 + + + + + + + px + + + 100 + + + 16384 + + + 100 + + + 1000 + + + + + + + + + + Image Format Settings + + + + + + Format + + + + + + + Subtype + + + + + + + + + + 100 + + + + + + + + + + Gamma + + + + + + + Optimized write + + + + + + + + + + Quality + + + + + + + Compression + + + + + + + + + + Progressive scan write + + + + + + + Enable + + + + + + + Enable + + + + + + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Apply|QDialogButtonBox::Close + + + + + + + + + buttonBox + accepted() + PDFRenderToImagesDialog + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + PDFRenderToImagesDialog + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/PdfForQtViewer/pdfviewermainwindow.cpp b/PdfForQtViewer/pdfviewermainwindow.cpp index 664cd8d..913fcd2 100644 --- a/PdfForQtViewer/pdfviewermainwindow.cpp +++ b/PdfForQtViewer/pdfviewermainwindow.cpp @@ -23,6 +23,7 @@ #include "pdfadvancedfindwidget.h" #include "pdfviewersettingsdialog.h" #include "pdfdocumentpropertiesdialog.h" +#include "pdfrendertoimagesdialog.h" #include "pdfdocumentreader.h" #include "pdfvisitor.h" @@ -830,6 +831,7 @@ void PDFViewerMainWindow::updateActionsAvailability() ui->actionRendering_Errors->setEnabled(hasValidDocument); ui->actionFind->setEnabled(hasValidDocument); ui->actionPrint->setEnabled(hasValidDocument && canPrint); + ui->actionRender_to_Images->setEnabled(hasValidDocument && canPrint); setEnabled(!isBusy); } @@ -1275,5 +1277,13 @@ void PDFViewerMainWindow::on_actionPrint_triggered() } } -} // namespace pdfviewer +void PDFViewerMainWindow::on_actionRender_to_Images_triggered() +{ + PDFRenderToImagesDialog dialog(this); + if (dialog.exec() == QDialog::Accepted) + { + } +} + +} // namespace pdfviewer diff --git a/PdfForQtViewer/pdfviewermainwindow.h b/PdfForQtViewer/pdfviewermainwindow.h index 838f111..7918147 100644 --- a/PdfForQtViewer/pdfviewermainwindow.h +++ b/PdfForQtViewer/pdfviewermainwindow.h @@ -98,6 +98,8 @@ private slots: void on_actionPrint_triggered(); + void on_actionRender_to_Images_triggered(); + private: void onActionOpenTriggered(); void onActionCloseTriggered(); diff --git a/PdfForQtViewer/pdfviewermainwindow.ui b/PdfForQtViewer/pdfviewermainwindow.ui index 73fef20..55597f9 100644 --- a/PdfForQtViewer/pdfviewermainwindow.ui +++ b/PdfForQtViewer/pdfviewermainwindow.ui @@ -32,6 +32,7 @@ + @@ -450,6 +451,11 @@ Print + + + Render to Images + +