From: Sherlock on
This code should work... but it does not.

cFileJPG := SELF:cPathImages + SELF:oasServer:FIELDGET(#IMGNAME)
oDib := FabPaintLib{ cFileJPG, oPrinter}
IF oDib:Isvalid
oPrinter:_DrawBMP( oPrinter:NextProw, 0, oDib, 50, 50,,,TRUE )
ENDIF
--

Older code works,, but can I do away with intermediate step of
creating a BMP ???

cFileBMP := SELF:cPathImages + _SSRandfile('') + ".BMP"
IF File( cFileJPG )
hPTR := DIBCreateFromFile(String2Psz(cFileJPG))
IF hPTR != NULL_PTR
DIBSaveAs( hPTR, String2Psz(cFileBMP))
oPrinter:DrawBmp( aImageOffset[xx][1], aImageOffset[xx][2],
cFileBMP, 32*1.25, 48*1.25,,,TRUE )
FErase( cFileBMP )
ENDIF

Phil McGuinness
From: Stephen Quinn on
Phil

IIRC RP only supports BMPs (that was RP2.11 though)
Printing might also depend on the colour depth (2-4) of the image as well, I
remember having trouble with printing images 32 bit images (but that may
have been just me<g>).

CYA
Steve


From: richard.townsendrose on
Phil

we print logos associated with a person [signatures] and with a job [a
pretty picture] from ReportPro

in reportpro we make two calls:
a) create the jpeg - why use a ruddy bitmap of huge size ?
b) check its there - sometimes we have people with no siganures or
jobs without a picture

the code is below - hope it all helps ...

richard
*****************************************************
FUNCTION CreateSig(cType, cRef)
LOCAL oNS AS dbServer
LOCAL cTmpFile AS STRING
LOCAL cRet AS STRING

oNS:=SysObject():oDOCNSRP

// locate
IF oNS:Seek(cType + PadR(cRef,8))
// create file
cRef:=CheckPrintFileName(cRef)
IF cType == 'N'
cTmpFile:=SysObject():GetSet(SpoolPath) + 'Sig_' + AllTrim(cRef) +
'.jpg'
ELSEIF cType == 'J'
cTmpFile:=SysObject():GetSet(SpoolPath) + 'Logo_' + AllTrim(cRef) +
'.jpg'
ENDIF
IF oNS:AX_BLOB2File(cTmpFile, 'SIGBITMAP')
cRet:='Ok'
ELSE
cRet:='Fail'
ENDIF
ELSE
cRet:='None'
ENDIF

RETURN cRet
FUNCTION IsSigFile(cType, cRef)
LOCAL lOk:=FALSE AS LOGIC

cRef:=CheckPrintFileName(cRef)
IF cType == 'N'
lOk:=File(SysObject():GetSet(SpoolPath) + 'Sig_' + cRef + '.jpg')
ELSEIF cType == 'J'
lOk:=File(SysObject():GetSet(SpoolPath) + 'Logo_' + cRef + '.jpg')
ENDIF

RETURN lOk

and finally here's the structure of the table that holdstha signature
or picture ...

aDataStruct[FileDOCNS,3]:={ ;
{ 'REFTYPE ' , 'C', 1, 0}, ; // N -> Names
Signature, J -> Job Logo
{ 'NAMEREF ' , 'C', 8, 0}, ;
{ 'SIGBITMAP ' , 'M', 10, 0}, ;
{ 'SIGUSED ' , 'L', 1, 0}}

aDataStruct[FileDOCNS,4]:= { ;
{'DOCNS1','REFTYPE + NAMEREF', {||_FIELD->REFTYPE + _FIELD-
>NAMEREF}, NIL, NIL}}

and how it gets there ...
lOk:=SELF:oNS:AX_File2BLOB(cTmpFile, 'SIGBITMAP')
IF lOk
SELF:oNS:Commit()
IF SELF:lSig
cStr:=MemoRead(cTmpFile)
SELF:oNM:FIELDPUT(#SIGCODE, Crypt(NTrim(SLen(cStr)), RGTR))
SELF:oNM:Commit()
ENDIF
ELSE
TextBox{SELF, 'Problem','Failed to Write to Table'}:Show()
ENDIF

and how we show it on screen
SELF:oDCFabSig:Image := FabPaintlib { cFileName , SELF }
SELF:oDCFabSig:ImageFit:=TRUE
SELF:oDCSigFile:Value:=cFileName

and from the opendialog ..
oOD:SetFilter ({"*.TIF; *.BMP; *.DIB; *.TGA; *.PNG; *.PCX; *.PCT;
*.JPG; *.JPEG", "*.*"}, {"Images","All Files"}, 1)

From: Sherlock on
Richard

snip[ we print logos associated with a person [signatures] and with a
job [a pretty picture] from ReportPro > in reportpro we make two
calls:
> a) create the jpeg - why use a ruddy bitmap of huge size ? > b) check its there - sometimes we have people with no siganures or jobs without a picture
the code is below - hope it all helps ...

mmm.. But where do you print the JPG file... I could not see this is
the code..

Thanks btw...

Phil McGuinness
From: richard.townsendrose on
Phil

the jpeg is printed by reportpro of course.

1) create the jpeg - call function createsig(cType, cRef) in reportpro

2) function issigfile() used in reportpro to check its ok to print

3) a picture with this as its code
alltrim(cSpoolPath) + 'Sig_' +
CheckPrintFileName(alltrim(Docnm.Nameref)) + '.jpg'

richard