Skip to content

Commit

Permalink
Merge pull request #32 from edporras/v0.7.2.7.3-poppler-0.72.0
Browse files Browse the repository at this point in the history
Fix compilation against poppler 0.72.0
  • Loading branch information
otfried authored Dec 8, 2018
2 parents d7ded93 + 865ba46 commit a50483a
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 19 deletions.
19 changes: 9 additions & 10 deletions pdftoipe/pdftoipe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,18 +104,18 @@ int main(int argc, char *argv[])
return 1;

// construct XML file name
GooString *xmlFileName;
std::string xmlFileName;
if (argc == 3) {
xmlFileName = new GooString(argv[2]);
xmlFileName = argv[2];
} else {
const char *p = fileName->getCString() + fileName->getLength() - 4;
const char *p = fileName->c_str() + fileName->getLength() - 4;
if (!strcmp(p, ".pdf") || !strcmp(p, ".PDF")) {
xmlFileName = new GooString(fileName->getCString(),
fileName->getLength() - 4);
xmlFileName = std::string(fileName->c_str(),
fileName->getLength() - 4);
} else {
xmlFileName = fileName->copy();
xmlFileName = fileName->c_str();
}
xmlFileName->append(".ipe");
xmlFileName += ".ipe";
}

// get page range
Expand All @@ -127,8 +127,8 @@ int main(int argc, char *argv[])

// write XML file
XmlOutputDev *xmlOut =
new XmlOutputDev(xmlFileName->getCString(), doc->getXRef(),
doc->getCatalog(), firstPage, lastPage);
new XmlOutputDev(xmlFileName, doc->getXRef(),
doc->getCatalog(), firstPage, lastPage);

// tell output device about text handling
xmlOut->setTextHandling(math, notext, literal, mergeLevel, unicodeLevel);
Expand All @@ -152,7 +152,6 @@ int main(int argc, char *argv[])

// clean up
delete xmlOut;
delete xmlFileName;
delete doc;
delete globalParams;

Expand Down
11 changes: 8 additions & 3 deletions pdftoipe/readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ option) any later version.
Compiling
=========

You need the Poppler library (http://poppler.freedesktop.org) v0.71.0
You need the Poppler library (http://poppler.freedesktop.org) v0.72.0
or greater. On Debian/Ubuntu, install the packages 'libpoppler-dev'
and 'libpoppler-private-dev'.

Expand All @@ -55,7 +55,7 @@ In source directory, say
make

This will create the single executable "pdftoipe". Copy it to
whereever you like. You may also install the man page "pdftoipe.1".
wherever you like. You may also install the man page "pdftoipe.1".

If you want to compile pdftoipe on Windows, please refer to
"compile_on_windows.pdf", written by Daniel Beckmann.
Expand All @@ -65,7 +65,12 @@ If you want to compile pdftoipe on Windows, please refer to
Changes
=======

* 2018/11/01
* 2018/12/07
Changes to compile with poppler 0.72.0. GString is now based on
std::string and may be gettng deprecated soon so get rid of some
uses.

* 2018/11/01
Poppler keeps changing: gBool -> bool (issue #31).

* 2018/10/23
Expand Down
10 changes: 6 additions & 4 deletions pdftoipe/xmloutputdev.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
#include <stddef.h>
#include <stdarg.h>

#include <string>

#include "Object.h"
#include "Error.h"
#include "Gfx.h"
Expand All @@ -24,13 +26,13 @@
// XmlOutputDev
//------------------------------------------------------------------------

XmlOutputDev::XmlOutputDev(const char *fileName, XRef *xrefA, Catalog *catalog,
int firstPage, int lastPage)
XmlOutputDev::XmlOutputDev(const std::string& fileName, XRef *xrefA, Catalog *catalog,
int firstPage, int lastPage)
{
FILE *f;

if (!(f = fopen(fileName, "wb"))) {
fprintf(stderr, "Couldn't open output file '%s'\n", fileName);
if (!(f = fopen(fileName.c_str(), "wb"))) {
fprintf(stderr, "Couldn't open output file '%s'\n", fileName.c_str());
ok = false;
return;
}
Expand Down
4 changes: 2 additions & 2 deletions pdftoipe/xmloutputdev.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@
class GfxPath;
class GfxFont;

#define PDFTOIPE_VERSION "2018/11/01"
#define PDFTOIPE_VERSION "2018/12/07"

class XmlOutputDev : public OutputDev
{
public:

// Open an XML output file, and write the prolog.
XmlOutputDev(const char *fileName, XRef *xrefA, Catalog *catalog,
XmlOutputDev(const std::string& fileName, XRef *xrefA, Catalog *catalog,
int firstPage, int lastPage);

// Destructor -- writes the trailer and closes the file.
Expand Down

0 comments on commit a50483a

Please sign in to comment.