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

About these ads

4 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 [...]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
Follow

Get every new post delivered to your Inbox.

Join 89 other followers

%d bloggers like this: