FWH Application generates PDF with image from MS SQL table

FWH Application generates PDF with image from MS SQL table

Postby cdmmaui » Tue Sep 06, 2022 10:37 pm

Hello Everyone,

Does anyone have a FWH example that creates a PDF with an image blob located in MS SQL and image as a file? I am looking to recreate the attached PDF.

https://s-c-technology.com/temp/SBMA05070.pdf

Thank you in advance for your help.
*~*~*~*~*~*~*~*~*~*
Darrell Ortiz
CDM Software Solutions, Inc.
https://www.cdmsoft.com
User avatar
cdmmaui
 
Posts: 689
Joined: Fri Oct 28, 2005 9:53 am
Location: Houston ∙ Chicago ∙ Los Angeles ∙ Miami ∙ London ∙ Hong Kong

Re: FWH Application generates PDF with image from MS SQL table

Postby cmsoft » Tue Sep 06, 2022 11:57 pm

Puedes usar la potencia de la clase print.
Puedes imprimir imagenes, graficos, codigos de barra, texto en diferentes colores y fuentes, etc.
Code: Select all  Expand view  RUN

#include "FiveWin.ch"
#include "print.ch"


FUNCTION Main()

   local oPrn, i, oFont1, oFont2, nRow,;
    aLines :=  {"ESTA ES LA LINEA 1","ESTA ES LA LINEA 2","ESTA ES LA LINEA 3","ESTA ES LA LINEA 4",;
                "ESTA ES LA LINEA 5","ESTA ES LA LINEA 6","ESTA ES LA LINEA 7","ESTA ES LA LINEA 8"}
   DEFINE FONT oFont1  NAME "ARIAL"       SIZE 60,80 BOLD
   DEFINE FONT oFont2  NAME "CALIBRI"     SIZE 24,36
   PRINT oPrn NAME "Prueba" PREVIEW
      oPrn:SetPortrait()
      oPrn:SetPage(9)
      PAGE
          @ 1.6,.6 PRINT TO oPrn IMAGE "..\BITMAPS\Fw.bmp" SIZE 3, 1 CM
          @ 5  , 1 PRINT TO oPrn TEXT "TITULO DEL DOCUMENTO" SIZE 18,1 CM FONT oFont1 ALIGN "C"
          @ 6  , 1 PRINT TO oPrn TEXT "SUBTITULO DEL DOCUMENTO" SIZE 18,1 CM FONT oFont1 ALIGN "C" OUTLINE nRgb(170,150,12) SIZE .01
          nRow := 7
          FOR i := 1 TO LEN(aLines)
              @ nRow,1 PRINT TO oPrn TEXT aLines[i] SIZE 10,1 CM FONT oFont2 LASTROW nRow
          NEXT i
          @ 13, 2  PRINT TO oPrn  BAR CHART { { 14280, 20420, 12870, 25347, 7640 },;
                     { 8350, 10315, 15870, 5347, 12340 },;
                     { 12345, -8945, 10560, 15600, 17610 } } ;
                  SIZE 8,3 TITLE "Titulo De Grafico" CM
          @ 13, 10.2  PRINT TO oPrn  LINE CHART { { 14280, 20420, 12870, 25347, 7640 },;
                     { 8350, 10315, 15870, 5347, 12340 },;
                     { 12345, -8945, 10560, 15600, 17610 } } ;
                  SIZE 8,3 TITLE "Titulo De Grafico" CM

          @ 18, 2  PRINT TO oPrn IMAGE "..\BITMAPS\OLGA1.jpg" SIZE 6, 9 CM
          @ 18 ,16 PRINT TO oPrn TEXT "https://www.google.com" AS BARCODE  SIZE 3, 1 CM
      ENDPAGE
   ENDPRINT
   
RETURN NIL
 


Mira los ejemplos pdfharu2.prg pdfharu.prg en samples
User avatar
cmsoft
 
Posts: 1292
Joined: Wed Nov 16, 2005 9:14 pm
Location: Mercedes - Bs As. Argentina

Re: FWH Application generates PDF with image from MS SQL table

Postby cdmmaui » Wed Sep 07, 2022 12:11 am

Gracias Cesar!
*~*~*~*~*~*~*~*~*~*
Darrell Ortiz
CDM Software Solutions, Inc.
https://www.cdmsoft.com
User avatar
cdmmaui
 
Posts: 689
Joined: Fri Oct 28, 2005 9:53 am
Location: Houston ∙ Chicago ∙ Los Angeles ∙ Miami ∙ London ∙ Hong Kong

Re: FWH Application generates PDF with image from MS SQL table

Postby nageswaragunupudi » Wed Sep 07, 2022 2:31 am

Code: Select all  Expand view  RUN
#include "fivewin.ch"

REQUEST FWHARU // Optional

function Main()

   local oCn, oRs
   local oPrn

   TPrinter():lUseHaruPDF := .t. // optional

   oCn   := FW_MSSQLDB()
   oRs   := FW_OpenRecordSet( oCn, "wwonders" )

   PRINT oPrn PREVIEW FILE "msimage.pdf"

   PAGE
      @ 1,1 PRINT TO oPrn IMAGE oRs:Fields( "Image" ):Value SIZE 4,4 INCHES
   ENDPAGE

   ENDPRINT

   oRs:Close()
   oCn:Close()

return nil
 
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10646
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: FWH Application generates PDF with image from MS SQL table

Postby cdmmaui » Wed Sep 07, 2022 2:36 am

Hi Rao,

Thank you! Can I create lines as well and add an image from local hard drive? If so, can you provide a simple example?

Thank you!
*~*~*~*~*~*~*~*~*~*
Darrell Ortiz
CDM Software Solutions, Inc.
https://www.cdmsoft.com
User avatar
cdmmaui
 
Posts: 689
Joined: Fri Oct 28, 2005 9:53 am
Location: Houston ∙ Chicago ∙ Los Angeles ∙ Miami ∙ London ∙ Hong Kong

Re: FWH Application generates PDF with image from MS SQL table

Postby nageswaragunupudi » Wed Sep 07, 2022 4:53 am

From a file on local hard drive:
Code: Select all  Expand view  RUN
    @ 1,1 PRINT TO oPrn IMAGE "c:\fwh\bitmaps\olga1.jpg" SIZE 3,4 INCHES
 


Lines:
Code: Select all  Expand view  RUN
oPrn:Line( nTop, nLeft, nBottom, nRight, oPen, cUnits )
// cUnits can be "INCHES", "CM", "MM". If omitted, pixels
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10646
Joined: Sun Nov 19, 2006 5:22 am
Location: India


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 46 guests