PDFBOX-4080: pass PDDocument to construct appearances + use existing scratch file when possible, as suggested by Ghenadii Batalski