The recovery of writing trajectory from offline handwritten image is generally regarded as a difficult problem [1]. This paper introduced a method to recover the writing trajectory from multiple stroked images by searching the best matching writing paths of template strokes. The searching procedure is guided by a matching cost function which is defined as the summation of positional distortion cost and directional difference cost between the template stroke and its matching path. We develop a bidirectional search algorithm based on dynamic programming to find the best matching path. The algorithm can efficiently reduce the searching space, while hold the start/end vertex constraint. Experiments on the handwritten English words and Chinese characters demonstrated the effectiveness of our method.