overwrite pdf while its open

Hi there,

I would like to overwrite a pdf while it's already open. I don't get any warnings or error messages... I recognize it by the fact that the pdf still has the old timestamp and also the content is still the old.

My goal is to generate a warning message if the pdf, I want to write, is already open. Does anyone have an idea to realise that?

Thanks for your time and help!

Hello @Pauler ,

I can't answer your question, but maybe the following does help.

Some years ago open PDFs were a problem for me when I was using knitr and rmarkdown to create PDFs.
When I checked the PDF (with my standard PDF Viewer Acrobat Reader) and noticed an error I sometimes forgot to close the PDF and the next knit failed with an error message (I realize this differs from your case).
The viewer apparently keeps the PDF reserved.

Somewhere (???) on the internet I read that the Sumatra viewer does not keep the PDF reserved.
So I downloaded this viewer and indicated in the RStudio settings (global options | Sweave | PDF preview) that the Sumatra viewer is to be used for previewing PDFs.
My problem was solved.

However: checking my settings I clicked on the questions mark near the preview setting and this opens the following article that indicates that Sumatra now is the default PDF previewer on Windows.
So probably you have different problem or you don't use Windows.

Good morning (where I live is just morning) HanOostdijk,

thank you for answering, even if you don't have the same problem like me. It's really a nice-to-know-thing you've wrote, I keep it in mind and check it, if it's necessary.

Wish you a nice weekend!

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.