I am opening a PDF File that I have created with iText. Without opening it in PDF Renderer and just opening it normally and closing it I can delete and overwrite to the file. However once I use PDF Renderer to open it then I close it. I am unable to delete the PDF or replacing it.
ByteBuffer buf;
...
randomAccessFile = new RandomAccessFile(new File(file), "r");
fileChannel = randomAccessFile.getChannel();
buf = fileChannel.map(FileChannel.MapMode.READ_ONLY, 0, fileChannel.size());
pdfFile = new PDFFile(buf);
Code here then gets the image and puts it into a panel.
Then I close the above items.
It is still opened somewhere but I can not figure out where, any help is appreciated.