in

Archived Data Techniques Forums

Arguments for ImgPrintImage menthod

Last post 08-21-2009 9:55 AM by support. 10 replies.
Page 1 of 1 (11 items)
Sort Posts: Previous Next
  • 07-24-2009 6:34 AM

    • Shash
    • Top 150 Contributor
    • Joined on 07-24-2009
    • India
    • Posts 7

    Arguments for ImgPrintImage menthod

     Hi,

    I am trying to print a image using ImgMan32.dll. The ImgPrintImage menthod sgnature is ,

    ImgPrintImage(HANDLE hImage, HDC hDc, LPRECT lpDestRect, LPRECT lpSrcRect)

    This is the first time I am working on the actual printing workflow and i am not able to understand how to get the lpDestRect argument right.. for the lpSrcRect I will pass NULL so that the whole image gets printed. 

    Could you please how to get the lpDestRect correct? 

    Also do i need to do some setup for the CDC (associated to PrintDialog)  object before  sending in its handle?

    Shash
  • 07-24-2009 9:53 AM In reply to

    Re: Arguments for ImgPrintImage menthod

    HI,

    The lpDST rect specifies the size and placement of the image on the device context for the printer. The coordinates are specified in whatever logical units you are mapping the device context to.  Look at the imageman C++ sample for an example of calling ImgPrintImage.

     As for the DC setup, it all depends on what your app needs to print and how you want to handle the printing.

  • 07-24-2009 11:15 AM In reply to

    • Shash
    • Top 150 Contributor
    • Joined on 07-24-2009
    • India
    • Posts 7

    Re: Arguments for ImgPrintImage menthod

    Hi, Thanks for the quick reply. Could you please give me the location where the c++ example is ? I searched in the site and i could not find it. May be i ve missed some place. Please give me a link.
    Shash
  • 07-27-2009 1:50 AM In reply to

    • Shash
    • Top 150 Contributor
    • Joined on 07-24-2009
    • India
    • Posts 7

    Re: Arguments for ImgPrintImage menthod

    Hi ... could you please give me the link to sample code
    Shash
  • 07-29-2009 12:37 AM In reply to

    • Shash
    • Top 150 Contributor
    • Joined on 07-24-2009
    • India
    • Posts 7

    Re: Arguments for ImgPrintImage menthod

     Hi,

     

    Could you please give VC++ example to print a image?

    Shash
  • 08-03-2009 5:23 PM In reply to

    Re: Arguments for ImgPrintImage menthod

    Hi,

    The MFC Sample Application/Projects includes C++ code showing how to print an image. Its part of the ImageMan DLL Install.

  • 08-14-2009 7:04 AM In reply to

    • Shash
    • Top 150 Contributor
    • Joined on 07-24-2009
    • India
    • Posts 7

    Re: Arguments for ImgPrintImage menthod

    How does imgPrintImage() take care of the margin while printing the image on to the device context which we send?

    User can select some margin in the print dialog. But we pass in the destination rect to imgPrintImage()..

    So does this function start drawing on to the device context from (top, left) of the dest rect which we pass in? or is it (top1, left1) where

    top1 = ( Std margin selected in print dlg + top of dest rect )

    left1 =  ( Std margin selected in print dlg + left of dest rect )

     

    Please reply ASAP...

     

    Thanks in advance

    Shash
  • 08-14-2009 7:14 AM In reply to

    Re: Arguments for ImgPrintImage menthod

    Hello,

    The coordinates you pass to ImgPrintImage  are relative to the Device context logical coordinate system.

    Sean
    Data Techniques Online Support
  • 08-21-2009 8:23 AM In reply to

    • Shash
    • Top 150 Contributor
    • Joined on 07-24-2009
    • India
    • Posts 7

    Re: Arguments for ImgPrintImage menthod

     Hi,

    When i do a imgGetInfo(), the pointer to the BITMAPINFO structure does not have  biXPelsPerMeter and biXPelsPerMeter until i save the image into the database and then retrieve it. After saving i can get these two pieces of information.

    Could you please tell me how imgGetInfo() works inorder to populate the indivuidual members of the BITMAPINFO structure? And what are factors it depends on to retrieve thestructure info and from where exactly does it retrieve them from?

    Shash
  • 08-21-2009 8:28 AM In reply to

    • Shash
    • Top 150 Contributor
    • Joined on 07-24-2009
    • India
    • Posts 7

    Re: Arguments for ImgPrintImage menthod

     The reason i am asking the above question is currently i am writing code to print the images from ImageMan. i am doing something like this to make very small image print well

     

    Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4 /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-qformat:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif";}

    int flags(0);

    LBITMAPINFO lpbi = imgGetInfo(hImage, &flags);  ==è This is the API which returns a pointer to ImageMan's internal BITMAPINFO struct for the given image

     

    //Below code gives DPI for the image on the screen

    int nHorzImgDPI = lpbi->bmiHeader.biXPelsPerMeter / 39.37;   ==è We Get 0 before save and 300 after saving document

    int nVertImgDPI = lpbi->bmiHeader.biYPelsPerMeter / 39.37;   ==è We Get 0 before save and 300 after saving document

     

    //This is to get the DPI for the printer device

    nVertDPI = pDC->GetDeviceCaps( LOGPIXELSY );

    nHorzDPI = pDC->GetDeviceCaps( LOGPIXELSX );

     

    destRect.left = HorzMargin;

    destRect.top = VertMargin;

    destRect.bottom = (int)(((float)pImg->Height() / nVertImgDPI) * nVertDPI); ==èIf nVertImgDPI goes high, destRect.bottom will go low

    destRect.right = (int)(((float)pImg->Width() / nHorzImgDPI) * nHorzDPI); ==èIf nHorzImgDPI goes high, destRect. right will go low

     

    I got this code from the Sample application from ImageMan install suite. 

     Now since the values for nHorzImgDPI and nVertImgDPI are different before and after saving the image to backend, user see different size of the same image printed before and after save.

    please explain me as what goes on behind scenes in ImageMan.

    Shash
  • 08-21-2009 9:55 AM In reply to

    Re: Arguments for ImgPrintImage menthod

    Hi,

     

    Whats your question exactly ? What part of ImageMan are you interested in finding out about behind the scenes ? The printing or the loading ?

    Sean
    Data Techniques Online Support
Page 1 of 1 (11 items)
Copyright 2009 Data Techniques, Inc. All Rights Reserved.