O$ Printing a picture

Kelly Burgess kellyb at montana.com
Tue May 20 06:26:47 EDT 2008


Hi Linda,

>Where can I find the property $rawpictformat on the report?

You can use pictconvto() to produce the right format, because the 
report object doesn't have such a property.

I use a kPictureObject on a report, and I load the data in the $print 
method for the positioning section that determines whether or not to 
include the picture.

  If iPrintPicture
    Begin reversible block
      Set main file {fImage}
    End reversible block
    Clear main file
    Find on fImage.IM_RECID (Exact match) {fRecipe.REC_ID}
    If flag true
      ; picture is the Picture field $dataname of recipeImage kPictureObj
      ; convert the source picture into the picture instance variable
      Do pictconvto(pictformat(fImage.IM_IMAGE),fImage.IM_IMAGE,'CS24')
        Returns picture
      Do pictsize(picture,pictWidth,pictHeight) Returns return
      If return&pictWidth<>0
        If (pictWidth/72>4.0)|(pictHeight/72>4.0)   
          ; scale pictures larger than 4 inches wide or high...
          Calculate $cinst.$objs.recipeImage.$noscale as kFalse
          If pictWidth>pictHeight
            Calculate newWidth as 4.0
            Calculate newHeight as 4.0*(pictHeight/pictWidth)
          Else
            Calculate newHeight as 4.0
            Calculate newWidth as 4.0*(pictWidth/pictHeight)
          End If
          ; scaling on, set exact height and width of picture field
          Calculate $cinst.$objs.recipeImage.$height as newHeight
          Calculate $cinst.$objs.recipeImage.$width as newWidth
        Else
          ; no scaling, actual image width used regardless of field size
          Calculate newWidth as pictWidth
        End If
        ; center horizontally on page
        Calculate $cinst.$objs.recipeImage.$left as (7.75-newWidth)/2
        Do default
      End If
    End If
  End If

The DML source of the data, fImage.IM_IMAGE, is also a Picture field 
type, so you should be able to adapt the above to use your row column.

Hope that helps,

Kelly



More information about the omnisdev-en mailing list