Solved

I have a problem with programmatically open a PDF file with C# with my WinForm

Posted on 2013-06-20
3
967 Views
Last Modified: 2013-06-25
Dear experts

I have a problem with programmatically open a PDF file with C# with my WinForm application. Please help.

 First – all has been fine 2 years, the problem is NOW appear. My application download a PDF file and open it to help the user faster review it. Today I get the error  Insufficient data for image from PDF , and the title image is missing, also some text. I understand, that the problem is with adobe Reader, however my application will be used from many customers and I want to avoid ask them to update to latest reader. I even try to change the image with PNG (I read that the problem is with J2PG, I have such image but the error is still here.
 What is strange, that on my computer if I open manually the downloaded PDF file all is OK. So my question is – what is different when I open my file with code? How to change code, so the open to be the same as the manually? It is something with starting environment…

Here you my code for open the file:
                System.Threading.Thread.Sleep(500);
                System.Diagnostics.Process myProc = null;
                try
                {
                    myProc = System.Diagnostics.Process.Start(@sFile);
// myProc.Close(); - DO I NEED THIS CODE ?
                }
                catch (Exception ex)
                {
                    g.Msg("The file has been downloaded, but can't be open!\r\nPlease make sure that you have the needed software installed on your computer /Word, Excel or Addobe PDF Reader/ to open this file!\n\\n\rr" + ex.Message, "Error in the file opening!",PSTaskDialog.eSysIcons.Error);
                }
0
Comment
Question by:dvplayltd
  • 2
3 Comments
 
LVL 42

Expert Comment

by:sedgwick
ID: 39261936
no need to call myProc.Close().
can u post the code that download the pdf url?
0
 

Accepted Solution

by:
dvplayltd earned 0 total points
ID: 39262253
The C# code that make FTP download is rather complicated and use external library. Anyway, the problem is not with it, I change the picture in PDF with .GIF and the problem is not show. Look like this will be the solution ..the bug is due to Addobe Error, but I need clear solution as it will work on 100+ computers ...
0
 

Author Closing Comment

by:dvplayltd
ID: 39274140
I found a solution on my own.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now