Solved

Save file without displaying the save dialog/prompt

Posted on 2008-10-29
2
467 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
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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Problem to Popup 2 51
Where to begin studying? 5 66
.net VBA word safemode 1 24
FMX TCameraComponent Problem 2 13
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)…
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…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

705 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

15 Experts available now in Live!

Get 1:1 Help Now