Solved

Save file without displaying the save dialog/prompt

Posted on 2008-10-29
2
485 Views
Last Modified: 2013-11-26
Hello,
I am printing a file in pdf format using printdlg function but i want to save the file at the specified location without dispalying the save dialog / prompt. In the doc info structure it is taking only the name not the path even though i am specifying the path.It is a win32 appliccation.
di.lpszDocName = "C:\\Printing.pdf";
Thanks.
0
Comment
Question by:Sohela
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 86

Accepted Solution

by:
jkr earned 500 total points
ID: 22842365
As the docs state:

PD_PRINTTOFILE

If this flag is set, the Print to File check box is selected.
If this flag is set when the PrintDlg function returns, the offset indicated by the wOutputOffset member of the DEVNAMES structure contains the string "FILE:". When you call theStartDoc function to start the printing operation, specify this "FILE:" string in the lpszOutput member of the DOCINFO structure. Specifying this string causes the print subsystem to query the user for the name of the output file.

So, that should be

di.lpszOutput = "C:\\Printing.pdf";

instead.
 
0
 

Author Comment

by:Sohela
ID: 22847534
Hi,
This is my printdlg structure
         PRINTDLG pd = {0};                        //  Reset on declare
        pd.lStructSize = sizeof (pd);
       pd.Flags = PD_RETURNDEFAULT | PD_PRINTTOFILE | PD_RETURNDC;

       DOCINFO di = {0};
       di.cbSize = sizeof (di);
       di.lpszDocName = "C:\\Printing.pdf";
       StartDoc (pd.hDC, &di);
        StartPage (pd.hDC);

As you mentioned i used it but it is giving another prompt/dialog and if i give path name or file it is not getting saved.I dont want any prompt/dialog it should directly print at the required path is there any function for that. I attaching the file like when the prompt is displayed.
output.JPG
0

Featured Post

Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

Question has a verified solution.

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

Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

749 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