The movie Stranger Than Fiction reminded me a lot of a book I read a couple of years ago, Typewriter in the Sky. I no longer have the book, because during a major winnowing of the household bookshelves I decided I didn't want to own anything written by L. Ron Hubbard. Typewriter in the Sky was written in 1940, before Hubbard got interested in, er, promoting his lifestyle regimens, and it's an exciting work of pulp fiction with a very meta twist. A hack writer is hard at work finishing his latest saga about swashbuckling pirates, and suddenly one of his good friends finds himself swept off into the landscape of the novel, transformed into one of the characters, and facing the strong possibility of impending death. The character, who knows whose novel he's stuck inside, and the writer, who has no idea that the character is his real-life friend, battle for the upper hand in the resolution of the novel being written.
Stranger Than Fiction is a much more sedate tale, set in contemporary times, but with some strikingly similar plot elements. Harold Crick (Will Ferrell), an IRS auditor with one of the most boring, routine lives ever, suddenly starts hearing this female voice narrating his life ... and predicting his imminent death. He's completely at a loss for how to handle the situation, and ultimately consults a literature professor, Professor Hilbert (Dustin Hoffman). Meanwhile, the writer whose voice Harold has been hearing in his head, Kay Eiffel (Emma Thompson), is going through a horrendous bout of writer's block: She cannot determine how she should kill her latest novel's protagonist, Harold Crick. And we can see that everything she types about the character on her charmingly old-fashioned typewriter is controlling what happens to the real-life Harold.