Solved

Save file without displaying the save dialog/prompt

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
c++, dynamic object by json 1 41
What namespace do I need to import? 2 25
.NET 2008 VB and C# 6 27
Call Controller Action Method from ASPX 2 12
Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
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.

813 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

10 Experts available now in Live!

Get 1:1 Help Now