read and show pdf file
This commit is contained in:
		
							
								
								
									
										15
									
								
								ChangeLog
									
									
									
									
									
								
							
							
						
						
									
										15
									
								
								ChangeLog
									
									
									
									
									
								
							@@ -0,0 +1,15 @@
 | 
			
		||||
2015-11-10 19:48  marc
 | 
			
		||||
 | 
			
		||||
	* ., AUTHORS, COPYING, ChangeLog, INSTALL, NEWS, README,
 | 
			
		||||
	  ax_check_qt.m4, ax_cxx_compile_stdcxx_11.m4,
 | 
			
		||||
	  ax_init_standard_project.m4, bootstrap.sh, build-in-docker.sh,
 | 
			
		||||
	  build-resource-file.sh, configure.ac, debian,
 | 
			
		||||
	  debian/changelog.in, debian/compat, debian/control.in,
 | 
			
		||||
	  debian/docs, debian/pdfsign-dev.install, debian/pdfsign.install,
 | 
			
		||||
	  debian/rules, doc, doc/doxyfile.in, doc/makefile.am,
 | 
			
		||||
	  mac-create-app-bundle.sh, makefile.am, pdfsign.spec.in,
 | 
			
		||||
	  resolve-debbuilddeps.sh, resolve-rpmbuilddeps.sh, sql-to-dot.sed,
 | 
			
		||||
	  src, src/languages.qrc, src/main.cxx, src/makefile.am,
 | 
			
		||||
	  src/pdfsign.hxx, src/pdfsign.pc.in, src/pdfsign.ui,
 | 
			
		||||
	  src/version.cxx, src/version.hxx: initial setup
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -28,6 +28,8 @@ AX_USE_RPM_PACKAGING
 | 
			
		||||
#AX_BUILD_EXAMPLES
 | 
			
		||||
#AX_BUILD_HTML
 | 
			
		||||
 | 
			
		||||
AX_PKG_REQUIRE(pollper, poppler-qt5)
 | 
			
		||||
 | 
			
		||||
# qt features, uncomment, what you need:
 | 
			
		||||
#AX_CHECK_QT([QT], [QtCore QtGui QtNetwork], [QtWidgets])
 | 
			
		||||
AX_REQUIRE_QT([QT], [QtCore QtGui QtNetwork], [QtWidgets])
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										6
									
								
								debian/control.in
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										6
									
								
								debian/control.in
									
									
									
									
										vendored
									
									
								
							@@ -1,10 +1,10 @@
 | 
			
		||||
Source: @PACKAGE_NAME@
 | 
			
		||||
Priority: extra
 | 
			
		||||
Maintainer: @AUTHOR@
 | 
			
		||||
Build-Depends: debhelper, subversion, pkg-config, automake, libtool, autotools-dev, lsb-release , doxygen, graphviz, mscgen, qt5-default | libqt4-core | libqtcore4, qt5-qmake | qt4-qmake, qtbase5-dev | libqt4-dev, qtbase5-dev-tools | qt4-dev-tools, qttools5-dev-tools | qt4-dev-tools, qttools5-dev-tools | qt4-dev-tools
 | 
			
		||||
Build-Depends: debhelper, subversion, pkg-config, automake, libtool, autotools-dev, lsb-release , doxygen, graphviz, mscgen, qt5-default, qt5-qmake, qtbase5-dev, qtbase5-dev-tools, qttools5-dev-tools, qttools5-dev-tools, libpoppler-qt5-dev
 | 
			
		||||
 | 
			
		||||
Package: @PACKAGE_NAME@
 | 
			
		||||
Section: libs
 | 
			
		||||
Section: text
 | 
			
		||||
Architecture: any
 | 
			
		||||
Depends: ${shlibs:Depends}, ${misc:Depends}
 | 
			
		||||
Description: @DESCRIPTION@
 | 
			
		||||
@@ -13,6 +13,6 @@ Description: @DESCRIPTION@
 | 
			
		||||
Package: @PACKAGE_NAME@-dev
 | 
			
		||||
Section: libdevel
 | 
			
		||||
Architecture: any
 | 
			
		||||
Depends: @PACKAGE_NAME@ (= ${binary:Version}), debhelper, subversion, pkg-config, automake, libtool, autotools-dev, lsb-release , doxygen, graphviz, mscgen, qt5-default | libqt4-core | libqtcore4, qt5-qmake | qt4-qmake, qtbase5-dev | libqt4-dev, qtbase5-dev-tools | qt4-dev-tools, qttools5-dev-tools | qt4-dev-tools, qttools5-dev-tools | qt4-dev-tools
 | 
			
		||||
Depends: @PACKAGE_NAME@ (= ${binary:Version}), debhelper, subversion, pkg-config, automake, libtool, autotools-dev, lsb-release , doxygen, graphviz, mscgen, qt5-default, qt5-qmake, qtbase5-dev, qtbase5-dev-tools, qttools5-dev-tools, qttools5-dev-tools, libpoppler-qt5-dev
 | 
			
		||||
Description: @DESCRIPTION@ - Development Package
 | 
			
		||||
@README_DEB@
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										10
									
								
								debian/pdfsign-dev.install
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										10
									
								
								debian/pdfsign-dev.install
									
									
									
									
										vendored
									
									
								
							@@ -1,7 +1,7 @@
 | 
			
		||||
usr/include/*
 | 
			
		||||
usr/lib/lib*.a
 | 
			
		||||
usr/lib/lib*.so
 | 
			
		||||
#usr/include/*
 | 
			
		||||
#usr/lib/lib*.a
 | 
			
		||||
#usr/lib/lib*.so
 | 
			
		||||
usr/lib/pkgconfig/*
 | 
			
		||||
usr/lib/*.la
 | 
			
		||||
usr/share/pdfsign
 | 
			
		||||
#usr/lib/*.la
 | 
			
		||||
#usr/share/pdfsign
 | 
			
		||||
usr/share/doc/pdfsign/html
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										3
									
								
								debian/pdfsign.install
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										3
									
								
								debian/pdfsign.install
									
									
									
									
										vendored
									
									
								
							@@ -1 +1,2 @@
 | 
			
		||||
usr/lib/lib*.so.*
 | 
			
		||||
usr/bin/*
 | 
			
		||||
#usr/lib/lib*.so.*
 | 
			
		||||
 
 | 
			
		||||
@@ -19,7 +19,7 @@ int main(int argc, char *argv[]) try {
 | 
			
		||||
  parser.addHelpOption();
 | 
			
		||||
  parser.process(a);
 | 
			
		||||
  QStringList scripts(parser.positionalArguments());
 | 
			
		||||
  Pdfsign w;
 | 
			
		||||
  PdfSign w;
 | 
			
		||||
  w.show();
 | 
			
		||||
  return a.exec();
 | 
			
		||||
 } catch (std::exception &x) {
 | 
			
		||||
 
 | 
			
		||||
@@ -55,14 +55,16 @@ pdfsign_TR_FILES = main.cxx version.cxx
 | 
			
		||||
pdfsign_SOURCES = ${pdfsign_TR_FILES} ${BUILT_SOURCES}
 | 
			
		||||
 | 
			
		||||
## automatic assembly, no need to change
 | 
			
		||||
BUILT_SOURCES = ${pdfsign_MOCFILES}                 ${pdfsign_UIFILES}                 ${pdfsign_TRANSLATIONS}                 ${pdfsign_RESOURCES}
 | 
			
		||||
BUILT_SOURCES = ${pdfsign_MOCFILES} ${pdfsign_UIFILES}		\
 | 
			
		||||
                ${pdfsign_TRANSLATIONS} ${pdfsign_RESOURCES}
 | 
			
		||||
 | 
			
		||||
## automatic assembly, no need to change
 | 
			
		||||
EXTRA_DIST_TR = ${pdfsign_MOCFILES:moc_%.cxx=%.hxx}                 ${pdfsign_UIFILES:ui_%.hxx=%.ui}
 | 
			
		||||
EXTRA_DIST_TR = ${pdfsign_MOCFILES:moc_%.cxx=%.hxx} ${pdfsign_UIFILES:ui_%.hxx=%.ui}
 | 
			
		||||
 | 
			
		||||
## automatic assembly, no need to change
 | 
			
		||||
## except: adapt the pre-delivered qt_%.qm list (language files you copy from qt
 | 
			
		||||
EXTRA_DIST = ${EXTRA_DIST_TR}              ${pdfsign_RESOURCES:qrc_%.cxx:%.qrc}              ${pdfsign_TRANSLATIONS:%.qm=%.ts}              qt_de.qm qt_fr.qm
 | 
			
		||||
EXTRA_DIST = ${EXTRA_DIST_TR} ${pdfsign_RESOURCES:qrc_%.cxx:%.qrc}	\
 | 
			
		||||
             ${pdfsign_TRANSLATIONS:%.qm=%.ts} qt_de.qm qt_fr.qm
 | 
			
		||||
 | 
			
		||||
## automatic assembly, no need to change
 | 
			
		||||
LANGUAGE_FILES = ${EXTRA_DIST_TR} ${pdfsign_TR_FILES}
 | 
			
		||||
 
 | 
			
		||||
@@ -13,16 +13,37 @@
 | 
			
		||||
 | 
			
		||||
#include <QMainWindow>
 | 
			
		||||
#include <ui_pdfsign.hxx>
 | 
			
		||||
#include <poppler/qt5/poppler-qt5.h>
 | 
			
		||||
#include <QFileDialog>
 | 
			
		||||
#include <memory>
 | 
			
		||||
 | 
			
		||||
/// Main Window
 | 
			
		||||
/** Main window for pdfsign */
 | 
			
		||||
class Pdfsign: public QMainWindow, protected Ui::Pdfsign {
 | 
			
		||||
class PdfSign: public QMainWindow, protected Ui::Pdfsign {
 | 
			
		||||
    Q_OBJECT;
 | 
			
		||||
  public:
 | 
			
		||||
    explicit Pdfsign(QWidget *parent = 0): QMainWindow(parent) {
 | 
			
		||||
    explicit PdfSign(QWidget *parent = 0): QMainWindow(parent) {
 | 
			
		||||
      setupUi(this);
 | 
			
		||||
    }
 | 
			
		||||
    virtual ~Pdfsign() {}
 | 
			
		||||
    virtual ~PdfSign() {}
 | 
			
		||||
  public slots:
 | 
			
		||||
    void on_actionOpen_triggered() {
 | 
			
		||||
      QString fileName(QFileDialog::getOpenFileName(this, tr("Open PDF File"), QString(),
 | 
			
		||||
                                                    tr("PDF-Document (*.pdf)")));
 | 
			
		||||
      if (fileName.isEmpty()) return;
 | 
			
		||||
      _pdf = std::shared_ptr<Poppler::Document>(Poppler::Document::load(fileName));
 | 
			
		||||
      showPage();
 | 
			
		||||
    }
 | 
			
		||||
  public:
 | 
			
		||||
    void showPage(int pageNumber=0) {
 | 
			
		||||
      if (!_pdf) return;
 | 
			
		||||
      std::shared_ptr<Poppler::Page> pdfPage(_pdf->page(pageNumber));
 | 
			
		||||
      if (!pdfPage) return;
 | 
			
		||||
      _pdfDisplay->setPixmap(QPixmap::fromImage(pdfPage->renderToImage()));
 | 
			
		||||
      return;
 | 
			
		||||
    }
 | 
			
		||||
  private:
 | 
			
		||||
    std::shared_ptr<Poppler::Document> _pdf;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 
 | 
			
		||||
@@ -13,18 +13,40 @@
 | 
			
		||||
  <property name="windowTitle">
 | 
			
		||||
   <string>Pdfsign</string>
 | 
			
		||||
  </property>
 | 
			
		||||
  <widget class="QWidget" name="centralwidget"/>
 | 
			
		||||
  <widget class="QWidget" name="centralwidget">
 | 
			
		||||
   <layout class="QGridLayout" name="gridLayout">
 | 
			
		||||
    <item row="0" column="0">
 | 
			
		||||
     <widget class="QLabel" name="_pdfDisplay">
 | 
			
		||||
      <property name="text">
 | 
			
		||||
       <string>PDF-Document</string>
 | 
			
		||||
      </property>
 | 
			
		||||
     </widget>
 | 
			
		||||
    </item>
 | 
			
		||||
   </layout>
 | 
			
		||||
  </widget>
 | 
			
		||||
  <widget class="QMenuBar" name="menubar">
 | 
			
		||||
   <property name="geometry">
 | 
			
		||||
    <rect>
 | 
			
		||||
     <x>0</x>
 | 
			
		||||
     <y>0</y>
 | 
			
		||||
     <width>800</width>
 | 
			
		||||
     <height>22</height>
 | 
			
		||||
     <height>20</height>
 | 
			
		||||
    </rect>
 | 
			
		||||
   </property>
 | 
			
		||||
   <widget class="QMenu" name="menuFile">
 | 
			
		||||
    <property name="title">
 | 
			
		||||
     <string>&File</string>
 | 
			
		||||
    </property>
 | 
			
		||||
    <addaction name="actionOpen"/>
 | 
			
		||||
   </widget>
 | 
			
		||||
   <addaction name="menuFile"/>
 | 
			
		||||
  </widget>
 | 
			
		||||
  <widget class="QStatusBar" name="statusbar"/>
 | 
			
		||||
  <action name="actionOpen">
 | 
			
		||||
   <property name="text">
 | 
			
		||||
    <string>&Open...</string>
 | 
			
		||||
   </property>
 | 
			
		||||
  </action>
 | 
			
		||||
 </widget>
 | 
			
		||||
 <resources/>
 | 
			
		||||
 <connections/>
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user