Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Too many open files #209

Closed
lucheng opened this issue Apr 18, 2018 · 2 comments
Closed

Too many open files #209

lucheng opened this issue Apr 18, 2018 · 2 comments

Comments

@lucheng
Copy link

lucheng commented Apr 18, 2018

When bulk HTML is transferred to PDF.
prompt :"Too many open files"

com.openhtmltopdf.pdfboxout.PdfRendererBuilder.useFont
com.openhtmltopdf.pdfboxout.PdfBoxFontResolver
/**
* Add a font using a existing file. If the file is a TrueTypeCollection, it
* will be handled as such.
/
public void addFont(File fontFile, final String fontFamilyNameOverride, final Integer fontWeightOverride,
final IdentValue fontStyleOverride, final boolean subset) throws IOException {
/

* Specialcase for TrueTypeCollections
*/
if (fontFile.getName().toLowerCase(Locale.US).endsWith(".ttc")) {
//one
addFontCollection(fontFile, fontFamilyNameOverride, fontWeightOverride, fontStyleOverride, subset);
return;
}

	/*
	 * We load the font using the file.
	 */
            //two
	addFont(PDType0Font.load(_doc, fontFile), fontFamilyNameOverride, fontWeightOverride, fontStyleOverride, subset);
}

At one and two ,Resources are not closed.

@rototor
Copy link
Contributor

rototor commented Apr 24, 2018

I got the same problem and made a pullrequest with a fix #215

@rototor
Copy link
Contributor

rototor commented Apr 24, 2018

If you need a workaround, you can just use a FSSupplier to provide the font as InputStream. The bug only happens with font files.

danfickle added a commit that referenced this issue Apr 25, 2018
@lucheng lucheng closed this as completed Jul 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants