Re: [poppler] How to set custom 'share' directory

2017-11-04 Thread Jeroen Ooms
On Wed, Nov 1, 2017 at 9:31 PM, Jeroen Ooms  wrote:
> Hmm that may be the function I am looking for but I don't understand
> where I should pass a GlobalParams object when reading a pdf file. I
> tried setting the 'globalParams' global when loading the R package but
> that doesn't seem to work

After some trial and error I have figured out that GlobalParams does
work but it must be called after reading the document. If I first call
new GlobalParams(path.c_str()) and then document::load_from_raw_data()
it does not work. But if I first call GlobalParams, then load the
document, and then get the text, it uses the poppler_data as specified
in path.c_str().

Not sure if this is intended but I can make it work now.
___
poppler mailing list
poppler@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/poppler


Re: [poppler] How to set custom 'share' directory

2017-11-03 Thread William Bader
>where I should pass a GlobalParams object when reading a pdf file

You can look at utility programs like utils/pdftops.cc

I think that globalParams is a global variable, see poppler/GlobalParams.cc and 
poppler/GlobalParams.h , so you just set it before you do anything else with 
poppler and you don't have to pass it.

Regards, William



From: poppler <poppler-boun...@lists.freedesktop.org> on behalf of Jeroen Ooms 
<jer...@berkeley.edu>
Sent: Wednesday, November 1, 2017 4:31 PM
To: Jason Crain
Cc: poppler@lists.freedesktop.org
Subject: Re: [poppler] How to set custom 'share' directory

On Wed, Nov 1, 2017 at 3:51 PM, Jason Crain <ja...@inspiresomeone.us> wrote
>
> I don't know how you use poppler in your project, but you may also have
> the option of passing in the path when you construct the GlobalParams
> object.


Hmm that may be the function I am looking for but I don't understand
where I should pass a GlobalParams object when reading a pdf file. I
tried setting the 'globalParams' global when loading the R package but
that doesn't seem to work:

   globalParams = new GlobalParams(path.c_str());

Should I be passing the path to the "share" path or the
"share/poppler" path? FWIW our bindings are quite simple wrappers for
the cpp api: https://github.com/ropensci/pdftools/blob/master/src/bindings.cpp
[https://avatars3.githubusercontent.com/u/1200269?v=4=400]<https://github.com/ropensci/pdftools/blob/master/src/bindings.cpp>

pdftools/bindings.cpp at master · ropensci/pdftools · 
GitHub<https://github.com/ropensci/pdftools/blob/master/src/bindings.cpp>
github.com
pdftools - Text Extraction, Rendering and Converting of PDF Documents



___
poppler mailing list
poppler@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/poppler
poppler Info Page - 
freedesktop.org<https://lists.freedesktop.org/mailman/listinfo/poppler>
lists.freedesktop.org
Subscribing to poppler: Subscribe to poppler by filling out the following form. 
Use of all freedesktop.org lists is subject to our Code of ...



___
poppler mailing list
poppler@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/poppler


Re: [poppler] How to set custom 'share' directory

2017-11-01 Thread Jeroen Ooms
On Wed, Nov 1, 2017 at 3:51 PM, Jason Crain  wrote
>
> I don't know how you use poppler in your project, but you may also have
> the option of passing in the path when you construct the GlobalParams
> object.


Hmm that may be the function I am looking for but I don't understand
where I should pass a GlobalParams object when reading a pdf file. I
tried setting the 'globalParams' global when loading the R package but
that doesn't seem to work:

   globalParams = new GlobalParams(path.c_str());

Should I be passing the path to the "share" path or the
"share/poppler" path? FWIW our bindings are quite simple wrappers for
the cpp api: https://github.com/ropensci/pdftools/blob/master/src/bindings.cpp
___
poppler mailing list
poppler@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/poppler


Re: [poppler] How to set custom 'share' directory

2017-11-01 Thread Jason Crain
On Wed, Nov 01, 2017 at 03:34:36PM +0100, Jeroen Ooms wrote:
> On Wed, Nov 1, 2017 at 3:20 PM, Jason Crain  wrote:
> 
> > On Mac and Linux the path is hardcoded at compilation time.  It's
> > generally in /usr/share/poppler on Linux.  Not sure what the standard is
> > on Mac.  On Windows it looks in \share\poppler relative to the
> > installation directory.
> 
> OK that is unfortunate. Would it be possible to introduce an option to
> set this path dynamically at runtime; e.g via an environment variable
> or via an api call?
> 
> In our case we statically link libpoppler with the R bindings on
> MacOS/Windows. This works very well for users, but there isn't a fixed
> installation directory; it depends on where the user installs the R
> package. So it would be really nice if there is a way to point
> libpoppler to the correct path when the R package gets loaded, rather
> than hardcoding this at build-time.
> 

I don't know how you use poppler in your project, but you may also have
the option of passing in the path when you construct the GlobalParams
object.
___
poppler mailing list
poppler@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/poppler


Re: [poppler] How to set custom 'share' directory

2017-11-01 Thread Jeroen Ooms
On Wed, Nov 1, 2017 at 3:20 PM, Jason Crain  wrote:

> On Mac and Linux the path is hardcoded at compilation time.  It's
> generally in /usr/share/poppler on Linux.  Not sure what the standard is
> on Mac.  On Windows it looks in \share\poppler relative to the
> installation directory.

OK that is unfortunate. Would it be possible to introduce an option to
set this path dynamically at runtime; e.g via an environment variable
or via an api call?

In our case we statically link libpoppler with the R bindings on
MacOS/Windows. This works very well for users, but there isn't a fixed
installation directory; it depends on where the user installs the R
package. So it would be really nice if there is a way to point
libpoppler to the correct path when the R package gets loaded, rather
than hardcoding this at build-time.
___
poppler mailing list
poppler@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/poppler


Re: [poppler] How to set custom 'share' directory

2017-11-01 Thread Jason Crain
On Wed, Nov 01, 2017 at 02:19:36PM +0100, Jeroen Ooms wrote:
> I maintain the poppler bindings for R which work on Windows, MacOS and
> Linux. However Chineese users on Windows/Mac have reported that
> poppler doesn't find the share data files:
> 
>   error: Missing language pack for 'Adobe-CNS1' mapping
> 
> Where exactly does poppler look for the 'share' directory? Is there an
> environment variable or libpoppler API that I can use to specify this
> location?

The encoding files are in the poppler-data package, not the poppler
package.  Likely your users need to install poppler-data.

On Mac and Linux the path is hardcoded at compilation time.  It's
generally in /usr/share/poppler on Linux.  Not sure what the standard is
on Mac.  On Windows it looks in \share\poppler relative to the
installation directory.
___
poppler mailing list
poppler@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/poppler


[poppler] How to set custom 'share' directory

2017-11-01 Thread Jeroen Ooms
I maintain the poppler bindings for R which work on Windows, MacOS and
Linux. However Chineese users on Windows/Mac have reported that
poppler doesn't find the share data files:

  error: Missing language pack for 'Adobe-CNS1' mapping

Where exactly does poppler look for the 'share' directory? Is there an
environment variable or libpoppler API that I can use to specify this
location?

Thank you
___
poppler mailing list
poppler@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/poppler