pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John Hewson <j...@jahewson.com>
Subject Re: Changing Font Cache File Directory
Date Mon, 30 May 2016 16:26:40 GMT

> On 29 May 2016, at 14:17, Aaron Mulder <ammulder@gmail.com> wrote:
> 
> I see that the file that the font cache file is saved to a location
> set by a system property.
> 
> I'm deploying my PDFBox app to OpenShift.  The font cache directory
> should be set to the value of an environment variable in that
> environment (or some offset from the path in the env var).  And, while
> I can set the system property to the environment variable, it's a
> one-time administrative action to change system properties, not
> something that happens on every deployment.
> 
> e.g.:
> 
> $OPENSHIFT_DATA_DIR=/var/some/cryptic/dir/app-root/data/
> 
> I can set -Dpdfbox.fontcache=$OPENSHIFT_DATA_DIR but once I put that
> in place, the value is fixed.

Why? Isn’t the point in an environmental variable that its, well… variable?

> If $OPENSHIFT_DATA_DIR later changes
> because they shuffle my VM or something, then the system property will
> still refer to the old location until I figure out there's a problem
> and go reset the system property.

I don’t really understand this. You’re saying that $OPENSHIFT_DATA_DIR changes
but your Java program keeps running? That’s not going to work.

> Long story short, I'd like some way to programmatically set the font
> cache directory, so I can run something like
> FileSystemFontProvider.setDiskCacheFile(...) before I do anything else
> with PDFBox.

That’s not going to be possible, firstly because FileSystemFontProvider is not
public and secondly because it relies on a static initializer, which does not
allow for the opportunity to call any methods beforehand.

> Would you accept a patch to add that to FileSystemFontProvider?  Add a
> property that defaults to null, and if set, its value takes priority
> over the current logic to calculate the cache file?
> 
> Thanks,
>       Aaron
> 
> P.S. Or, of course, if you want it to work automagically in OpenShift,
> the patch could be to check for env var OPENSHIFT_DATA_DIR and put the
> cache file there if that variable is defined.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
> For additional commands, e-mail: users-help@pdfbox.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org


Mime
View raw message