We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Closing a PDF

I am simply opening a PDF, then setting the page number on the page, then saving and closing it. After this, I cannot open the PDF again until the app gets closed. Why does .Close not close the PDF?

Here is a code snippet:

Private WithEvents mobjPDFDoc As PdfLoadedDocument
mobjPDFDoc = New PdfLoadedDocument(strFile)

'This is inside a loop...
dblHeight = mobjPDFDoc.Pages(intPage).Graphics.ClientSize.Height
dblWidth = mobjPDFDoc.Pages(intPage).Graphics.ClientSize.Width
mobjPDFDoc.Pages(intPage).Graphics.DrawString( _
"Page " & CStr(intPage + intTotalPageCount - 1), font, brush _
, New PointF(dblWidth - 220, dblHeight - 100))

... after done marking pages, save and close it.
mobjPDFDoc.Save()
mobjPDFDoc.Close()
mobjPDFDoc.Dispose()
mobjPDFDoc = Nothing

For some reason the PDF is still open after I close it. If I try to open it again in code or in Adobe Acrobat Reader, it tells me that it is currently opened by someone. How do I close it?

Thanks,
Jeff

2 Replies

JD Jeff Dressing July 20, 2009 06:23 PM UTC

I did not see the boolean completely parameter in the close command. After I sent it True, it worked fine.


SS Sri Subhashini M Syncfusion Team July 21, 2009 04:09 AM UTC

Hi Jeff,

Thank you for your interest in Essential PDF.

We were able to view the condition which you mentioned here. The overloaded Close(True) method helps you to close the existing document completely.

Please let me know if you need any information.

Regards,
Suba

Loader.
Live Chat Icon For mobile
Up arrow icon