CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 14 of 14
  1. #1
    Join Date
    Jan 2012
    Location
    India
    Posts
    193

    About Setting Print Options ..

    Hi ..

    I am using PDF Creator printer to print my files. I have set it as default printer.

    It displays two dialogs .. "Printer Setup Dialog" and "Dialog asking filename and other details to save to file".

    I want to avoid these two dialogs. But EndDoc calls the other dialog by default.

    How to do this ?

    pl guide ..

  2. #2
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: About Setting Print Options ..

    Quote Originally Posted by new_2012 View Post
    pl guide ..
    pl post code using code tags.

  3. #3
    Join Date
    Jan 2012
    Location
    India
    Posts
    193

    Re: About Setting Print Options ..

    Arjay Sir ,


    Code:
    void CftsexofflineviewerView::PrintData() 
    {
    	// TODO: Add your command handler code here
    	
    	CftsexofflineviewerDoc *pDoc = GetDocument();
    	ASSERT_VALID(pDoc);
    
    	CDC dc;
    
    	CPrintDialog dlg(FALSE);
    	CPrintInfo pi;
    	dlg.GetDefaults();
    	dc.Attach(dlg.GetPrinterDC());
    
    	DOCINFO di;
    	::ZeroMemory(&di, sizeof(DOCINFO));
    	di.cbSize = sizeof(DOCINFO);
    	di.lpszDocName = _T("TRY");
    	
    	pDoc->TagPrintTubesFlag = 1;
    	m_nMaxPages = pDoc->TagPrintTubeCount;
    
    	if (!(OnPreparePrinting(&pi))) return;  //  Here Standard Print Setup Dialog (By DoPreparePrinting(pInfo) call. )
    
    	OnBeginPrinting(&dc, &pi);
    	dc.StartDoc(&di);
    			
    	OnPrint(&dc, &pi);
    		
    	dc.EndDoc();     // Here PDF Printer Save File Dialog function
    	OnEndPrinting(&dc,&pi);
    }
    I need to avoid both of the standard Print dialog boxes. I want to give File name and Path to PDF Creator Printer to save the data .
    I have set PDF Creator Printer as default and have set the resolution , paper size etc.
    I have read about setting PDF Creator printer but could not understand how to do that.
    Last edited by new_2012; April 14th, 2014 at 03:10 AM. Reason: to give proper code tags

  4. #4
    VictorN's Avatar
    VictorN is online now Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: About Setting Print Options ..

    First, please, edit your post to correct the closing Code tag. It must be a slash, not a backslash there.
    Second, did you try to set the lpszOutput member of DOCINFO struct?
    Victor Nijegorodov

  5. #5
    Join Date
    Jan 2012
    Location
    India
    Posts
    193

    Re: About Setting Print Options ..

    Thank u VictorN sir .. I will try and will be back ..
    I have corrected my Code Tag ..

  6. #6
    Join Date
    Jan 2012
    Location
    India
    Posts
    193

    Re: About Setting Print Options ..

    VictorN Sir , I tried lpszOutput member of DOCINFO struct .. I filled it with required output file name . It created a file but that file was not in PDF format. PDF reader failed to open it. What additional settings I will need ? Pl guide

  7. #7
    VictorN's Avatar
    VictorN is online now Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: About Setting Print Options ..

    Quote Originally Posted by new_2012 View Post
    ... It created a file but that file was not in PDF format. PDF reader failed to open it. What additional settings I will need ? Pl guide
    I would begin with the reading the documentation about DOCINFO struct.
    Victor Nijegorodov

  8. #8
    Join Date
    Jan 2012
    Location
    India
    Posts
    193

    Re: About Setting Print Options ..

    I read the documentation ... pl give any clue ..
    there is no INI file for PDF creator printer ..

  9. #9
    VictorN's Avatar
    VictorN is online now Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: About Setting Print Options ..

    What .ini do you mean? MSDN article DOCINFO doesn't mention any ini!
    Perhaps you owuld need to specify lpszDatatype member of DOCINFO?
    And sorry, I never tried to print into .pdf file, so cannot help you more.
    Victor Nijegorodov

  10. #10
    Join Date
    Jan 2012
    Location
    India
    Posts
    193

    Re: About Setting Print Options ..

    Thank you victorN sir ...

    Before asking the clue , I had tried with lpszDatatype ..

    Then I read articles on printing to fixed file .. and tried for .INI settings ..

    I will work more on this .. Thankx a lott again

  11. #11
    Join Date
    May 2004
    Location
    45,000FT Above Nevada
    Posts
    1,539

    Re: About Setting Print Options ..

    I use Win2PDF and it allows me to set a file name/location/quality before I print to Win2PDF, no dialogs pop up and nothing to output before saving as a PDF file...

    I have been using this print driver since about 2006 with great success, but it's not free but close and worth every dollar.

    Just a user, not connected with them in any other way.

    http://www.win2pdf.com
    Jim
    ATP BE400 CE500 (C550B-SPW) CE560XL MU300 CFI CFII

    "The speed of non working code is irrelevant"... Of course that is just my opinion, I could be wrong.

    "Nothing in the world can take the place of persistence. Talent will not; nothing is more common than unsuccessful men with talent. Genius will not; unrewarded genius is almost a proverb. Education will not; the world is full of educated derelicts. Persistence and determination are omnipotent. The slogan 'press on' has solved and always will solve the problems of the human race."...Calvin Coolidge 30th President of the USA.

  12. #12
    Join Date
    Jan 2012
    Location
    India
    Posts
    193

    Re: About Setting Print Options ..

    Thank you vanaj sir .. I will definately try ..

  13. #13
    Join Date
    Jan 2012
    Location
    India
    Posts
    193

    Re: About Setting Print Options ..

    Thank u Vanaj sir , VictorN sir and all of you ..
    for win2pdf printer I was able to set lpszDatatype in printer setup
    and then for DocInfo in my prog ..

    All this worked well ..

  14. #14
    Join Date
    May 2004
    Location
    45,000FT Above Nevada
    Posts
    1,539

    Re: About Setting Print Options ..

    Quote Originally Posted by new_2012 View Post
    Thank u Vanaj sir , VictorN sir and all of you ..
    for win2pdf printer I was able to set lpszDatatype in printer setup
    and then for DocInfo in my prog ..

    All this worked well ..
    Glad to help, their support is also great and quick also if needed.
    Jim
    ATP BE400 CE500 (C550B-SPW) CE560XL MU300 CFI CFII

    "The speed of non working code is irrelevant"... Of course that is just my opinion, I could be wrong.

    "Nothing in the world can take the place of persistence. Talent will not; nothing is more common than unsuccessful men with talent. Genius will not; unrewarded genius is almost a proverb. Education will not; the world is full of educated derelicts. Persistence and determination are omnipotent. The slogan 'press on' has solved and always will solve the problems of the human race."...Calvin Coolidge 30th President of the USA.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured