mirror of
https://github.com/JakubMelka/PDF4QT.git
synced 2025-06-05 21:59:17 +02:00
Parsing X Reference table
This commit is contained in:
48
PdfForQtViewer/PdfForQtViewer.pro
Normal file
48
PdfForQtViewer/PdfForQtViewer.pro
Normal file
@ -0,0 +1,48 @@
|
||||
#-------------------------------------------------
|
||||
#
|
||||
# Project created by QtCreator 2018-11-18T16:50:12
|
||||
#
|
||||
#-------------------------------------------------
|
||||
|
||||
QT += core gui
|
||||
|
||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||||
|
||||
TARGET = PdfForQtViewer
|
||||
TEMPLATE = app
|
||||
|
||||
# The following define makes your compiler emit warnings if you use
|
||||
# any feature of Qt which has been marked as deprecated (the exact warnings
|
||||
# depend on your compiler). Please consult the documentation of the
|
||||
# deprecated API in order to know how to port your code away from it.
|
||||
DEFINES += QT_DEPRECATED_WARNINGS
|
||||
|
||||
# You can also make your code fail to compile if you use deprecated APIs.
|
||||
# In order to do so, uncomment the following line.
|
||||
# You can also select to disable deprecated APIs only up to a certain version of Qt.
|
||||
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
||||
|
||||
QMAKE_CXXFLAGS += /std:c++latest
|
||||
|
||||
INCLUDEPATH += $$PWD/../PDFForQtLib/Sources
|
||||
|
||||
DESTDIR = $$OUT_PWD/..
|
||||
|
||||
LIBS += -L$$OUT_PWD/..
|
||||
|
||||
LIBS += -lPDFForQtLib
|
||||
|
||||
SOURCES += \
|
||||
main.cpp \
|
||||
pdfviewermainwindow.cpp
|
||||
|
||||
HEADERS += \
|
||||
pdfviewermainwindow.h
|
||||
|
||||
FORMS += \
|
||||
pdfviewermainwindow.ui
|
||||
|
||||
# Default rules for deployment.
|
||||
qnx: target.path = /tmp/$${TARGET}/bin
|
||||
else: unix:!android: target.path = /opt/$${TARGET}/bin
|
||||
!isEmpty(target.path): INSTALLS += target
|
12
PdfForQtViewer/main.cpp
Normal file
12
PdfForQtViewer/main.cpp
Normal file
@ -0,0 +1,12 @@
|
||||
#include "pdfviewermainwindow.h"
|
||||
|
||||
#include <QApplication>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication a(argc, argv);
|
||||
pdfviewer::PDFViewerMainWindow w;
|
||||
w.show();
|
||||
|
||||
return a.exec();
|
||||
}
|
45
PdfForQtViewer/pdfviewermainwindow.cpp
Normal file
45
PdfForQtViewer/pdfviewermainwindow.cpp
Normal file
@ -0,0 +1,45 @@
|
||||
#include "pdfviewermainwindow.h"
|
||||
#include "ui_pdfviewermainwindow.h"
|
||||
|
||||
#include "pdfdocumentreader.h"
|
||||
|
||||
#include <QFileDialog>
|
||||
#include <QMessageBox>
|
||||
|
||||
namespace pdfviewer
|
||||
{
|
||||
|
||||
PDFViewerMainWindow::PDFViewerMainWindow(QWidget *parent) :
|
||||
QMainWindow(parent),
|
||||
ui(new Ui::PDFViewerMainWindow)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
connect(ui->actionOpen, &QAction::triggered, this, &PDFViewerMainWindow::onActionOpenTriggered);
|
||||
}
|
||||
|
||||
PDFViewerMainWindow::~PDFViewerMainWindow()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void PDFViewerMainWindow::onActionOpenTriggered()
|
||||
{
|
||||
QString fileName = QFileDialog::getOpenFileName(this, tr("Select PDF document"), "K:/Programming/PDF/testpdf", tr("PDF document (*.pdf)"));
|
||||
if (!fileName.isEmpty())
|
||||
{
|
||||
pdf::PDFDocumentReader reader;
|
||||
pdf::PDFDocument document = reader.readFromFile(fileName);
|
||||
|
||||
if (reader.isSuccessfull())
|
||||
{
|
||||
QMessageBox::information(this, tr("PDF Reader"), tr("Document '%1' was successfully loaded!").arg(fileName));
|
||||
}
|
||||
else
|
||||
{
|
||||
QMessageBox::information(this, tr("PDF Reader"), tr("Document read error: %1").arg(fileName));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace pdfviewer
|
30
PdfForQtViewer/pdfviewermainwindow.h
Normal file
30
PdfForQtViewer/pdfviewermainwindow.h
Normal file
@ -0,0 +1,30 @@
|
||||
#ifndef PDFVIEWERMAINWINDOW_H
|
||||
#define PDFVIEWERMAINWINDOW_H
|
||||
|
||||
#include <QMainWindow>
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class PDFViewerMainWindow;
|
||||
}
|
||||
|
||||
namespace pdfviewer
|
||||
{
|
||||
|
||||
class PDFViewerMainWindow : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit PDFViewerMainWindow(QWidget *parent = nullptr);
|
||||
virtual ~PDFViewerMainWindow() override;
|
||||
|
||||
private:
|
||||
void onActionOpenTriggered();
|
||||
|
||||
Ui::PDFViewerMainWindow* ui;
|
||||
};
|
||||
|
||||
} // namespace pdfviewer
|
||||
|
||||
#endif // PDFVIEWERMAINWINDOW_H
|
55
PdfForQtViewer/pdfviewermainwindow.ui
Normal file
55
PdfForQtViewer/pdfviewermainwindow.ui
Normal file
@ -0,0 +1,55 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>PDFViewerMainWindow</class>
|
||||
<widget class="QMainWindow" name="PDFViewerMainWindow">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>PDFViewerMainWindow</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralWidget"/>
|
||||
<widget class="QMenuBar" name="menuBar">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>21</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="QToolBar" name="mainToolBar">
|
||||
<attribute name="toolBarArea">
|
||||
<enum>TopToolBarArea</enum>
|
||||
</attribute>
|
||||
<attribute name="toolBarBreak">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
</widget>
|
||||
<widget class="QStatusBar" name="statusBar"/>
|
||||
<action name="actionOpen">
|
||||
<property name="text">
|
||||
<string>Open</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+O</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
Reference in New Issue
Block a user