[ 
https://issues.apache.org/jira/browse/PDFBOX-4890?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17139521#comment-17139521
 ] 

Tilman Hausherr edited comment on PDFBOX-4890 at 6/18/20, 3:50 PM:
-------------------------------------------------------------------

Thanks. So it happens with 
"/usr/share/fonts/opentype/noto/NotoSerifCJK-Bold.ttc". I downloaded the file 
from google and its size is 25880240 bytes. I don't now if this is the same 
version than yours.

This code reproduce the debug output, although it does not crash on my machine:
{code}
TrueTypeCollection ttc = new TrueTypeCollection(new 
File("NotoSerifCJK-Bold.ttc"));
ttc.processAllFonts(new TrueTypeCollection.TrueTypeFontProcessor()
{
    @Override
    public void process(TrueTypeFont ttf) throws IOException
    {
        System.out.println(ttf.getName());
        if (ttf instanceof OpenTypeFont && ((OpenTypeFont)ttf).isPostScript())
        {
            System.out.println("This is an OTF font");
            CFFFont cff = ((OpenTypeFont)ttf).getCFF().getFont();
            System.out.println("cff read successfully");
        }
    }
});
{code}

On your machine it crashes in BufferedRandomAccessFile.read(), which has an 
unusual implementation: read() calls read() again. And again. What could go 
wrong....?

Can you increase the stack size in tomcat?


was (Author: tilman):
Thanks. So it happens with 
"/usr/share/fonts/opentype/noto/NotoSerifCJK-Bold.ttc". I downloaded the file 
from google and its size of 25880240 bytes. I don't now if this is the same 
version than yours.

This code reproduce the debug output, although it does not crash on my machine:
{code}
TrueTypeCollection ttc = new TrueTypeCollection(new 
File("NotoSerifCJK-Bold.ttc"));
ttc.processAllFonts(new TrueTypeCollection.TrueTypeFontProcessor()
{
    @Override
    public void process(TrueTypeFont ttf) throws IOException
    {
        System.out.println(ttf.getName());
        if (ttf instanceof OpenTypeFont && ((OpenTypeFont)ttf).isPostScript())
        {
            System.out.println("This is an OTF font");
            CFFFont cff = ((OpenTypeFont)ttf).getCFF().getFont();
            System.out.println("cff read successfully");
        }
    }
});
{code}

On your machine it crashes in BufferedRandomAccessFile.read(), which has an 
unusual implementation: read() calls read() again. And again. What could go 
wrong....?

Can you increase the stack size in tomcat?

> StackOverflow Creating Cache
> ----------------------------
>
>                 Key: PDFBOX-4890
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-4890
>             Project: PDFBox
>          Issue Type: Bug
>          Components: FontBox
>    Affects Versions: 2.0.20
>         Environment:  5.3.0-53-generic #47~18.04.1-Ubuntu SMP x86_64 x86_64 
> x86_64 GNU/Linux
>            Reporter: Joaquin Santana
>            Priority: Major
>         Attachments: catalina.out, catalina.out, 
> image-2020-06-16-18-19-55-465.png, image-2020-06-17-09-12-39-249.png
>
>
> Hello, when I'm trying to print a pdf it's giving me a problem creating the 
> font cache, the same pdf is printable on Windows from IDE but doesn't work on 
> ubuntu inside tomcat 
>  
> {code:java}
> try {
>     pdf = PDDocument.load(inputStream);
>     pdf.getDocumentInformation().setTitle(filename);
>     reportServiceBL.printPageablePdf(pdf);
> } catch (Exception e) {
>     LOGGER.error("An unexpected error occurred while dispatching document", 
> e);
>     return wrapResponseKO(null, "There was an error generating document");
> }
> {code}
>  
> !image-2020-06-16-18-19-55-465.png!
> is there a way to find where the issue is?



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to