|
From: Lothar Ochmann on 16 Jun 2008 08:59 (How) can I print JPEGs with Report Pro 2.14? There should be upto 30 pictures per page. Lothar
From: richard.townsendrose on 21 Jun 2008 03:53 Lothar its easy .... well needs a bit of thought. first of course you must drive reportpro from a database table. so i guess you have one which has all jpegs or the links to them. that means its one per line - unless you concoct a way round if the jpegs are stored INSIDE a table, viz in a memo file then you need a function to create the images in a temporary directory from where reportpro can see them. here's how we do a picture associated with a "job" a) pass the temporary path to reportpro variable b) Create the picture file we use a function like this CreateSig('J', Docjb.Jobno) = 'Ok' c) Logo's can print when its available. we check it like this IsSigFile('J', Docjb.Jobno) make sure that the functions are listed in RPForceLink here they are: 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 then of course in reportpro you must set up the picture to show you just create a picture and selecte the appropriate options. here's what we use to define the picture. cSpoolPath + 'Sig_' + CheckPrintFileName(Docgd.Gotfrom) + '.jpg' and its print when lElec .and. IsSigFile('N', Docgd.Gotfrom) FUNCTION CheckPrintFileName(cFile2Check) * remove spaces cFile2Check:=AllTrim(cFile2Check) cFile2Check:=StrTran(cFile2Check,' ','') * remove invalid naming characters cFile2Check:=StrTran(cFile2Check,'\','-') cFile2Check:=StrTran(cFile2Check,'/','-') cFile2Check:=StrTran(cFile2Check,':','-') cFile2Check:=StrTran(cFile2Check,';','-') // rgtr 070608 cFile2Check:=StrTran(cFile2Check,',','-') cFile2Check:=StrTran(cFile2Check,'.','-') cFile2Check:=StrTran(cFile2Check,'"','') cFile2Check:=StrTran(cFile2Check,"'","") RETURN cFile2Check hope that helps richard
From: Lothar Ochmann on 21 Jun 2008 06:21 Richard thx for your answer. Its not this stuff, I'm looking for. I want to read the file from harddisk and make a printout via RPP. My problem is, that RPP reads only BMPs or DIBs directly. In the meantime I found this solution: oPaint:= FabPaintLib{} cIDNR:= Trim(_oDB:FIELDGET(#xxnr)) cFilename:=GetGlobal(#PicturePath)+cIDNR+".jpg" IF File(cFilename) lOK:=oPaint:CreateFromFile(cFilename) // Zwischen-Datei (=DIB) oPaint:SaveAs("c:\test.bmp") cBitmap:= "c:\test.bmp" oReport:DrawBmp (nStartY, nStartX, cBitmap, 36.0, 27.0 , , , TRUE) ENDIF My former idea was, to use the memory for the transform (not saving and loading from harddisk) because there are a lot of pictures to display. But this testcode doesn't work for me: LOCAL oPaint AS FabPaintLib LOCAL lOK AS LOGIC LOCAL cFilename AS STRING LOCAL pDib AS PTR LOCAL oReport AS rptJPEGs oPaint:= FabPaintLib{} cFilename:="D:\sv32\sfotos\2004083016145319871124.jpeg" lOK:=oPaint:CreateFromFile(cFilename) // Fabrice pDib:= oPaint:pDibObject // VO Func pDib:= DIBCreateFromFile( String2Psz(cFilename)) The result of oPaint:CreateFromFile(cFilename) is false (because it uses inside oPaint:pDibObject) and pDib is always a NULL_PTR. Therefore I can't use the futher DIB functions. I think I should report this here in a new thread, perhaps Robert will have a solution. Regards LO
From: johan.nel on 22 Jun 2008 03:34 Lothar, Syntax: <oRpPrinter>:_DrawBmp([nY], [nX], ; oDIBMP, [nHeight], ; [nWidth], [nStartRow], ; [nStartCol], [lStretch]) Purpose: To draw a bitmap on the printer or print preview window using an already initialized DIBMP object. HTH, Johan Nel Pretoria, South Africa. > thx for your answer. Its not this stuff, I'm looking for. I want to read the > file from harddisk and make a printout via RPP. My problem is, that RPP > reads only BMPs or DIBs directly. In the meantime I found this solution:
From: Lothar Ochmann on 22 Jun 2008 07:22
Johan, I also thought about it, but how to get the DIBMP? The following code doesn't work for me (unfortunately): oPaint:= FabPaintLib{} lOK:=oPaint:CreateFromFile(cFilename) // Fabrice pDib:= oPaint:pDibObject // VO Func pDib:= DIBCreateFromFile( String2Psz(cFilename)) The result of oPaint:CreateFromFile(cFilename) is false (because it uses inside oPaint:pDibObject) and pDib is always a NULL_PTR. Should I use Window funcs? Lothar <johan.nel(a)xsinet.co.za> schrieb im Newsbeitrag news:c53bbcae-59c9-4621-a669-278e24aa1bd1(a)d77g2000hsb.googlegroups.com... > Lothar, > > Syntax: > <oRpPrinter>:_DrawBmp([nY], [nX], ; > oDIBMP, [nHeight], ; > [nWidth], [nStartRow], ; > [nStartCol], [lStretch]) > Purpose: > To draw a bitmap on the printer or print preview window using an > already initialized DIBMP object. > > HTH, > > Johan Nel > Pretoria, South Africa. >> thx for your answer. Its not this stuff, I'm looking for. I want to read >> the >> file from harddisk and make a printout via RPP. My problem is, that RPP >> reads only BMPs or DIBs directly. In the meantime I found this solution: |