Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#3.5
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 6:29am
Edited 17-Jul-12 20:18pm
v3
Comments
Wes Aday at 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
good
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.LoadFile(PDFPath.ToString());
                           axAcroPDF1.setShowToolbar(false); //disable pdf toolbar.
                           axAcroPDF1.Enabled = true;
                           
                       }
                       else
                       {
                           MessageBox.Show("Selected PDF Template Is Locked By Another Application.", ""Test Application"", MessageBoxButtons.OK, MessageBoxIcon.Information);
                           
                       }
  Permalink  
Rate this: bad
good
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.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

I found the soultion
Just create object whenever needed.
  Permalink  

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

  Print Answers RSS
0 OriginalGriff 304
1 Sergey Alexandrovich Kryukov 255
2 Shweta N Mishra 216
3 Maciej Los 210
4 PIEBALDconsult 184
0 OriginalGriff 7,660
1 Sergey Alexandrovich Kryukov 7,072
2 DamithSL 5,586
3 Manas Bhardwaj 4,946
4 Maciej Los 4,665


Advertise | Privacy | Mobile
Web01 | 2.8.1411023.1 | Last Updated 26 Feb 2013
Copyright © CodeProject, 1999-2014
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