Repository: pdfbox-docs Updated Branches: refs/heads/master de331937e -> 1368ec83a
PDFBOX-3700, PDFBOX-3330: add information about how to handle OOM situations during rendering to FAQ Project: http://git-wip-us.apache.org/repos/asf/pdfbox-docs/repo Commit: http://git-wip-us.apache.org/repos/asf/pdfbox-docs/commit/1368ec83 Tree: http://git-wip-us.apache.org/repos/asf/pdfbox-docs/tree/1368ec83 Diff: http://git-wip-us.apache.org/repos/asf/pdfbox-docs/diff/1368ec83 Branch: refs/heads/master Commit: 1368ec83a07b3a973f36e691aa3dba94beca6697 Parents: de33193 Author: Maruan Sahyoun <sahy...@fileaffairs.de> Authored: Sun Feb 26 21:38:06 2017 +0100 Committer: Maruan Sahyoun <sahy...@fileaffairs.de> Committed: Sun Feb 26 21:38:06 2017 +0100 ---------------------------------------------------------------------- content/2.0/faq.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/pdfbox-docs/blob/1368ec83/content/2.0/faq.md ---------------------------------------------------------------------- diff --git a/content/2.0/faq.md b/content/2.0/faq.md index 25c31c4..aac0f03 100644 --- a/content/2.0/faq.md +++ b/content/2.0/faq.md @@ -47,6 +47,7 @@ title: Frequently Asked Questions (FAQ) ### PDF Rendering + - [I'm getting an OutOfMemoryError. What can I do?](#outofmemoryrrror) - [A drop shadow is missing or at the wrong position when rendering a page](#dropshadow) - [Why are some texts in poor quality and not antialiased?](#textantialias) @@ -194,6 +195,18 @@ the word "Hello" is drawn. ## PDF rendering +<a name="outofmemoryrrror"></a> + +### I'm getting an OutOfMemoryError. What can I do? + +The memory footprint depends on the PDF itself and on the resolution you use for rendering. Some possible options: + +- increase the `-Xmx` value when starting java +- be careful not to hold your images after rendering them, e.g. avoid putting all images of a PDF into a `List` +- don't forgot to close your `PDDocument` objects +- decrease the scale when calling `PDFRenderer.renderImage()`, or the dpi value when calling `PDFRenderer.renderImageWithDPI()` +- disable the cache for `PDImageXObject` objects by calling `PDDocument.setResourceCache()` with a cache object that is derived from `DefaultResourceCache` and whose call `public void put(COSObject indirect, PDXObject xobject)` does nothing. Be aware that this will slow down rendering for PDF files that have an identical image in several pages (e.g. a company logo or a background). More about this can be read in [PDFBOX-3700](https://issues.apache.org/jira/browse/PDFBOX-3700). + <a name="dropshadow"></a> ### A drop shadow is missing or at the wrong position when rendering a page