Click here to Skip to main content
13,093,720 members (59,291 online)
Rate this:
Please Sign up or sign in to vote.
See more:
I have made a Windows desktop application(in C#) where I use the AxAcroPDF control to display a pdf-file on a form when user give the path of the pdf and click a button. Pdf-file is located in one network shared file folder where multiple users can access it.
(I use the LoadFile() Method of the object AxAcroPDFLib.AxAcroPDF)

This is working fine. But when the same pdf file which my applications try to open is already opened using Adobe Reader then my application can’t open the same pdf file.

If the PC my application installed has Adobe reader 7 then application throw the error message as "System.ApplicationException Failed Loading PDF Template" and application freeze.

And if the application running PC’s having Adobe Reader X installed then no error will appear but the loading screen appears for ever.

But opening the same pdf simultaneously in two or more PC using my application works perfect.

Can someone help me out on this issue?
Posted 17-Jul-12 5:29am
Updated 17-Jul-12 19:18pm
Wes Aday 17-Jul-12 11:35am
Do you think that possibly the errors that you are getting and the code that you are using to perform this action is sort of, kind of, need to know information in order for someone that can't see your screen or read your mind to help you? That is if you were really serious about getting help.
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

I couldn't find a proper solution as I was expecting to find. But to avoid the program get crash, I put a check before loading the pdf.

bool PDFAvailable = axAcroPDF1.LoadFile(PDFPath.ToString());

If the Boolean variable 'PDFAvailable' return true I'll load the PDF like below. Else a proper message is thrown.

bool PDFAvailable = axAcroPDF1.LoadFile(PDFPath.ToString());
                       if (PDFAvailable == true)
                           axAcroPDF1.setShowToolbar(false); //disable pdf toolbar.
                           axAcroPDF1.Enabled = true;
                           MessageBox.Show("Selected PDF Template Is Locked By Another Application.", ""Test Application"", MessageBoxButtons.OK, MessageBoxIcon.Information);
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

I found a workaround in this post
Rather than LoadFile() we can use the "src" property of the control.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web01 | 2.8.170813.1 | Last Updated 10 Jun 2016
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100