You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by Jack London <wi...@gmail.com> on 2021/03/26 10:20:04 UTC

*** Possible bug in PDFBox Creating PDFwith TTF ***

Hi!

I compiled the version pdfbox-2.0.23 source code and the following examples
are not working:

1) HelloWorldTTF.java
2) CreatePDFA.java

I have the following dump after trying to call the function
"getExternalCMap(name);" in line 99 of file CMapParser.java (package
org.apache.fontbox.cmap), where name = "Identity-H", :

Exception in thread "main" java.io.IOException: Stream closed
at
java.base/java.io.BufferedInputStream.getInIfOpen(BufferedInputStream.java:157)
at java.base/java.io.BufferedInputStream.fill(BufferedInputStream.java:244)
at java.base/java.io.BufferedInputStream.read(BufferedInputStream.java:263)
at java.base/java.io.FilterInputStream.read(FilterInputStream.java:82)
at java.base/java.io.PushbackInputStream.read(PushbackInputStream.java:135)
at org.apache.fontbox.cmap.CMapParser.parseNextToken(CMapParser.java:479)
at org.apache.fontbox.cmap.CMapParser.parse(CMapParser.java:126)
at org.apache.fontbox.cmap.CMapParser.parsePredefined(CMapParser.java:102)
at
org.apache.pdfbox.pdmodel.font.CMapManager.getPredefinedCMap(CMapManager.java:55)
at
org.apache.pdfbox.pdmodel.font.PDType0Font.readEncoding(PDType0Font.java:280)
at org.apache.pdfbox.pdmodel.font.PDType0Font.<init>(PDType0Font.java:222)
at org.apache.pdfbox.pdmodel.font.PDType0Font.load(PDType0Font.java:67)
at
org.apache.pdfbox.examples.pdmodel.HelloWorldTTF.main(HelloWorldTTF.java:79)

Exception in thread "main" java.io.IOException: Stream closed
at
java.base/java.io.BufferedInputStream.getInIfOpen(BufferedInputStream.java:157)
at java.base/java.io.BufferedInputStream.fill(BufferedInputStream.java:244)
at java.base/java.io.BufferedInputStream.read(BufferedInputStream.java:263)
at java.base/java.io.FilterInputStream.read(FilterInputStream.java:82)
at java.base/java.io.PushbackInputStream.read(PushbackInputStream.java:135)
at org.apache.fontbox.cmap.CMapParser.parseNextToken(CMapParser.java:479)
at org.apache.fontbox.cmap.CMapParser.parse(CMapParser.java:126)
at org.apache.fontbox.cmap.CMapParser.parsePredefined(CMapParser.java:102)
at
org.apache.pdfbox.pdmodel.font.CMapManager.getPredefinedCMap(CMapManager.java:55)
at
org.apache.pdfbox.pdmodel.font.PDType0Font.readEncoding(PDType0Font.java:280)
at org.apache.pdfbox.pdmodel.font.PDType0Font.<init>(PDType0Font.java:222)
at org.apache.pdfbox.pdmodel.font.PDType0Font.load(PDType0Font.java:67)
at org.apache.pdfbox.examples.pdmodel.CreatePDFA.main(CreatePDFA.java:88)

Hope someone can help me with this one.

Jack

Re: *** Possible bug in PDFBox Creating PDFwith TTF ***

Posted by Tilman Hausherr <TH...@t-online.de>.
Did you see Andreas' answer?

Check if the file "Identity-H" is part of your project.

If you're building from source, then you need to build like we build, 
and this uses maven.

Tilman

Am 26.03.2021 um 17:47 schrieb Jack London:
> Hi!
>
> I didn't modify the code only to bypass parameters, so it is reading the
> files.
>
> I need the sources because I will modify it once it works. For now the code
> I compile is only reading PDF and generating an image of the PDF, creating
> PDF with graphics only or with already embedded fonts(like Helvetica). It
> reads the Truetype file, but it can't embedded it because it cannot create
> a cmap (with getExternalCMap(name)) for name = "Identity-H".
>
> This can't be anything with my system because I am running the application
> through Eclipse. I don't create a jar and I don't execute it with line
> commands. I do it directly inside Eclipse. So, it can't be the system. I
> don't need maven because I am using Eclipse. Perhaps there is a special
> order to compile things. Do you think? I find that strange.
>
> Also I compiled CreatePDFATest, but it doesn't have a main. I don't know
> how to use Junit. Anyway, I examined CreatePDFATest, and CreatePDFA crashes
> much earlier, at line 91:
>
> PDFont font = PDType0Font.load(doc, new File(fontfile));
>
> So the test won't help here.
>
> Cheers.
>
> Jack
>
> On Fri, Mar 26, 2021 at 12:05 PM Tilman Hausherr <TH...@t-online.de>
> wrote:
>
>> Hi,
>>
>> I tried both and they work. You don't need BC unless you're encrypting.
>> Commons-log is needed.
>> Did you use the code "as is" (loading from file) or did you use the font
>> as a class resource? (There's the resource filtering mistake)
>>
>> You don't need the sources, you need the pdfbox and fontbox jar files
>> (use maven if possible), and of course the example source that you're
>> using. I mentioned the test because it means that it's working at build
>> time. I'll create a test for two of the HelloWorld tests too.
>>
>> To see if your system is ok, download pdfbox-app and then run this on
>> the command line
>>
>>
>>         java -jar pdfbox-app-2.0.23.jar TextToPDF -ttf fontfile.ttf
>> yourtext.txt yourpdf.pdf
>>
>>
>> and see what happens.
>>
>> Tilman
>>
>>
>>
>>


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


Re: *** Possible bug in PDFBox Creating PDFwith TTF ***

Posted by Jack London <wi...@gmail.com>.
Hi!

I didn't modify the code only to bypass parameters, so it is reading the
files.

I need the sources because I will modify it once it works. For now the code
I compile is only reading PDF and generating an image of the PDF, creating
PDF with graphics only or with already embedded fonts(like Helvetica). It
reads the Truetype file, but it can't embedded it because it cannot create
a cmap (with getExternalCMap(name)) for name = "Identity-H".

This can't be anything with my system because I am running the application
through Eclipse. I don't create a jar and I don't execute it with line
commands. I do it directly inside Eclipse. So, it can't be the system. I
don't need maven because I am using Eclipse. Perhaps there is a special
order to compile things. Do you think? I find that strange.

Also I compiled CreatePDFATest, but it doesn't have a main. I don't know
how to use Junit. Anyway, I examined CreatePDFATest, and CreatePDFA crashes
much earlier, at line 91:

PDFont font = PDType0Font.load(doc, new File(fontfile));

So the test won't help here.

Cheers.

Jack

On Fri, Mar 26, 2021 at 12:05 PM Tilman Hausherr <TH...@t-online.de>
wrote:

> Hi,
>
> I tried both and they work. You don't need BC unless you're encrypting.
> Commons-log is needed.
> Did you use the code "as is" (loading from file) or did you use the font
> as a class resource? (There's the resource filtering mistake)
>
> You don't need the sources, you need the pdfbox and fontbox jar files
> (use maven if possible), and of course the example source that you're
> using. I mentioned the test because it means that it's working at build
> time. I'll create a test for two of the HelloWorld tests too.
>
> To see if your system is ok, download pdfbox-app and then run this on
> the command line
>
>
>        java -jar pdfbox-app-2.0.23.jar TextToPDF -ttf fontfile.ttf
> yourtext.txt yourpdf.pdf
>
>
> and see what happens.
>
> Tilman
>
>
>
>

Re: *** Possible bug in PDFBox Creating PDFwith TTF ***

Posted by Tilman Hausherr <TH...@t-online.de>.
Hi,

I tried both and they work. You don't need BC unless you're encrypting. 
Commons-log is needed.
Did you use the code "as is" (loading from file) or did you use the font 
as a class resource? (There's the resource filtering mistake)

You don't need the sources, you need the pdfbox and fontbox jar files 
(use maven if possible), and of course the example source that you're 
using. I mentioned the test because it means that it's working at build 
time. I'll create a test for two of the HelloWorld tests too.

To see if your system is ok, download pdfbox-app and then run this on 
the command line


       java -jar pdfbox-app-2.0.23.jar TextToPDF -ttf fontfile.ttf 
yourtext.txt yourpdf.pdf


and see what happens.

Tilman


Am 26.03.2021 um 13:12 schrieb Jack London:
> Hi Tilman,
>
> Thanks for your reply!
>
> It doesn't happen with *Helvetica*, for example, but these don't need to be
> embedded because they are already embedded (HelloWorld.java example works,
> of course). I was not able to try with Type 1 fonts because the ones I have
> are pfa not pfb (PDFBox can't read pfa), since I only use them in
> PostScript. Somehow, sites offering Type 1 fonts completely disappeared
> from the web, since Adobe is not supporting them any more. We shouldn't use
> Type 1 anymore, but PDFBox can't read PostScript Opentype, only if they are
> Truetype (I had already isolated the parser in another project and it
> doesn't even read them). Actually the only way I was able to read
> PostScript Opentype was with Opentype.js. It is incredible, but I couldn't
> find any decent Java parser that could handle those. In theory, PostScript
> Opentype should be read in PDFbox, since Type 1 fonts are not supported
> anymore. This is already a problem in itself, but another subject.
>
> If you meant if I tried several Truetype fonts, yes I did. I tried
> *verdana.ttf*, *Comfortaa-Bold.ttf* and *Roboto-Black.ttf*. They all give
> the same error. I have the impression that *embedding Truetype fonts is not
> working*.  Has anybody here already done this?
>
> The tests are a *great idea*. I didn't integrate them in my PDFBox project
> to make it slimmer, but you are definitely right, I will do that.
>
> I am not quite sure what you mean with *"Also check that your class path
> has only one version of pdfbox and fontbox"*. I downloaded the whole source
> supplied for pdfbox-2.0.23. Is it possible to have a different version
> for *pdfbox
> *and *fontbox *in the same release of the source code?  But in any case I
> have no way to see if they are from different versions because that's the
> way they were released. I compiled the whole block of source code with no
> libraries. I was forced to search sources for LOG and bouncycastle because
> they are not included in the source code of PDFBox. LOG I had already used
> for the parser previously and it works. It seems to work in pdfbox-2.0.23
> too. The second is version 1.68.99, and I am not sure it works with this
> version of PDFBox. I have no clue if this version of bouncycastle could
> influence pdfbox-2.0.23 for embedding Truetype fonts. Could it do this?
>
> Thanks for your help.
>
> Best regards,
>
> Jack
>
> On Fri, Mar 26, 2021 at 6:52 AM Tilman Hausherr <TH...@t-online.de>
> wrote:
>
>> does it also happen with a different font? The CreatePDFA example is
>> covered by a test, the other one isn't.
>>
>> Also check that your class path has only one version of pdfbox and fontbox.
>>
>> Tilman
>>
>>
>>
>> --- Original-Nachricht ---
>> Von: Jack London
>> Betreff: *** Possible bug in PDFBox Creating PDFwith TTF ***
>> Datum: 26. März 2021, 11:20
>> An: dev@pdfbox.apache.org
>>
>>
>>
>>
>> Hi!
>>
>> I compiled the version pdfbox-2.0.23 source code and the following examples
>> are not working:
>>
>> 1) HelloWorldTTF.java
>> 2) CreatePDFA.java
>>
>> I have the following dump after trying to call the function
>> "getExternalCMap(name);" in line 99 of file CMapParser.java (package
>> <http://org.apache.fontbox.cmap>
>> ), where name = "Identity-H", :
>>
>> Exception in thread "main"<http://java.io.IOException> : Stream closed
>> at
>> <
>> http://java.base/java.io.BufferedInputStream.getInIfOpen(BufferedInputStream.java:157
>> )
>> at
>> <
>> http://java.base/java.io.BufferedInputStream.fill(BufferedInputStream.java:244>
>>
>> )
>> at
>> <
>> http://java.base/java.io.BufferedInputStream.read(BufferedInputStream.java:263>
>>
>> )
>> at
>> <http://java.base/java.io.FilterInputStream.read(FilterInputStream.java:82>
>>
>> )
>> at
>> <
>> http://java.base/java.io.PushbackInputStream.read(PushbackInputStream.java:135>
>>
>> )
>> at
>> <http://org.apache.fontbox.cmap.CMapParser.parseNextToken(CMapParser.java:479>
>>
>> )
>> at<http://org.apache.fontbox.cmap.CMapParser.parse(CMapParser.java:126> )
>> at
>> <http://org.apache.fontbox.cmap.CMapParser.parsePredefined(CMapParser.java:102>
>>
>> )
>> at
>> <http://org.apache.pdfbox.pdmodel.font.CMapManager.getPredefinedCMap
>> (CMapManager.java:55>
>> )
>> at
>> <http://org.apache.pdfbox.pdmodel.font.PDType0Font.readEncoding
>> (PDType0Font.java:280>
>> )
>> at org.apache.pdfbox.pdmodel.font.PDType0Font.<init>(PDType0Font.java:222)
>> at
>> <http://org.apache.pdfbox.pdmodel.font.PDType0Font.load(PDType0Font.java:67>
>>
>> )
>> at
>> <http://org.apache.pdfbox.examples.pdmodel.HelloWorldTTF.main
>> (HelloWorldTTF.java:79>
>> )
>>
>> Exception in thread "main"<http://java.io.IOException> : Stream closed
>> at
>> <
>> http://java.base/java.io.BufferedInputStream.getInIfOpen(BufferedInputStream.java:157
>> )
>> at
>> <
>> http://java.base/java.io.BufferedInputStream.fill(BufferedInputStream.java:244>
>>
>> )
>> at
>> <
>> http://java.base/java.io.BufferedInputStream.read(BufferedInputStream.java:263>
>>
>> )
>> at
>> <http://java.base/java.io.FilterInputStream.read(FilterInputStream.java:82>
>>
>> )
>> at
>> <
>> http://java.base/java.io.PushbackInputStream.read(PushbackInputStream.java:135>
>>
>> )
>> at
>> <http://org.apache.fontbox.cmap.CMapParser.parseNextToken(CMapParser.java:479>
>>
>> )
>> at<http://org.apache.fontbox.cmap.CMapParser.parse(CMapParser.java:126> )
>> at
>> <http://org.apache.fontbox.cmap.CMapParser.parsePredefined(CMapParser.java:102>
>>
>> )
>> at
>> <http://org.apache.pdfbox.pdmodel.font.CMapManager.getPredefinedCMap
>> (CMapManager.java:55>
>> )
>> at
>> <http://org.apache.pdfbox.pdmodel.font.PDType0Font.readEncoding
>> (PDType0Font.java:280>
>> )
>> at org.apache.pdfbox.pdmodel.font.PDType0Font.<init>(PDType0Font.java:222)
>> at
>> <http://org.apache.pdfbox.pdmodel.font.PDType0Font.load(PDType0Font.java:67>
>>
>> )
>> at
>> <http://org.apache.pdfbox.examples.pdmodel.CreatePDFA.main(CreatePDFA.java:88>
>>
>> )
>>
>> Hope someone can help me with this one.
>>
>> Jack
>>


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


Re: *** Possible bug in PDFBox Creating PDFwith TTF ***

Posted by Jack London <wi...@gmail.com>.
Hi Tilman,

Thanks for your reply!

It doesn't happen with *Helvetica*, for example, but these don't need to be
embedded because they are already embedded (HelloWorld.java example works,
of course). I was not able to try with Type 1 fonts because the ones I have
are pfa not pfb (PDFBox can't read pfa), since I only use them in
PostScript. Somehow, sites offering Type 1 fonts completely disappeared
from the web, since Adobe is not supporting them any more. We shouldn't use
Type 1 anymore, but PDFBox can't read PostScript Opentype, only if they are
Truetype (I had already isolated the parser in another project and it
doesn't even read them). Actually the only way I was able to read
PostScript Opentype was with Opentype.js. It is incredible, but I couldn't
find any decent Java parser that could handle those. In theory, PostScript
Opentype should be read in PDFbox, since Type 1 fonts are not supported
anymore. This is already a problem in itself, but another subject.

If you meant if I tried several Truetype fonts, yes I did. I tried
*verdana.ttf*, *Comfortaa-Bold.ttf* and *Roboto-Black.ttf*. They all give
the same error. I have the impression that *embedding Truetype fonts is not
working*.  Has anybody here already done this?

The tests are a *great idea*. I didn't integrate them in my PDFBox project
to make it slimmer, but you are definitely right, I will do that.

I am not quite sure what you mean with *"Also check that your class path
has only one version of pdfbox and fontbox"*. I downloaded the whole source
supplied for pdfbox-2.0.23. Is it possible to have a different version
for *pdfbox
*and *fontbox *in the same release of the source code?  But in any case I
have no way to see if they are from different versions because that's the
way they were released. I compiled the whole block of source code with no
libraries. I was forced to search sources for LOG and bouncycastle because
they are not included in the source code of PDFBox. LOG I had already used
for the parser previously and it works. It seems to work in pdfbox-2.0.23
too. The second is version 1.68.99, and I am not sure it works with this
version of PDFBox. I have no clue if this version of bouncycastle could
influence pdfbox-2.0.23 for embedding Truetype fonts. Could it do this?

Thanks for your help.

Best regards,

Jack

On Fri, Mar 26, 2021 at 6:52 AM Tilman Hausherr <TH...@t-online.de>
wrote:

> does it also happen with a different font? The CreatePDFA example is
> covered by a test, the other one isn't.
>
> Also check that your class path has only one version of pdfbox and fontbox.
>
> Tilman
>
>
>
> --- Original-Nachricht ---
> Von: Jack London
> Betreff: *** Possible bug in PDFBox Creating PDFwith TTF ***
> Datum: 26. März 2021, 11:20
> An: dev@pdfbox.apache.org
>
>
>
>
> Hi!
>
> I compiled the version pdfbox-2.0.23 source code and the following examples
> are not working:
>
> 1) HelloWorldTTF.java
> 2) CreatePDFA.java
>
> I have the following dump after trying to call the function
> "getExternalCMap(name);" in line 99 of file CMapParser.java (package
> <http://org.apache.fontbox.cmap>
> ), where name = "Identity-H", :
>
> Exception in thread "main"<http://java.io.IOException> : Stream closed
> at
> <
> http://java.base/java.io.BufferedInputStream.getInIfOpen(BufferedInputStream.java:157
> >
> )
> at
> <
> http://java.base/java.io.BufferedInputStream.fill(BufferedInputStream.java:244>
>
> )
> at
> <
> http://java.base/java.io.BufferedInputStream.read(BufferedInputStream.java:263>
>
> )
> at
> <http://java.base/java.io.FilterInputStream.read(FilterInputStream.java:82>
>
> )
> at
> <
> http://java.base/java.io.PushbackInputStream.read(PushbackInputStream.java:135>
>
> )
> at
> <http://org.apache.fontbox.cmap.CMapParser.parseNextToken(CMapParser.java:479>
>
> )
> at<http://org.apache.fontbox.cmap.CMapParser.parse(CMapParser.java:126> )
> at
> <http://org.apache.fontbox.cmap.CMapParser.parsePredefined(CMapParser.java:102>
>
> )
> at
> <http://org.apache.pdfbox.pdmodel.font.CMapManager.getPredefinedCMap
> (CMapManager.java:55>
> )
> at
> <http://org.apache.pdfbox.pdmodel.font.PDType0Font.readEncoding
> (PDType0Font.java:280>
> )
> at org.apache.pdfbox.pdmodel.font.PDType0Font.<init>(PDType0Font.java:222)
> at
> <http://org.apache.pdfbox.pdmodel.font.PDType0Font.load(PDType0Font.java:67>
>
> )
> at
> <http://org.apache.pdfbox.examples.pdmodel.HelloWorldTTF.main
> (HelloWorldTTF.java:79>
> )
>
> Exception in thread "main"<http://java.io.IOException> : Stream closed
> at
> <
> http://java.base/java.io.BufferedInputStream.getInIfOpen(BufferedInputStream.java:157
> >
> )
> at
> <
> http://java.base/java.io.BufferedInputStream.fill(BufferedInputStream.java:244>
>
> )
> at
> <
> http://java.base/java.io.BufferedInputStream.read(BufferedInputStream.java:263>
>
> )
> at
> <http://java.base/java.io.FilterInputStream.read(FilterInputStream.java:82>
>
> )
> at
> <
> http://java.base/java.io.PushbackInputStream.read(PushbackInputStream.java:135>
>
> )
> at
> <http://org.apache.fontbox.cmap.CMapParser.parseNextToken(CMapParser.java:479>
>
> )
> at<http://org.apache.fontbox.cmap.CMapParser.parse(CMapParser.java:126> )
> at
> <http://org.apache.fontbox.cmap.CMapParser.parsePredefined(CMapParser.java:102>
>
> )
> at
> <http://org.apache.pdfbox.pdmodel.font.CMapManager.getPredefinedCMap
> (CMapManager.java:55>
> )
> at
> <http://org.apache.pdfbox.pdmodel.font.PDType0Font.readEncoding
> (PDType0Font.java:280>
> )
> at org.apache.pdfbox.pdmodel.font.PDType0Font.<init>(PDType0Font.java:222)
> at
> <http://org.apache.pdfbox.pdmodel.font.PDType0Font.load(PDType0Font.java:67>
>
> )
> at
> <http://org.apache.pdfbox.examples.pdmodel.CreatePDFA.main(CreatePDFA.java:88>
>
> )
>
> Hope someone can help me with this one.
>
> Jack
>

AW: *** Possible bug in PDFBox Creating PDFwith TTF ***

Posted by Tilman Hausherr <TH...@t-online.de>.
does it also happen with a different font? The CreatePDFA example is 
covered by a test, the other one isn't.

Also check that your class path has only one version of pdfbox and fontbox.

Tilman



--- Original-Nachricht ---
Von: Jack London
Betreff: *** Possible bug in PDFBox Creating PDFwith TTF ***
Datum: 26. März 2021, 11:20
An: dev@pdfbox.apache.org




Hi!

I compiled the version pdfbox-2.0.23 source code and the following examples
are not working:

1) HelloWorldTTF.java
2) CreatePDFA.java

I have the following dump after trying to call the function
"getExternalCMap(name);" in line 99 of file CMapParser.java (package
<http://org.apache.fontbox.cmap>
), where name = "Identity-H", :

Exception in thread "main"<http://java.io.IOException> : Stream closed
at
<http://java.base/java.io.BufferedInputStream.getInIfOpen(BufferedInputStream.java:157>
)
at
<http://java.base/java.io.BufferedInputStream.fill(BufferedInputStream.java:244> 
)
at
<http://java.base/java.io.BufferedInputStream.read(BufferedInputStream.java:263> 
)
at
<http://java.base/java.io.FilterInputStream.read(FilterInputStream.java:82> 
)
at
<http://java.base/java.io.PushbackInputStream.read(PushbackInputStream.java:135> 
)
at
<http://org.apache.fontbox.cmap.CMapParser.parseNextToken(CMapParser.java:479> 
)
at<http://org.apache.fontbox.cmap.CMapParser.parse(CMapParser.java:126> )
at
<http://org.apache.fontbox.cmap.CMapParser.parsePredefined(CMapParser.java:102> 
)
at
<http://org.apache.pdfbox.pdmodel.font.CMapManager.getPredefinedCMap(CMapManager.java:55>
)
at
<http://org.apache.pdfbox.pdmodel.font.PDType0Font.readEncoding(PDType0Font.java:280>
)
at org.apache.pdfbox.pdmodel.font.PDType0Font.<init>(PDType0Font.java:222)
at
<http://org.apache.pdfbox.pdmodel.font.PDType0Font.load(PDType0Font.java:67> 
)
at
<http://org.apache.pdfbox.examples.pdmodel.HelloWorldTTF.main(HelloWorldTTF.java:79>
)

Exception in thread "main"<http://java.io.IOException> : Stream closed
at
<http://java.base/java.io.BufferedInputStream.getInIfOpen(BufferedInputStream.java:157>
)
at
<http://java.base/java.io.BufferedInputStream.fill(BufferedInputStream.java:244> 
)
at
<http://java.base/java.io.BufferedInputStream.read(BufferedInputStream.java:263> 
)
at
<http://java.base/java.io.FilterInputStream.read(FilterInputStream.java:82> 
)
at
<http://java.base/java.io.PushbackInputStream.read(PushbackInputStream.java:135> 
)
at
<http://org.apache.fontbox.cmap.CMapParser.parseNextToken(CMapParser.java:479> 
)
at<http://org.apache.fontbox.cmap.CMapParser.parse(CMapParser.java:126> )
at
<http://org.apache.fontbox.cmap.CMapParser.parsePredefined(CMapParser.java:102> 
)
at
<http://org.apache.pdfbox.pdmodel.font.CMapManager.getPredefinedCMap(CMapManager.java:55>
)
at
<http://org.apache.pdfbox.pdmodel.font.PDType0Font.readEncoding(PDType0Font.java:280>
)
at org.apache.pdfbox.pdmodel.font.PDType0Font.<init>(PDType0Font.java:222)
at
<http://org.apache.pdfbox.pdmodel.font.PDType0Font.load(PDType0Font.java:67> 
)
at
<http://org.apache.pdfbox.examples.pdmodel.CreatePDFA.main(CreatePDFA.java:88> 
)

Hope someone can help me with this one.

Jack

Re: *** Possible bug in PDFBox Creating PDFwith TTF ***

Posted by Tilman Hausherr <TH...@t-online.de>.
".....\PDFBox reactor 
2\fontbox\src\main\resources\org\apache\fontbox\cmap\Identity-H"

Tilman

Am 26.03.2021 um 17:53 schrieb Jack London:
> Hi Andreas!
>
> Thanks for the help.
>
> Could you tell which "cmap files" are missing? What do you mean with
> "classpath"? All I have are the packages. Indeed some resources I didn't
> put, but I didn't see any "cmap files". Could you please detail them a bit
> more? In which package they are? what are their names?
>
> Cheers.
>
> Jack.
>
>
>
>
> On Fri, Mar 26, 2021 at 12:31 PM Andreas Lehmkuehler <an...@lehmi.de>
> wrote:
>
>> Am 26.03.21 um 11:20 schrieb Jack London:
>>> Hi!
>>>
>>> I compiled the version pdfbox-2.0.23 source code and the following
>> examples
>>> are not working:
>>>
>>> 1) HelloWorldTTF.java
>>> 2) CreatePDFA.java
>>>
>>> I have the following dump after trying to call the function
>>> "getExternalCMap(name);" in line 99 of file CMapParser.java (package
>>> org.apache.fontbox.cmap), where name = "Identity-H", :
>> Looks like the cmap files are missing. They are part of the fontbox
>> resources
>> and have to be on the classpath. If you aren't using the precompiled
>> binaries
>> you have to ensure that on your own.
>>
>> Andreas
>>
>>> Exception in thread "main" java.io.IOException: Stream closed
>>> at
>>> java.base/java.io
>> .BufferedInputStream.getInIfOpen(BufferedInputStream.java:157)
>>> at java.base/java.io
>> .BufferedInputStream.fill(BufferedInputStream.java:244)
>>> at java.base/java.io
>> .BufferedInputStream.read(BufferedInputStream.java:263)
>>> at java.base/java.io.FilterInputStream.read(FilterInputStream.java:82)
>>> at java.base/java.io
>> .PushbackInputStream.read(PushbackInputStream.java:135)
>>> at org.apache.fontbox.cmap.CMapParser.parseNextToken(CMapParser.java:479)
>>> at org.apache.fontbox.cmap.CMapParser.parse(CMapParser.java:126)
>>> at
>> org.apache.fontbox.cmap.CMapParser.parsePredefined(CMapParser.java:102)
>>> at
>>>
>> org.apache.pdfbox.pdmodel.font.CMapManager.getPredefinedCMap(CMapManager.java:55)
>>> at
>>>
>> org.apache.pdfbox.pdmodel.font.PDType0Font.readEncoding(PDType0Font.java:280)
>>> at
>> org.apache.pdfbox.pdmodel.font.PDType0Font.<init>(PDType0Font.java:222)
>>> at org.apache.pdfbox.pdmodel.font.PDType0Font.load(PDType0Font.java:67)
>>> at
>>>
>> org.apache.pdfbox.examples.pdmodel.HelloWorldTTF.main(HelloWorldTTF.java:79)
>>> Exception in thread "main" java.io.IOException: Stream closed
>>> at
>>> java.base/java.io
>> .BufferedInputStream.getInIfOpen(BufferedInputStream.java:157)
>>> at java.base/java.io
>> .BufferedInputStream.fill(BufferedInputStream.java:244)
>>> at java.base/java.io
>> .BufferedInputStream.read(BufferedInputStream.java:263)
>>> at java.base/java.io.FilterInputStream.read(FilterInputStream.java:82)
>>> at java.base/java.io
>> .PushbackInputStream.read(PushbackInputStream.java:135)
>>> at org.apache.fontbox.cmap.CMapParser.parseNextToken(CMapParser.java:479)
>>> at org.apache.fontbox.cmap.CMapParser.parse(CMapParser.java:126)
>>> at
>> org.apache.fontbox.cmap.CMapParser.parsePredefined(CMapParser.java:102)
>>> at
>>>
>> org.apache.pdfbox.pdmodel.font.CMapManager.getPredefinedCMap(CMapManager.java:55)
>>> at
>>>
>> org.apache.pdfbox.pdmodel.font.PDType0Font.readEncoding(PDType0Font.java:280)
>>> at
>> org.apache.pdfbox.pdmodel.font.PDType0Font.<init>(PDType0Font.java:222)
>>> at org.apache.pdfbox.pdmodel.font.PDType0Font.load(PDType0Font.java:67)
>>> at org.apache.pdfbox.examples.pdmodel.CreatePDFA.main(CreatePDFA.java:88)
>>>
>>> Hope someone can help me with this one.
>>>
>>> Jack
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
>> For additional commands, e-mail: dev-help@pdfbox.apache.org
>>
>>


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


Re: *** Possible bug in PDFBox Creating PDFwith TTF ***

Posted by Jack London <wi...@gmail.com>.
Hi Andreas!

Thanks for the help.

Could you tell which "cmap files" are missing? What do you mean with
"classpath"? All I have are the packages. Indeed some resources I didn't
put, but I didn't see any "cmap files". Could you please detail them a bit
more? In which package they are? what are their names?

Cheers.

Jack.




On Fri, Mar 26, 2021 at 12:31 PM Andreas Lehmkuehler <an...@lehmi.de>
wrote:

> Am 26.03.21 um 11:20 schrieb Jack London:
> > Hi!
> >
> > I compiled the version pdfbox-2.0.23 source code and the following
> examples
> > are not working:
> >
> > 1) HelloWorldTTF.java
> > 2) CreatePDFA.java
> >
> > I have the following dump after trying to call the function
> > "getExternalCMap(name);" in line 99 of file CMapParser.java (package
> > org.apache.fontbox.cmap), where name = "Identity-H", :
> Looks like the cmap files are missing. They are part of the fontbox
> resources
> and have to be on the classpath. If you aren't using the precompiled
> binaries
> you have to ensure that on your own.
>
> Andreas
>
> >
> > Exception in thread "main" java.io.IOException: Stream closed
> > at
> > java.base/java.io
> .BufferedInputStream.getInIfOpen(BufferedInputStream.java:157)
> > at java.base/java.io
> .BufferedInputStream.fill(BufferedInputStream.java:244)
> > at java.base/java.io
> .BufferedInputStream.read(BufferedInputStream.java:263)
> > at java.base/java.io.FilterInputStream.read(FilterInputStream.java:82)
> > at java.base/java.io
> .PushbackInputStream.read(PushbackInputStream.java:135)
> > at org.apache.fontbox.cmap.CMapParser.parseNextToken(CMapParser.java:479)
> > at org.apache.fontbox.cmap.CMapParser.parse(CMapParser.java:126)
> > at
> org.apache.fontbox.cmap.CMapParser.parsePredefined(CMapParser.java:102)
> > at
> >
> org.apache.pdfbox.pdmodel.font.CMapManager.getPredefinedCMap(CMapManager.java:55)
> > at
> >
> org.apache.pdfbox.pdmodel.font.PDType0Font.readEncoding(PDType0Font.java:280)
> > at
> org.apache.pdfbox.pdmodel.font.PDType0Font.<init>(PDType0Font.java:222)
> > at org.apache.pdfbox.pdmodel.font.PDType0Font.load(PDType0Font.java:67)
> > at
> >
> org.apache.pdfbox.examples.pdmodel.HelloWorldTTF.main(HelloWorldTTF.java:79)
> >
> > Exception in thread "main" java.io.IOException: Stream closed
> > at
> > java.base/java.io
> .BufferedInputStream.getInIfOpen(BufferedInputStream.java:157)
> > at java.base/java.io
> .BufferedInputStream.fill(BufferedInputStream.java:244)
> > at java.base/java.io
> .BufferedInputStream.read(BufferedInputStream.java:263)
> > at java.base/java.io.FilterInputStream.read(FilterInputStream.java:82)
> > at java.base/java.io
> .PushbackInputStream.read(PushbackInputStream.java:135)
> > at org.apache.fontbox.cmap.CMapParser.parseNextToken(CMapParser.java:479)
> > at org.apache.fontbox.cmap.CMapParser.parse(CMapParser.java:126)
> > at
> org.apache.fontbox.cmap.CMapParser.parsePredefined(CMapParser.java:102)
> > at
> >
> org.apache.pdfbox.pdmodel.font.CMapManager.getPredefinedCMap(CMapManager.java:55)
> > at
> >
> org.apache.pdfbox.pdmodel.font.PDType0Font.readEncoding(PDType0Font.java:280)
> > at
> org.apache.pdfbox.pdmodel.font.PDType0Font.<init>(PDType0Font.java:222)
> > at org.apache.pdfbox.pdmodel.font.PDType0Font.load(PDType0Font.java:67)
> > at org.apache.pdfbox.examples.pdmodel.CreatePDFA.main(CreatePDFA.java:88)
> >
> > Hope someone can help me with this one.
> >
> > Jack
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
> For additional commands, e-mail: dev-help@pdfbox.apache.org
>
>

Re: *** Possible bug in PDFBox Creating PDFwith TTF ***

Posted by Andreas Lehmkuehler <an...@lehmi.de>.
Am 26.03.21 um 11:20 schrieb Jack London:
> Hi!
> 
> I compiled the version pdfbox-2.0.23 source code and the following examples
> are not working:
> 
> 1) HelloWorldTTF.java
> 2) CreatePDFA.java
> 
> I have the following dump after trying to call the function
> "getExternalCMap(name);" in line 99 of file CMapParser.java (package
> org.apache.fontbox.cmap), where name = "Identity-H", :
Looks like the cmap files are missing. They are part of the fontbox resources 
and have to be on the classpath. If you aren't using the precompiled binaries 
you have to ensure that on your own.

Andreas

> 
> Exception in thread "main" java.io.IOException: Stream closed
> at
> java.base/java.io.BufferedInputStream.getInIfOpen(BufferedInputStream.java:157)
> at java.base/java.io.BufferedInputStream.fill(BufferedInputStream.java:244)
> at java.base/java.io.BufferedInputStream.read(BufferedInputStream.java:263)
> at java.base/java.io.FilterInputStream.read(FilterInputStream.java:82)
> at java.base/java.io.PushbackInputStream.read(PushbackInputStream.java:135)
> at org.apache.fontbox.cmap.CMapParser.parseNextToken(CMapParser.java:479)
> at org.apache.fontbox.cmap.CMapParser.parse(CMapParser.java:126)
> at org.apache.fontbox.cmap.CMapParser.parsePredefined(CMapParser.java:102)
> at
> org.apache.pdfbox.pdmodel.font.CMapManager.getPredefinedCMap(CMapManager.java:55)
> at
> org.apache.pdfbox.pdmodel.font.PDType0Font.readEncoding(PDType0Font.java:280)
> at org.apache.pdfbox.pdmodel.font.PDType0Font.<init>(PDType0Font.java:222)
> at org.apache.pdfbox.pdmodel.font.PDType0Font.load(PDType0Font.java:67)
> at
> org.apache.pdfbox.examples.pdmodel.HelloWorldTTF.main(HelloWorldTTF.java:79)
> 
> Exception in thread "main" java.io.IOException: Stream closed
> at
> java.base/java.io.BufferedInputStream.getInIfOpen(BufferedInputStream.java:157)
> at java.base/java.io.BufferedInputStream.fill(BufferedInputStream.java:244)
> at java.base/java.io.BufferedInputStream.read(BufferedInputStream.java:263)
> at java.base/java.io.FilterInputStream.read(FilterInputStream.java:82)
> at java.base/java.io.PushbackInputStream.read(PushbackInputStream.java:135)
> at org.apache.fontbox.cmap.CMapParser.parseNextToken(CMapParser.java:479)
> at org.apache.fontbox.cmap.CMapParser.parse(CMapParser.java:126)
> at org.apache.fontbox.cmap.CMapParser.parsePredefined(CMapParser.java:102)
> at
> org.apache.pdfbox.pdmodel.font.CMapManager.getPredefinedCMap(CMapManager.java:55)
> at
> org.apache.pdfbox.pdmodel.font.PDType0Font.readEncoding(PDType0Font.java:280)
> at org.apache.pdfbox.pdmodel.font.PDType0Font.<init>(PDType0Font.java:222)
> at org.apache.pdfbox.pdmodel.font.PDType0Font.load(PDType0Font.java:67)
> at org.apache.pdfbox.examples.pdmodel.CreatePDFA.main(CreatePDFA.java:88)
> 
> Hope someone can help me with this one.
> 
> Jack
> 


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