Solved

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

Posted on 2013-06-20
3
959 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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

747 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

9 Experts available now in Live!

Get 1:1 Help Now