[R] pdf creation error

Duncan Murdoch murdoch at stats.uwo.ca
Wed Oct 22 12:31:44 CEST 2008


Martin Maechler wrote:
>>>>>> "SK" == Stephan Kolassa <Stephan.Kolassa at gmx.de>
>>>>>>     on Tue, 21 Oct 2008 21:28:09 +0200 writes:
>>>>>>             
>
>     SK> Hi JD, do you have the pdf open in some app, e.g.,
>     SK> Acrobat Reader? If the file is open, R can't write on
>     SK> it. My (German) errors in this case look like yours:
>
>     SK> Fehler in pdf(paste(pic.directory, "/full_map.pdf", sep
>     SK> = "")) : unable to start device pdf Zusätzlich: Warning
>     SK> message: In pdf(paste(pic.directory, "/full_map.pdf",
>     SK> sep = "")) : cannot open 'pdf' file argument
>     SK> 'Pictures/full_map.pdf'
>
>     SK> Just close the Acrobat Reader or whatever.
>
> or even better: Close your OS (MS Windows) and start using a
> better one. 
>
>   
This isn't an OS problem, it's a problem with Acroread.  It locks the 
file unnecessarily.  There are other readers (e.g. Sumatra PDF) that don't.

Windows has mechanisms for programs to be notified when a file has 
changed, and that's what Acroread should be using.  Or it could just 
check the timestamp whenever it regains the focus, that's what my text 
editor (Textpad) does.

Duncan Murdoch

> E.g., on all Linux versions I know I can write to files open in
> acroread (or any ofther of the several alternatives on Linux)
> and then "reload" the file inside the PDF viewer.
>   
> Martin Maechler, ETH Zurich
>
>     SK> Best, Stephan
>
>
>     SK> j daniel schrieb:
>     >> Hello -
>     >> 
>     >> I am trying to create a pdf file in R, but I keep getting
>     >> an error that says it cannot open the pdf device.  Here
>     >> is the code and output:
>     >> 
>     >>> pdf(file="test.pdf")
>     >> Error in pdf(file = "test.pdf") : unable to start device
>     >> pdf In addition: Warning message: In pdf(file =
>     >> "test.pdf") : cannot open 'pdf' file argument 'test.pdf'
>     >> 
>     >> Until yesterday I could use the pdf() function without
>     >> problems, so I am not sure what happened.  The error does
>     >> not go away if I restart R or restart my computer.  Any
>     >> ideas???
>     >> 
>     >> 
>     >> 
>
> ______________________________________________
>     SK> R-help at r-project.org mailing list
>     SK> https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do
>     SK> read the posting guide
>     SK> http://www.R-project.org/posting-guide.html and provide
>     SK> commented, minimal, self-contained, reproducible code.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



More information about the R-help mailing list