mirror of
https://github.com/JakubMelka/PDF4QT.git
synced 2025-06-05 21:59:17 +02:00
Dialog for pdf image rendering
This commit is contained in:
@ -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
|
} // namespace pdf
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
#include "pdfexception.h"
|
#include "pdfexception.h"
|
||||||
#include "pdfmeshqualitysettings.h"
|
#include "pdfmeshqualitysettings.h"
|
||||||
|
|
||||||
|
#include <QImageWriter>
|
||||||
#include <QSurfaceFormat>
|
#include <QSurfaceFormat>
|
||||||
|
|
||||||
class QPainter;
|
class QPainter;
|
||||||
@ -154,6 +155,107 @@ private:
|
|||||||
QOpenGLFramebufferObject* m_fbo;
|
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<QByteArray>& getFormats() const { return m_formats; }
|
||||||
|
|
||||||
|
/// Returns a list of available subtypes
|
||||||
|
const QList<QByteArray>& 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<QImageIOHandler::ImageOption> m_supportedOptions;
|
||||||
|
|
||||||
|
QList<QByteArray> m_formats;
|
||||||
|
QList<QByteArray> 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
|
} // namespace pdf
|
||||||
|
|
||||||
Q_DECLARE_OPERATORS_FOR_FLAGS(pdf::PDFRenderer::Features)
|
Q_DECLARE_OPERATORS_FOR_FLAGS(pdf::PDFRenderer::Features)
|
||||||
|
@ -38,6 +38,7 @@ SOURCES += \
|
|||||||
pdfadvancedfindwidget.cpp \
|
pdfadvancedfindwidget.cpp \
|
||||||
pdfdocumentpropertiesdialog.cpp \
|
pdfdocumentpropertiesdialog.cpp \
|
||||||
pdfrecentfilemanager.cpp \
|
pdfrecentfilemanager.cpp \
|
||||||
|
pdfrendertoimagesdialog.cpp \
|
||||||
pdfsendmail.cpp \
|
pdfsendmail.cpp \
|
||||||
pdfsidebarwidget.cpp \
|
pdfsidebarwidget.cpp \
|
||||||
pdfviewermainwindow.cpp \
|
pdfviewermainwindow.cpp \
|
||||||
@ -50,6 +51,7 @@ HEADERS += \
|
|||||||
pdfadvancedfindwidget.h \
|
pdfadvancedfindwidget.h \
|
||||||
pdfdocumentpropertiesdialog.h \
|
pdfdocumentpropertiesdialog.h \
|
||||||
pdfrecentfilemanager.h \
|
pdfrecentfilemanager.h \
|
||||||
|
pdfrendertoimagesdialog.h \
|
||||||
pdfsendmail.h \
|
pdfsendmail.h \
|
||||||
pdfsidebarwidget.h \
|
pdfsidebarwidget.h \
|
||||||
pdfviewermainwindow.h \
|
pdfviewermainwindow.h \
|
||||||
@ -61,6 +63,7 @@ FORMS += \
|
|||||||
pdfaboutdialog.ui \
|
pdfaboutdialog.ui \
|
||||||
pdfadvancedfindwidget.ui \
|
pdfadvancedfindwidget.ui \
|
||||||
pdfdocumentpropertiesdialog.ui \
|
pdfdocumentpropertiesdialog.ui \
|
||||||
|
pdfrendertoimagesdialog.ui \
|
||||||
pdfsidebarwidget.ui \
|
pdfsidebarwidget.ui \
|
||||||
pdfviewermainwindow.ui \
|
pdfviewermainwindow.ui \
|
||||||
pdfviewersettingsdialog.ui
|
pdfviewersettingsdialog.ui
|
||||||
|
233
PdfForQtViewer/pdfrendertoimagesdialog.cpp
Normal file
233
PdfForQtViewer/pdfrendertoimagesdialog.cpp
Normal file
@ -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 <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
#include "pdfrendertoimagesdialog.h"
|
||||||
|
#include "ui_pdfrendertoimagesdialog.h"
|
||||||
|
|
||||||
|
#include "pdfutils.h"
|
||||||
|
#include "pdfwidgetutils.h"
|
||||||
|
|
||||||
|
#include <QFileDialog>
|
||||||
|
|
||||||
|
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<int>::of(&QSpinBox::valueChanged), this, &PDFRenderToImagesDialog::onResolutionDPIChanged);
|
||||||
|
connect(ui->resolutionPixelsEdit, QOverload<int>::of(&QSpinBox::valueChanged), this, &PDFRenderToImagesDialog::onResolutionPixelsChanged);
|
||||||
|
connect(ui->formatComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &PDFRenderToImagesDialog::onFormatChanged);
|
||||||
|
connect(ui->subtypeComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &PDFRenderToImagesDialog::onSubtypeChanged);
|
||||||
|
connect(ui->compressionEdit, QOverload<int>::of(&QSpinBox::valueChanged), this, &PDFRenderToImagesDialog::onCompressionChanged);
|
||||||
|
connect(ui->qualityEdit, QOverload<int>::of(&QSpinBox::valueChanged), this, &PDFRenderToImagesDialog::onQualityChanged);
|
||||||
|
connect(ui->gammaEdit, QOverload<double>::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
|
||||||
|
|
||||||
|
|
74
PdfForQtViewer/pdfrendertoimagesdialog.h
Normal file
74
PdfForQtViewer/pdfrendertoimagesdialog.h
Normal file
@ -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 <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
#ifndef PDFRENDERTOIMAGESDIALOG_H
|
||||||
|
#define PDFRENDERTOIMAGESDIALOG_H
|
||||||
|
|
||||||
|
#include "pdfrenderer.h"
|
||||||
|
|
||||||
|
#include <QDialog>
|
||||||
|
|
||||||
|
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
|
286
PdfForQtViewer/pdfrendertoimagesdialog.ui
Normal file
286
PdfForQtViewer/pdfrendertoimagesdialog.ui
Normal file
@ -0,0 +1,286 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>PDFRenderToImagesDialog</class>
|
||||||
|
<widget class="QDialog" name="PDFRenderToImagesDialog">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>690</width>
|
||||||
|
<height>593</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Render Document to Images</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="dialogLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="filesGroupBox">
|
||||||
|
<property name="title">
|
||||||
|
<string>Output Files Settings</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="filesGroupBoxLayout">
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="pagesToRenderLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>Pages to render</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="0">
|
||||||
|
<widget class="QLabel" name="fileTemplateLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>File template</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QRadioButton" name="pagesAllButton">
|
||||||
|
<property name="text">
|
||||||
|
<string>All</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<widget class="QLabel" name="directoryLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>Generate into directory</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="3">
|
||||||
|
<widget class="QToolButton" name="selectDirectoryButton">
|
||||||
|
<property name="text">
|
||||||
|
<string>...</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1" colspan="2">
|
||||||
|
<widget class="QLineEdit" name="directoryEdit"/>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="1" colspan="2">
|
||||||
|
<widget class="QLineEdit" name="fileTemplateEdit"/>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QRadioButton" name="pagesSelectButton">
|
||||||
|
<property name="text">
|
||||||
|
<string>Pages:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="2">
|
||||||
|
<widget class="QLineEdit" name="selectedPagesEdit"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="imageResolutionGroupBox">
|
||||||
|
<property name="title">
|
||||||
|
<string>Image Resolution</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="resolutionLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>Resolution</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QRadioButton" name="resolutionPixelsButton">
|
||||||
|
<property name="text">
|
||||||
|
<string>Pixels</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QRadioButton" name="resolutionDPIButton">
|
||||||
|
<property name="text">
|
||||||
|
<string>DPI</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="2">
|
||||||
|
<widget class="QSpinBox" name="resolutionDPIEdit">
|
||||||
|
<property name="suffix">
|
||||||
|
<string> dots/inch</string>
|
||||||
|
</property>
|
||||||
|
<property name="minimum">
|
||||||
|
<number>72</number>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>6000</number>
|
||||||
|
</property>
|
||||||
|
<property name="singleStep">
|
||||||
|
<number>36</number>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<number>300</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="2">
|
||||||
|
<widget class="QSpinBox" name="resolutionPixelsEdit">
|
||||||
|
<property name="suffix">
|
||||||
|
<string> px</string>
|
||||||
|
</property>
|
||||||
|
<property name="minimum">
|
||||||
|
<number>100</number>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>16384</number>
|
||||||
|
</property>
|
||||||
|
<property name="singleStep">
|
||||||
|
<number>100</number>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<number>1000</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="imageFormatSettings">
|
||||||
|
<property name="title">
|
||||||
|
<string>Image Format Settings</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="imageFormatSettingsLayout">
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="imageFormatLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>Format</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="imageSubtypeLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>Subtype</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QComboBox" name="subtypeComboBox"/>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="1">
|
||||||
|
<widget class="QSpinBox" name="qualityEdit">
|
||||||
|
<property name="maximum">
|
||||||
|
<number>100</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QComboBox" name="formatComboBox"/>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="0">
|
||||||
|
<widget class="QLabel" name="gammaLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>Gamma</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="5" column="0">
|
||||||
|
<widget class="QLabel" name="optimizedWriteLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>Optimized write</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="1">
|
||||||
|
<widget class="QDoubleSpinBox" name="gammaEdit"/>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="0">
|
||||||
|
<widget class="QLabel" name="qualityLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>Quality</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<widget class="QLabel" name="compressionLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>Compression</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1">
|
||||||
|
<widget class="QSpinBox" name="compressionEdit"/>
|
||||||
|
</item>
|
||||||
|
<item row="6" column="0">
|
||||||
|
<widget class="QLabel" name="progressiveScanWriteLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>Progressive scan write</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="5" column="1">
|
||||||
|
<widget class="QCheckBox" name="optimizedWriteCheckBox">
|
||||||
|
<property name="text">
|
||||||
|
<string>Enable</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="6" column="1">
|
||||||
|
<widget class="QCheckBox" name="progressiveScanWriteCheckBox">
|
||||||
|
<property name="text">
|
||||||
|
<string>Enable</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPlainTextEdit" name="plainTextEdit"/>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QDialogButtonBox" name="buttonBox">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="standardButtons">
|
||||||
|
<set>QDialogButtonBox::Apply|QDialogButtonBox::Close</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections>
|
||||||
|
<connection>
|
||||||
|
<sender>buttonBox</sender>
|
||||||
|
<signal>accepted()</signal>
|
||||||
|
<receiver>PDFRenderToImagesDialog</receiver>
|
||||||
|
<slot>accept()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>248</x>
|
||||||
|
<y>254</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>157</x>
|
||||||
|
<y>274</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>buttonBox</sender>
|
||||||
|
<signal>rejected()</signal>
|
||||||
|
<receiver>PDFRenderToImagesDialog</receiver>
|
||||||
|
<slot>reject()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>316</x>
|
||||||
|
<y>260</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>286</x>
|
||||||
|
<y>274</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
</connections>
|
||||||
|
</ui>
|
@ -23,6 +23,7 @@
|
|||||||
#include "pdfadvancedfindwidget.h"
|
#include "pdfadvancedfindwidget.h"
|
||||||
#include "pdfviewersettingsdialog.h"
|
#include "pdfviewersettingsdialog.h"
|
||||||
#include "pdfdocumentpropertiesdialog.h"
|
#include "pdfdocumentpropertiesdialog.h"
|
||||||
|
#include "pdfrendertoimagesdialog.h"
|
||||||
|
|
||||||
#include "pdfdocumentreader.h"
|
#include "pdfdocumentreader.h"
|
||||||
#include "pdfvisitor.h"
|
#include "pdfvisitor.h"
|
||||||
@ -830,6 +831,7 @@ void PDFViewerMainWindow::updateActionsAvailability()
|
|||||||
ui->actionRendering_Errors->setEnabled(hasValidDocument);
|
ui->actionRendering_Errors->setEnabled(hasValidDocument);
|
||||||
ui->actionFind->setEnabled(hasValidDocument);
|
ui->actionFind->setEnabled(hasValidDocument);
|
||||||
ui->actionPrint->setEnabled(hasValidDocument && canPrint);
|
ui->actionPrint->setEnabled(hasValidDocument && canPrint);
|
||||||
|
ui->actionRender_to_Images->setEnabled(hasValidDocument && canPrint);
|
||||||
setEnabled(!isBusy);
|
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
|
||||||
|
@ -98,6 +98,8 @@ private slots:
|
|||||||
|
|
||||||
void on_actionPrint_triggered();
|
void on_actionPrint_triggered();
|
||||||
|
|
||||||
|
void on_actionRender_to_Images_triggered();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void onActionOpenTriggered();
|
void onActionOpenTriggered();
|
||||||
void onActionCloseTriggered();
|
void onActionCloseTriggered();
|
||||||
|
@ -32,6 +32,7 @@
|
|||||||
<addaction name="separator"/>
|
<addaction name="separator"/>
|
||||||
<addaction name="actionSend_by_E_Mail"/>
|
<addaction name="actionSend_by_E_Mail"/>
|
||||||
<addaction name="actionPrint"/>
|
<addaction name="actionPrint"/>
|
||||||
|
<addaction name="actionRender_to_Images"/>
|
||||||
<addaction name="separator"/>
|
<addaction name="separator"/>
|
||||||
<addaction name="actionProperties"/>
|
<addaction name="actionProperties"/>
|
||||||
<addaction name="separator"/>
|
<addaction name="separator"/>
|
||||||
@ -450,6 +451,11 @@
|
|||||||
<string>Print</string>
|
<string>Print</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
|
<action name="actionRender_to_Images">
|
||||||
|
<property name="text">
|
||||||
|
<string>Render to Images</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
</widget>
|
</widget>
|
||||||
<layoutdefault spacing="6" margin="11"/>
|
<layoutdefault spacing="6" margin="11"/>
|
||||||
<resources>
|
<resources>
|
||||||
|
Reference in New Issue
Block a user