How do I open a new PDF document in a PDFView that is already associated with another PDFDoc?

Q: I have tried using PDFNet and am having a problem closing a
document. Our
application has a requiment to allow the users to open a PDF document
then
they can load another PDF document without closing the window. In my
code
I first check if a document is already loaded in the PDFView control.
If
one is already displayed I call Close() on it before loading the next
one.
But when I do that the application hangs after setting the new
document in
the viewer.

Any help would be appreciated.
---------

A: You would need to first associate the new document with an existing
PDFView, then close the old document. For example,

PDFDoc old_doc = pdfViewer.GetDoc();

// set the new document into the PDF viewer
pdfViewer.SetDoc(new pdftron.PDF.PDFDoc(m_curPDFDoc));

// Close the old doc.
if (old_doc != null) old_doc.Close();