Tyler Muth’s Blog

Technology with a focus on Oracle, Application Express and Linux

“Refresh” a PDF

Posted by Tyler Muth on February 5, 2013

I’ve been working in R (wikipedia entry) a lot lately to graph performance data about Oracle systems. In general I output PDF files. The problem with most PDF readers (on Windows) is that they either get an exclusive lock on the file when it’s open (yes you, Adobe Acrobat), or you have to close and re-open the PDF to see any changes. Enter Sumatra PDF (wikipedia entry, home page). I’ve used on and off for a few years. It’s free, very lightweight & fast to start.

The key feature for this post is that when you open a PDF, it doesn’t get an exclusive lock on the file. So, when I re-run my R code to regenerate the PDF file, Sumatra changes the title bar to [Changes detected; refreshing]… and reloads the PDF when it no longer detects changes. Brilliant! Absolutely brilliant!

Here’s a screenshot:

Sumatra-PDF-Refreshing

Here’s a follow-up post on how to “Refresh a CSV File

6 Responses to ““Refresh” a PDF”

  1. pardydba said

    When using R, I hope you’re also using Sweave! See http://www.stat.uni-muenchen.de/~leisch/Sweave/ for an intro if needed. It is magnificent.

    • Tyler Muth said

      I did a lot of testing with it, but the flow of how my code is generating the plots didn’t work well with it. I was in a class taught by Hadley Wickham and asked him about it and he said the way my code was constructed would likely not work well with Sweave. The problem is my code is 1200+ lines. I’ll look into again in the not too distant future.

      • pardydba said

        That part can be a problem. What I’ve done in similar situations is to package most of the reusable code bits as an R library, document that separately, then just library(mypackage) within the R/Sweave session I use to produce otuput. Of course that assumes a good chunk of code is in reusable bits rather than having most of it used in processing the data and generating the output, a PDF full of several hundred lines of R code just doesn’t have the same flow or impact as something more compact.

        Either way I’m greatly pleased to see the increasing uptake of R by the Oracle community, with or without “Oracle Enterprise R”.

  2. […] “Refresh” a PDF […]

  3. Simone said

    I really like what you guys are up too. Such clever work and exposure!
    Keep up the excellent works guys I’ve added you guys to my personal blogroll.

  4. adipex said

    I tilted myself that will where I’d been leaning just a bit away from the part,
    enough to kick advertising as hard as I could
    possibly. And remember it’s a must that
    the DJ is aware of their crowd in case of emergency – can’t be all fucked up (high
    & drunk) not paying attention and then on top of that can’t change your mood music cuz all you brought was the bang bang four on the floor.
    He’s on (or over) the edge, bordering on rude and doesn’t
    seem to give a damn about anyone but himself – what exactly do women see in a guy like that.

Leave a comment