Printing / DEVMODE issue
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: Printing / DEVMODE issue

  1. #1
    Join Date
    Feb 2000
    Posts
    26

    Printing / DEVMODE issue

    Without posting a lot of code, I will try to explain what I am experiencing.

    I have an app that prints a custom size form (~ 4"x7") in both portrait and landscape orientation.

    I provide the user a Page Setup menu item. Using the standard DocumentProperties() API function I acquire a populated DEVMODE structure from the last selected printer (or default for first time). In this structure, I test the for support in the following fields and set the appropriate structure member orientation, paper size, paper length and paper width.

    I then use this member in a call to PageSetupDlg (). The dialog shows a correctly scaled page in the painted portion of this dialog and correctly responds when I select the page orientation. No problems here.

    The problem occurs when I try to print using this same DEVMODE structure.

    In portrait mode, there is no issue. However, when I select landscape mode, the text does in fact rotate BUT it is still printing on a form I assume MUST be in portrait mode. Therefore, the printing is all out of place.

    Do I have to swap the width and length members in my DEVMODE structure as well? When I do this, the printing works fine. However, if I enable custom painting in the PageSetupDlg (), something gets confused. It is like the PageSetupDlg() expects the width and length to be set as in portrait mode (and correctly handles the painting) but the HDC from the CreateDC() calls expects me to swap the width and length to match the desired orientation. Should I be using the SetWorldTransform() on the printing HDC?

    There was a post from several years ago about this but I didn't see any resolution. Any help would be appreciated.

    Thanks,
    Jim

  2. #2
    Join Date
    Mar 2003
    Location
    India {Mumbai};
    Posts
    3,871

    Re: Printing / DEVMODE issue

    One of these may help you:
    http://www.codeproject.com/KB/printing/
    My latest article: Explicating the new C++ standard (C++0x)

    Do rate the posts you find useful.

  3. #3
    Join Date
    Feb 2000
    Posts
    26

    Re: Printing / DEVMODE issue

    Unfortunately, I don't see any WIN32 examples. Seems most are MFC, C# or .NET implementations.

    I will keep going through the examples.

    Thanks,
    Jim

Tags for this Thread

Posting Permissions

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


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center