473,378 Members | 1,146 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Source file for preview is not available

I am using a simple batch file that takes 3 args to create a .pdf file, and
then view that PDF file using on the Microsoft's Web Browser control
(AxSHDocVw.AxWebBrowser):

{
System.Diagnostics.Process p = new System.Diagnostics.Process();
p.StartInfo.FileName =@"C:\test-fo.bat";
p.StartInfo.WindowStyle= System.Diagnostics.ProcessWindowStyle.Hidden ;
string s1= @"C:\2.xml";
string s2= @"C:\ftid-fo.xsl";
string s3= @"C:\FO1.pdf";

p.StartInfo.Arguments= "\"" + s1 + "\"" + " " + "\"" + s2 + "\"" + " " +
"\"" + s3 + "\"";
p.Start();
p.Close();

string strFile = s3;
XMLBrowser.Navigate(strFile ,ref objNull,ref objNull,ref objNull,ref
objNull);
}

When I call the above for the first time... it gives an error :"Source file
for preview is not available". This only happens for the first time! I can
call the same code (after the first instance) without any errors and get the
preview of the generated file.

Is there any property/setting that i am missing related to the Process class?
Please suggest.

Thanks.
Apr 3 '07 #1
2 1566
Gaurav,

You need to wait for the process to end. You should make a call to
WaitToExit on the Process instance you create so that you know the process
completes before you tell the web browser to load it.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Gaurav" <Ga****@discussions.microsoft.comwrote in message
news:1D**********************************@microsof t.com...
>I am using a simple batch file that takes 3 args to create a .pdf file, and
then view that PDF file using on the Microsoft's Web Browser control
(AxSHDocVw.AxWebBrowser):

{
System.Diagnostics.Process p = new System.Diagnostics.Process();
p.StartInfo.FileName =@"C:\test-fo.bat";
p.StartInfo.WindowStyle= System.Diagnostics.ProcessWindowStyle.Hidden ;
string s1= @"C:\2.xml";
string s2= @"C:\ftid-fo.xsl";
string s3= @"C:\FO1.pdf";

p.StartInfo.Arguments= "\"" + s1 + "\"" + " " + "\"" + s2 + "\"" + " " +
"\"" + s3 + "\"";
p.Start();
p.Close();

string strFile = s3;
XMLBrowser.Navigate(strFile ,ref objNull,ref objNull,ref objNull,ref
objNull);
}

When I call the above for the first time... it gives an error :"Source
file
for preview is not available". This only happens for the first time! I can
call the same code (after the first instance) without any errors and get
the
preview of the generated file.

Is there any property/setting that i am missing related to the Process
class?
Please suggest.

Thanks.


Apr 3 '07 #2
Bingo!

Thanks Nicholas :)

"Nicholas Paldino [.NET/C# MVP]" wrote:
Gaurav,

You need to wait for the process to end. You should make a call to
WaitToExit on the Process instance you create so that you know the process
completes before you tell the web browser to load it.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Gaurav" <Ga****@discussions.microsoft.comwrote in message
news:1D**********************************@microsof t.com...
I am using a simple batch file that takes 3 args to create a .pdf file, and
then view that PDF file using on the Microsoft's Web Browser control
(AxSHDocVw.AxWebBrowser):

{
System.Diagnostics.Process p = new System.Diagnostics.Process();
p.StartInfo.FileName =@"C:\test-fo.bat";
p.StartInfo.WindowStyle= System.Diagnostics.ProcessWindowStyle.Hidden ;
string s1= @"C:\2.xml";
string s2= @"C:\ftid-fo.xsl";
string s3= @"C:\FO1.pdf";

p.StartInfo.Arguments= "\"" + s1 + "\"" + " " + "\"" + s2 + "\"" + " " +
"\"" + s3 + "\"";
p.Start();
p.Close();

string strFile = s3;
XMLBrowser.Navigate(strFile ,ref objNull,ref objNull,ref objNull,ref
objNull);
}

When I call the above for the first time... it gives an error :"Source
file
for preview is not available". This only happens for the first time! I can
call the same code (after the first instance) without any errors and get
the
preview of the generated file.

Is there any property/setting that i am missing related to the Process
class?
Please suggest.

Thanks.


Apr 3 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: user mysql | last post by:
HELLO FRIENDS. HERE A FANTASTIC NEWS FOR MYSQL WINDOWS USER. READE THIS. The article is grab from www/internetnews/com/ DO YOU THINK THAT IS A GOOD NEWS ? ...
0
by: Mike | last post by:
Sites using thumbnail preview for world wide web file navigation and searching. Below are list of sites that are either researching or providing thumbnail preview images for online web...
12
by: Ken | last post by:
How can I determine a image file size before uploading it? I would like to make sure the size is under a maximum before taking the time to upload it. If I have to upload the file before...
7
by: Pat | last post by:
I would like to send the Print Preview of a MS Access form to a Snapshot file. The form contains an OLE graph. BACKGROUND A snapshot of a report is possible. If I could I would use a report to...
5
by: rogsonl | last post by:
My computer was moved last week, and the company changed the network groups we work on. As a result, one of the main benefits from Whidbey (database connectivity) no longer works. Situation: 1....
6
by: qysbc | last post by:
I have a web page and there is a link to open a TIFF file. The way I do it is to have the server code open a binary stream, set the content type to "image/tiff" and call Response.BinaryWrite. On...
0
by: publicityfoss | last post by:
Apologizes for multiple copies eventually received Documents on Migrations to Open Source available by the COSPA Consortium The COSPA consortium (Consortium for studying, evaluating, and...
12
by: dbuchanan | last post by:
Hello, (Is this the proper newsgroup?) === Background === I am building a solution with two projects. One project is my data access layer which contains my DataSet as an xsd file. The XSD...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.