?
Solved

Setting Paper size within Win32 MFC program

Posted on 1997-07-06
1
Medium Priority
?
381 Views
Last Modified: 2013-12-03
The documented SetDocumentProperties() API does not seem to work as stated.  I am writing a program that needs to print to a pre-printed form that is a strange size (205 mm X 433 mm).  According to Microsoft I can use the DM_PAPERLENGTH and DM_PAPERWIDTH in the DEVMODE structure to set the paper size to any size I need (specified in .1 mm units).  Unfortunately this doesn't seem to be supported by all drivers (some dot-matrix printers I tested didn't work).  Is there a better way to specify odd sized paper within an MFC program?

Thanks.
0
Comment
Question by:bbishop
[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
1 Comment
 
LVL 4

Accepted Solution

by:
tflai earned 300 total points
ID: 1400213
I have an easy solution that I did to imitate the effect of
an user changing printer setting.  It was for MSVC 1.5, but
I think it should also work for you.

      CPrintDialog pd(TRUE);
      CWinApp::UpdatePrinterSelection(FALSE);
      pd.m_pd.hDevMode = m_hDevMode;
      LPDEVMODE DevMode = pd.GetDevMode();      
      DevMode->dmOrientation = DMORIENT_LANDSCAPE;

Here, I make my MSVC application to start out with
landscape orientation regardless of what the
default printer setting is.  And for printer paper
size or other options, just change the other fields
of DEVMODE structure.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article shows how to make a Windows 7 gadget that accepts files dropped from the Windows Explorer.  It also illustrates how to give your gadget a non-rectangular shape and how to add some nifty visual effects to text displayed in a your gadget.…
What my article will show is if you ever had to do processing to a listbox without being able to just select all the items in it. My software Visual Studio 2008 crystal report v11 My issue was I wanted to add crystal report to a form and show…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

765 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