Stranger Than Fiction
This book is reminiscent of the movie Stranger Than Fiction, except Hannah already knows she's a character from a yet-to-be-written story. Also there's a male character named Trevor who doesn't know he's a character, a bit like Buzz not knowing he was a toy in Toy Story.