Skip to content

Commit

Permalink
Small fixes and documentation improvements.
Browse files Browse the repository at this point in the history
  • Loading branch information
tpisto committed Apr 14, 2015
1 parent 64c24be commit a6c8c5a
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 3 deletions.
16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,25 @@ $ npm install pdf-fill-form
> Homebrew users who get error regarding xcb-shm
> The fix is to add this to your bash profile / environment: export PKG_CONFIG_PATH=/opt/X11/lib/pkgconfig
###Linux (Ubuntu/Debian)
###Linux - Ubuntu (trusty)
```
$ sudo apt-get install libpoppler-qt4-dev libcairo2-dev
$ npm install pdf-fill-form
```
###Linux - Debian (wheezy)
We need newer Poppler library than the current in Wheezy distribution:

```
$ sudo add-apt-repository "deb http://http.debian.net/debian wheezy-backports main"
$ sudo apt-get update
```
Then install packages

```
$ sudo apt-get install libcairo2-dev
$ sudo apt-get -t wheezy-backports install libpoppler-qt4-dev
$ npm install pdf-fill-form
```
##Todo
* Tests
* Refactoring
Expand Down
13 changes: 11 additions & 2 deletions src/NodePoppler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,21 @@ static cairo_status_t writePngToBuffer(void *closure, const unsigned char *data,
}

void createPdf(QBuffer *buffer, Poppler::Document *document) {

ostringstream ss;

Poppler::PDFConverter *converter = document->pdfConverter();
converter->setPDFOptions(converter->pdfOptions() | Poppler::PDFConverter::WithChanges);
converter->setOutputDevice(buffer);
if (!converter->convert()) {
throw "Error occurred while trying to create form filled PDF";
// enum Error
// {
// NoError,
// FileLockedError,
// OpenOutputError,
// NotSupportedInputFileError
// };
ss << "Error occurred when converting PDF: " << converter->lastError();
throw ss.str();
}
}

Expand Down

0 comments on commit a6c8c5a

Please sign in to comment.