You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@pdfbox.apache.org by Alex Sviridov <oo...@mail.ru> on 2015/07/01 22:39:58 UTC

Can't map code X in font exception

 I have the following situation. I generate pdf files in libre office on ubuntu. The default font is Liberation Serif/Sans.

After that I run my application (with pdfbox) on windows and open that file from ubuntu. And I get a lot of exceptions. I suppose I have exception for every character!

Because of these exceptions the program runs very slow on windows. So how to solve it? Maybe throwing exception on every characted is not good?


-- 
Alex Sviridov

Re[2]: Can't map code X in font exception

Posted by Alex Sviridov <oo...@mail.ru>.
 This is really very serious problem. It itakes me more 10 minuts to get thumbnail images for 15 pages for the following file  https://yadi.sk/i/Hhzh7coNhcTgV on win7 !!!! In Lunux it's done in 3-4 seconds. 

This is problem. How to solve it?


Среда,  1 июля 2015, 23:56 -04:00 от Tres Finocchiaro <tr...@gmail.com>:
>From my experience the font mapping (1.8 branch) causes quite a bit of
>noise in the logs.
>
>And since 1.8 doesn't support embedding of fonts, the best way to suppress
>the warnings is to either use the same font on both platforms, or compile
>in a custom font mapping which will allow pdfbox to fallback onto a close
>equivalent.
>
>The issue here (I would suspect) is that Liberation (designed to be a free
>alternative to a proprietary font) is what PDFBOX is looking for rather
>than falling back on Times New Roman.
>
>I had a lot of these issues with 1.8, which is why I started compiling my
>own mapping in.
>
>https://github.com/qzindustries/qz-print/blob/1.8-pdfbox/pdfbox_1.8.4_qz/src/org/apache/pdfbox/resources/FontMapping.properties#L50
>
>I'm sure the reverse could be done for Linux font names when loading the
>PDF on Windows.
>
>-Tres
>
>-  Tres.Finocchiaro@gmail.com
>
>On Wed, Jul 1, 2015 at 4:46 PM, Tilman Hausherr < THausherr@t-online.de >
>wrote:
>
>> Am 01.07.2015 um 22:39 schrieb Alex Sviridov:
>>
>>>   I have the following situation. I generate pdf files in libre office on
>>> ubuntu. The default font is Liberation Serif/Sans.
>>>
>>> After that I run my application (with pdfbox) on windows and open that
>>> file from ubuntu. And I get a lot of exceptions. I suppose I have exception
>>> for every character!
>>>
>>
>> Are you sure it is exception and not just info or warning? And what are
>> these?
>>
>> Tilman
>>
>>
>>> Because of these exceptions the program runs very slow on windows. So how
>>> to solve it? Maybe throwing exception on every characted is not good?
>>>
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail:  users-unsubscribe@pdfbox.apache.org
>> For additional commands, e-mail:  users-help@pdfbox.apache.org
>>
>>


-- 
Alex Sviridov

Re: Can't map code X in font exception

Posted by Tres Finocchiaro <tr...@gmail.com>.
>From my experience the font mapping (1.8 branch) causes quite a bit of
noise in the logs.

And since 1.8 doesn't support embedding of fonts, the best way to suppress
the warnings is to either use the same font on both platforms, or compile
in a custom font mapping which will allow pdfbox to fallback onto a close
equivalent.

The issue here (I would suspect) is that Liberation (designed to be a free
alternative to a proprietary font) is what PDFBOX is looking for rather
than falling back on Times New Roman.

I had a lot of these issues with 1.8, which is why I started compiling my
own mapping in.

https://github.com/qzindustries/qz-print/blob/1.8-pdfbox/pdfbox_1.8.4_qz/src/org/apache/pdfbox/resources/FontMapping.properties#L50

I'm sure the reverse could be done for Linux font names when loading the
PDF on Windows.

-Tres

- Tres.Finocchiaro@gmail.com

On Wed, Jul 1, 2015 at 4:46 PM, Tilman Hausherr <TH...@t-online.de>
wrote:

> Am 01.07.2015 um 22:39 schrieb Alex Sviridov:
>
>>   I have the following situation. I generate pdf files in libre office on
>> ubuntu. The default font is Liberation Serif/Sans.
>>
>> After that I run my application (with pdfbox) on windows and open that
>> file from ubuntu. And I get a lot of exceptions. I suppose I have exception
>> for every character!
>>
>
> Are you sure it is exception and not just info or warning? And what are
> these?
>
> Tilman
>
>
>> Because of these exceptions the program runs very slow on windows. So how
>> to solve it? Maybe throwing exception on every characted is not good?
>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
> For additional commands, e-mail: users-help@pdfbox.apache.org
>
>

Re: Can't map code X in font exception

Posted by Tilman Hausherr <TH...@t-online.de>.
Am 03.07.2015 um 17:48 schrieb Alex Sviridov:
>   Is it possible to keep needed fonts in some folder and say to pdfbox where this folder is?

Look for FontMapper.setProvider() and then see the implementations of 
FontProvider and make your own.

Or look at WindowsFontDirFinder and change it.

Tilman

>
>
> Четверг,  2 июля 2015, 8:55 +02:00 от Tilman Hausherr <TH...@t-online.de>:
>> Am 02.07.2015 um 06:20 schrieb Alex Sviridov:
>>>    Yes you are right - warnings. So is it possible to avoid them?
>> - You could disable logging in the logging config
>> - You could remove the log entry in your own source code (if you're
>> building from source)
>>
>> @John - why do we get this warning if the page is rendered properly
>> anyway? Is the codeToGID() result needed at that place?
>>
>> Could this be cached?
>>
>> Tilman
>>
>>
>>>
>>> Среда,  1 июля 2015, 22:46 +02:00 от Tilman Hausherr < THausherr@t-online.de >:
>>>> Am 01.07.2015 um 22:39 schrieb Alex Sviridov:
>>>>>     I have the following situation. I generate pdf files in libre office on ubuntu. The default font is Liberation Serif/Sans.
>>>>>
>>>>> After that I run my application (with pdfbox) on windows and open that file from ubuntu. And I get a lot of exceptions. I suppose I have exception for every character!
>>>> Are you sure it is exception and not just info or warning? And what are
>>>> these?
>>>>
>>>> Tilman
>>>>
>>>>> Because of these exceptions the program runs very slow on windows. So how to solve it? Maybe throwing exception on every characted is not good?
>>>>>
>>>>>
>>>> ---------------------------------------------------------------------
>>>> 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
>>
>


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


Re[10]: Can't map code X in font exception

Posted by Alex Sviridov <oo...@mail.ru>.
 Is it possible to keep needed fonts in some folder and say to pdfbox where this folder is?


Четверг,  2 июля 2015, 8:55 +02:00 от Tilman Hausherr <TH...@t-online.de>:
>Am 02.07.2015 um 06:20 schrieb Alex Sviridov:
>>   Yes you are right - warnings. So is it possible to avoid them?
>
>- You could disable logging in the logging config
>- You could remove the log entry in your own source code (if you're 
>building from source)
>
>@John - why do we get this warning if the page is rendered properly 
>anyway? Is the codeToGID() result needed at that place?
>
>Could this be cached?
>
>Tilman
>
>
>>
>>
>> Среда,  1 июля 2015, 22:46 +02:00 от Tilman Hausherr < THausherr@t-online.de >:
>>> Am 01.07.2015 um 22:39 schrieb Alex Sviridov:
>>>>    I have the following situation. I generate pdf files in libre office on ubuntu. The default font is Liberation Serif/Sans.
>>>>
>>>> After that I run my application (with pdfbox) on windows and open that file from ubuntu. And I get a lot of exceptions. I suppose I have exception for every character!
>>> Are you sure it is exception and not just info or warning? And what are
>>> these?
>>>
>>> Tilman
>>>
>>>> Because of these exceptions the program runs very slow on windows. So how to solve it? Maybe throwing exception on every characted is not good?
>>>>
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> 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
>


-- 
Alex Sviridov

Re[2]: Can't map code X in font exception

Posted by Alex Sviridov <oo...@mail.ru>.


Понедельник,  6 июля 2015, 22:13 -07:00 от John Hewson <jo...@jahewson.com>:
>
>> On 1 Jul 2015, at 23:55, Tilman Hausherr < THausherr@t-online.de > wrote:
>> 
>> Am 02.07.2015 um 06:20 schrieb Alex Sviridov:
>>>  Yes you are right - warnings. So is it possible to avoid them?
>> 
>> - You could disable logging in the logging config
>> - You could remove the log entry in your own source code (if you're building from source)
>> 
>> @John - why do we get this warning if the page is rendered properly anyway? Is the codeToGID() result needed at that place?
>> 
>> Could this be cached?
>
>As we’re talking about 1.8, I’m not sure, it’s been a while since I looked at it. There’s some funny stuff in 1.8, for example there’s a good chance that codeToGID() neither accepts a code nor returns a GID!
No, I am working wth version 2.

>
>— John
>
>> Tilman
>> 
>> 
>>> 
>>> 
>>> Среда,  1 июля 2015, 22:46 +02:00 от Tilman Hausherr < THausherr@t-online.de >:
>>>> Am 01.07.2015 um 22:39 schrieb Alex Sviridov:
>>>>>   I have the following situation. I generate pdf files in libre office on ubuntu. The default font is Liberation Serif/Sans.
>>>>> 
>>>>> After that I run my application (with pdfbox) on windows and open that file from ubuntu. And I get a lot of exceptions. I suppose I have exception for every character!
>>>> Are you sure it is exception and not just info or warning? And what are
>>>> these?
>>>> 
>>>> Tilman
>>>> 
>>>>> Because of these exceptions the program runs very slow on windows. So how to solve it? Maybe throwing exception on every characted is not good?
>>>>> 
>>>>> 
>>>> 
>>>> ---------------------------------------------------------------------
>>>> 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
>> 
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail:  users-unsubscribe@pdfbox.apache.org
>For additional commands, e-mail:  users-help@pdfbox.apache.org
>


-- 
Alex Sviridov

Re: Can't map code X in font exception

Posted by John Hewson <jo...@jahewson.com>.
> On 6 Jul 2015, at 23:26, Tilman Hausherr <TH...@t-online.de> wrote:
> 
> Am 07.07.2015 um 07:13 schrieb John Hewson:
>>> On 1 Jul 2015, at 23:55, Tilman Hausherr <TH...@t-online.de> wrote:
>>> 
>>> Am 02.07.2015 um 06:20 schrieb Alex Sviridov:
>>>>  Yes you are right - warnings. So is it possible to avoid them?
>>> - You could disable logging in the logging config
>>> - You could remove the log entry in your own source code (if you're building from source)
>>> 
>>> @John - why do we get this warning if the page is rendered properly anyway? Is the codeToGID() result needed at that place?
>>> 
>>> Could this be cached?
>> As we’re talking about 1.8, I’m not sure, it’s been a while since I looked at it. There’s some funny stuff in 1.8, for example there’s a good chance that codeToGID() neither accepts a code nor returns a GID!
> 
> No, he's talking about 2.0

Ok, that’s more like it. These warnings are not the cause of slowness, I get the same messages on OS X where rendering the linked PDF takes a few seconds.

You’re quite right that the warning is spurious, it’s a side effect of the new code which I added to generate Encoding objects for TTFs. I’ll remove it in a future commit to PDFBOX-2842.

— John

> Tilman
> 
>> 
>> — John
>> 
>>> Tilman
>>> 
>>> 
>>>> 
>>>> Среда,  1 июля 2015, 22:46 +02:00 от Tilman Hausherr <TH...@t-online.de>:
>>>>> Am 01.07.2015 um 22:39 schrieb Alex Sviridov:
>>>>>>   I have the following situation. I generate pdf files in libre office on ubuntu. The default font is Liberation Serif/Sans.
>>>>>> 
>>>>>> After that I run my application (with pdfbox) on windows and open that file from ubuntu. And I get a lot of exceptions. I suppose I have exception for every character!
>>>>> Are you sure it is exception and not just info or warning? And what are
>>>>> these?
>>>>> 
>>>>> Tilman
>>>>> 
>>>>>> Because of these exceptions the program runs very slow on windows. So how to solve it? Maybe throwing exception on every characted is not good?
>>>>>> 
>>>>>> 
>>>>> ---------------------------------------------------------------------
>>>>> 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
>>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org <ma...@pdfbox.apache.org>
>> For additional commands, e-mail: users-help@pdfbox.apache.org <ma...@pdfbox.apache.org>
>> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org <ma...@pdfbox.apache.org>
> For additional commands, e-mail: users-help@pdfbox.apache.org <ma...@pdfbox.apache.org>

Re: Can't map code X in font exception

Posted by Tilman Hausherr <TH...@t-online.de>.
Am 07.07.2015 um 07:13 schrieb John Hewson:
>> On 1 Jul 2015, at 23:55, Tilman Hausherr <TH...@t-online.de> wrote:
>>
>> Am 02.07.2015 um 06:20 schrieb Alex Sviridov:
>>>   Yes you are right - warnings. So is it possible to avoid them?
>> - You could disable logging in the logging config
>> - You could remove the log entry in your own source code (if you're building from source)
>>
>> @John - why do we get this warning if the page is rendered properly anyway? Is the codeToGID() result needed at that place?
>>
>> Could this be cached?
> As we’re talking about 1.8, I’m not sure, it’s been a while since I looked at it. There’s some funny stuff in 1.8, for example there’s a good chance that codeToGID() neither accepts a code nor returns a GID!

No, he's talking about 2.0

Tilman

>
> — John
>
>> Tilman
>>
>>
>>>
>>> Среда,  1 июля 2015, 22:46 +02:00 от Tilman Hausherr <TH...@t-online.de>:
>>>> Am 01.07.2015 um 22:39 schrieb Alex Sviridov:
>>>>>    I have the following situation. I generate pdf files in libre office on ubuntu. The default font is Liberation Serif/Sans.
>>>>>
>>>>> After that I run my application (with pdfbox) on windows and open that file from ubuntu. And I get a lot of exceptions. I suppose I have exception for every character!
>>>> Are you sure it is exception and not just info or warning? And what are
>>>> these?
>>>>
>>>> Tilman
>>>>
>>>>> Because of these exceptions the program runs very slow on windows. So how to solve it? Maybe throwing exception on every characted is not good?
>>>>>
>>>>>
>>>> ---------------------------------------------------------------------
>>>> 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
>>
>
> ---------------------------------------------------------------------
> 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


Re: Can't map code X in font exception

Posted by John Hewson <jo...@jahewson.com>.
> On 1 Jul 2015, at 23:55, Tilman Hausherr <TH...@t-online.de> wrote:
> 
> Am 02.07.2015 um 06:20 schrieb Alex Sviridov:
>>  Yes you are right - warnings. So is it possible to avoid them?
> 
> - You could disable logging in the logging config
> - You could remove the log entry in your own source code (if you're building from source)
> 
> @John - why do we get this warning if the page is rendered properly anyway? Is the codeToGID() result needed at that place?
> 
> Could this be cached?

As we’re talking about 1.8, I’m not sure, it’s been a while since I looked at it. There’s some funny stuff in 1.8, for example there’s a good chance that codeToGID() neither accepts a code nor returns a GID!

— John

> Tilman
> 
> 
>> 
>> 
>> Среда,  1 июля 2015, 22:46 +02:00 от Tilman Hausherr <TH...@t-online.de>:
>>> Am 01.07.2015 um 22:39 schrieb Alex Sviridov:
>>>>   I have the following situation. I generate pdf files in libre office on ubuntu. The default font is Liberation Serif/Sans.
>>>> 
>>>> After that I run my application (with pdfbox) on windows and open that file from ubuntu. And I get a lot of exceptions. I suppose I have exception for every character!
>>> Are you sure it is exception and not just info or warning? And what are
>>> these?
>>> 
>>> Tilman
>>> 
>>>> Because of these exceptions the program runs very slow on windows. So how to solve it? Maybe throwing exception on every characted is not good?
>>>> 
>>>> 
>>> 
>>> ---------------------------------------------------------------------
>>> 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
> 


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


Re: Can't map code X in font exception

Posted by Tilman Hausherr <TH...@t-online.de>.
Am 02.07.2015 um 06:20 schrieb Alex Sviridov:
>   Yes you are right - warnings. So is it possible to avoid them?

- You could disable logging in the logging config
- You could remove the log entry in your own source code (if you're 
building from source)

@John - why do we get this warning if the page is rendered properly 
anyway? Is the codeToGID() result needed at that place?

Could this be cached?

Tilman


>
>
> Среда,  1 июля 2015, 22:46 +02:00 от Tilman Hausherr <TH...@t-online.de>:
>> Am 01.07.2015 um 22:39 schrieb Alex Sviridov:
>>>    I have the following situation. I generate pdf files in libre office on ubuntu. The default font is Liberation Serif/Sans.
>>>
>>> After that I run my application (with pdfbox) on windows and open that file from ubuntu. And I get a lot of exceptions. I suppose I have exception for every character!
>> Are you sure it is exception and not just info or warning? And what are
>> these?
>>
>> Tilman
>>
>>> Because of these exceptions the program runs very slow on windows. So how to solve it? Maybe throwing exception on every characted is not good?
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> 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


Re[2]: Can't map code X in font exception

Posted by Alex Sviridov <oo...@mail.ru>.
 Yes you are right - warnings. So is it possible to avoid them?


Среда,  1 июля 2015, 22:46 +02:00 от Tilman Hausherr <TH...@t-online.de>:
>Am 01.07.2015 um 22:39 schrieb Alex Sviridov:
>>   I have the following situation. I generate pdf files in libre office on ubuntu. The default font is Liberation Serif/Sans.
>>
>> After that I run my application (with pdfbox) on windows and open that file from ubuntu. And I get a lot of exceptions. I suppose I have exception for every character!
>
>Are you sure it is exception and not just info or warning? And what are 
>these?
>
>Tilman
>
>>
>> Because of these exceptions the program runs very slow on windows. So how to solve it? Maybe throwing exception on every characted is not good?
>>
>>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail:  users-unsubscribe@pdfbox.apache.org
>For additional commands, e-mail:  users-help@pdfbox.apache.org
>


-- 
Alex Sviridov

Re: Can't map code X in font exception

Posted by Tilman Hausherr <TH...@t-online.de>.
Am 01.07.2015 um 22:39 schrieb Alex Sviridov:
>   I have the following situation. I generate pdf files in libre office on ubuntu. The default font is Liberation Serif/Sans.
>
> After that I run my application (with pdfbox) on windows and open that file from ubuntu. And I get a lot of exceptions. I suppose I have exception for every character!

Are you sure it is exception and not just info or warning? And what are 
these?

Tilman

>
> Because of these exceptions the program runs very slow on windows. So how to solve it? Maybe throwing exception on every characted is not good?
>
>


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