You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "André Heuner (JIRA)" <ji...@apache.org> on 2016/12/01 09:06:58 UTC
[jira] [Updated] (PDFBOX-3612) ScratchFileBuffer not closed message
related to overlay.overlay(overlayGuide);
[ https://issues.apache.org/jira/browse/PDFBOX-3612?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
André Heuner updated PDFBOX-3612:
---------------------------------
Description:
I'd like to add a watermark to a PDF and have the following code:
<pre>
PDDocument pdfDocument = PDDocument.load(new
PDDocument pdfCopy = Pdf.addWatermark(pdfDocument);
pdfDocument.close();
pdfCopy.close();
....
public static PDDocument addWatermark(PDDocument document) {
try {
HashMap<Integer, String> overlayGuide = new HashMap<Integer, String>();
for(int no = 0; no < document.getNumberOfPages(); no++){
overlayGuide.put(no +1, "C:\\Software\\watermark.pdf");
}
Overlay overlay = new Overlay();
overlay.setInputPDF(document);
overlay.setOverlayPosition(Overlay.Position.FOREGROUND);
PDDocument result = overlay.overlay(overlayGuide);
document.close();
overlay.close();
return result;
} catch (Exception e) {
log.error("Error while adding watermark: " +e.getMessage(), e);
return document;
}
}
</pre>
overlay.overlay(...) seems to cause lot's of warnings:
[2016-12-01-09:48:51] DEBUG [org.apache.pdfbox.io.ScratchFileBuffer] ScratchFileBuffer not closed!
[2016-12-01-09:48:51] DEBUG [org.apache.pdfbox.io.ScratchFileBuffer] ScratchFileBuffer not closed!
[2016-12-01-09:48:51] DEBUG [org.apache.pdfbox.io.ScratchFileBuffer] ScratchFileBuffer not closed!
[2016-12-01-09:48:51] DEBUG [org.apache.pdfbox.io.ScratchFileBuffer] ScratchFileBuffer not closed!
[2016-12-01-09:48:51] DEBUG [org.apache.pdfbox.io.ScratchFileBuffer] ScratchFileBuffer not closed!
[2016-12-01-09:48:51] DEBUG [org.apache.pdfbox.io.ScratchFileBuffer] ScratchFileBuffer not closed!
Is there anything, that can be done to fix this issue? I tried to close anything that is closable - but the issue remains. Or can it safely be ignored?
was:
I'd like to add a watermark to a PDF and have the following code:
PDDocument pdfDocument = PDDocument.load(new
PDDocument pdfCopy = Pdf.addWatermark(pdfDocument);
pdfDocument.close();
pdfCopy.close();
....
public static PDDocument addWatermark(PDDocument document) {
try {
HashMap<Integer, String> overlayGuide = new HashMap<Integer, String>();
for(int no = 0; no < document.getNumberOfPages(); no++){
overlayGuide.put(no +1, "C:\\Software\\watermark.pdf");
}
Overlay overlay = new Overlay();
overlay.setInputPDF(document);
overlay.setOverlayPosition(Overlay.Position.FOREGROUND);
PDDocument result = overlay.overlay(overlayGuide);
document.close();
overlay.close();
return result;
} catch (Exception e) {
log.error("Error while adding watermark: " +e.getMessage(), e);
return document;
}
}
overlay.overlay(...) seems to cause lot's of warnings:
[2016-12-01-09:48:51] DEBUG [org.apache.pdfbox.io.ScratchFileBuffer] ScratchFileBuffer not closed!
[2016-12-01-09:48:51] DEBUG [org.apache.pdfbox.io.ScratchFileBuffer] ScratchFileBuffer not closed!
[2016-12-01-09:48:51] DEBUG [org.apache.pdfbox.io.ScratchFileBuffer] ScratchFileBuffer not closed!
[2016-12-01-09:48:51] DEBUG [org.apache.pdfbox.io.ScratchFileBuffer] ScratchFileBuffer not closed!
[2016-12-01-09:48:51] DEBUG [org.apache.pdfbox.io.ScratchFileBuffer] ScratchFileBuffer not closed!
[2016-12-01-09:48:51] DEBUG [org.apache.pdfbox.io.ScratchFileBuffer] ScratchFileBuffer not closed!
Is there anything, that can be done to fix this issue? I tried to close anything that is closable - but the issue remains. Or can it safely be ignored?
> ScratchFileBuffer not closed message related to overlay.overlay(overlayGuide);
> ------------------------------------------------------------------------------
>
> Key: PDFBOX-3612
> URL: https://issues.apache.org/jira/browse/PDFBOX-3612
> Project: PDFBox
> Issue Type: Bug
> Affects Versions: 2.0.3
> Environment: Windows 7 Professional, Eclipse, JDK 1.8
> Reporter: André Heuner
> Priority: Minor
>
> I'd like to add a watermark to a PDF and have the following code:
> <pre>
> PDDocument pdfDocument = PDDocument.load(new
> PDDocument pdfCopy = Pdf.addWatermark(pdfDocument);
>
> pdfDocument.close();
> pdfCopy.close();
> ....
> public static PDDocument addWatermark(PDDocument document) {
> try {
> HashMap<Integer, String> overlayGuide = new HashMap<Integer, String>();
>
> for(int no = 0; no < document.getNumberOfPages(); no++){
> overlayGuide.put(no +1, "C:\\Software\\watermark.pdf");
> }
>
> Overlay overlay = new Overlay();
> overlay.setInputPDF(document);
> overlay.setOverlayPosition(Overlay.Position.FOREGROUND);
>
> PDDocument result = overlay.overlay(overlayGuide);
>
> document.close();
> overlay.close();
>
> return result;
>
> } catch (Exception e) {
> log.error("Error while adding watermark: " +e.getMessage(), e);
>
> return document;
> }
> }
> </pre>
> overlay.overlay(...) seems to cause lot's of warnings:
> [2016-12-01-09:48:51] DEBUG [org.apache.pdfbox.io.ScratchFileBuffer] ScratchFileBuffer not closed!
> [2016-12-01-09:48:51] DEBUG [org.apache.pdfbox.io.ScratchFileBuffer] ScratchFileBuffer not closed!
> [2016-12-01-09:48:51] DEBUG [org.apache.pdfbox.io.ScratchFileBuffer] ScratchFileBuffer not closed!
> [2016-12-01-09:48:51] DEBUG [org.apache.pdfbox.io.ScratchFileBuffer] ScratchFileBuffer not closed!
> [2016-12-01-09:48:51] DEBUG [org.apache.pdfbox.io.ScratchFileBuffer] ScratchFileBuffer not closed!
> [2016-12-01-09:48:51] DEBUG [org.apache.pdfbox.io.ScratchFileBuffer] ScratchFileBuffer not closed!
> Is there anything, that can be done to fix this issue? I tried to close anything that is closable - but the issue remains. Or can it safely be ignored?
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org