44 lines
1.2 KiB
C++
44 lines
1.2 KiB
C++
#include <stdlib.h>
|
|
#include <string>
|
|
#include <algorithm>
|
|
#include <dirent.h>
|
|
#include <fstream>
|
|
#include <vector>
|
|
#include <sstream>
|
|
#include <iostream>
|
|
#include <sys/types.h>
|
|
#include <sys/wait.h>
|
|
|
|
#include "jsonobject.h"
|
|
|
|
#pragma once
|
|
namespace sequencelogic
|
|
{
|
|
|
|
class PDFBookmarker
|
|
{
|
|
public:
|
|
PDFBookmarker();
|
|
~PDFBookmarker();
|
|
void bookmarkPDFs(std::string classificationJson, std::string inFile, const std::string &outFilename);
|
|
|
|
private:
|
|
const std::string GHOSTSCRIPT_COMMAND = "pdftk "; //[outfile.pdf] [input.txt]
|
|
const std::string PAGE_COUNT_COMMAND = "/usr/bin/identify -format %n -quiet "; //[infile.pdf]
|
|
const std::string PDFMARK_FILE = "pdfmarks.txt";
|
|
const std::string DOCS_TAG = "documents";
|
|
const std::string DOCTYPE_TAG = "doctype";
|
|
const std::string PAGE_FILE_TAG = "name";
|
|
const std::string PAGES_ARRAY_TAG = "pages";
|
|
|
|
std::string getBookmarkTxt(std::string docType, int startPageNum);
|
|
std::string runCommand(std::string cmd);
|
|
std::string getMarkFileName(std::string dir);
|
|
std::string getOutputFile(std::string inFIle);
|
|
int getPageNum(std::string imgFile);
|
|
int getSmallest(std::vector<int> valu);
|
|
void saveFile(std::string fileName, std::string &fileText);
|
|
void deleteFile(std::string fileName);
|
|
};
|
|
|
|
} |