CODIGO DE BARRAS. ERROR CON FILLRECT()

Re: CODIGO DE BARRAS. ERROR CON FILLRECT()

Postby karinha » Mon May 13, 2024 11:55 am

Mira se no és esto:

Code: Select all  Expand view

\source\function\IMGTXTIO.PRG
 


https://www.forums.fivetechsupport.com/viewtopic.php?f=3&t=39585#p263522

Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7326
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: CODIGO DE BARRAS. ERROR CON FILLRECT()

Postby nageswaragunupudi » Tue May 14, 2024 6:11 am

pedroluis wrote:Hola amigos !

Como puedo solucionar la impresión de un código de barras
que saqué de barlib.zip de libre distribución,
que tiene el programa go_code.prg y que me da error al
querer imprimir al usar la función FILLRECT().
Gracias, como siempre !

Compiler version: xHarbour 1.2.3 Intl. (SimpLex) (Build 20221118)
FiveWin version: FWH 23.07
C compiler version: Borland/Embarcadero C++ 7.4 (32-bit)
Windows 10 64 Bits, version: 6.2, Build 9200

Error description: Warning BASE/1004 Message not found: FWPDF:FILLRECT

Stack Calls
===========
Called from: source\rtl\tobject.prg => FWPDF:ERROR( 0 )
Called from: source\rtl\tobject.prg => FWPDF:MSGNOTFOUND( 0 )
Called from: source\rtl\tobject.prg => FWPDF:FILLRECT( 0 )
Called from: go_code.prg => GO_CODE( 38 )
Called from: barlib.prg => CODE128( 34 )
Called from: barlib.prg => C_CODE128( 39 )


FWH uses FWPDF class to generate PDF using HaruPDF.
As of now, this class does not support the method FillRect().

So, while using this 3rd party lib "barlib.prg", we need to generate PDF without using HaruPDF.
Please do
Code: Select all  Expand view

TPrinter():lUseHaruPDF := .F.
PRINT oPrn FILE cPdf
 


After seeing your posting, we are considering making some additions to FWPDF class . This may take a few days and we will share the new fwpdf.prg once it is ready.
Regards

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

Re: CODIGO DE BARRAS. ERROR CON FILLRECT()

Postby nageswaragunupudi » Tue May 14, 2024 7:05 am

But most importantly, we DO NOT NEED any 3rd party library for generating, display and printing any barcodes or QRCodes.

FWH is natively capable of generating and printing not only CODE128 barcodes but many other types of barcodes and qr-codes, with or without HaruPDF.

Please try this small example:
Code: Select all  Expand view

#include "fivewin.ch"

REQUEST FWZEBRA
REQUEST FWHARU

function Main()

   local cName, cCity, cCountry, cItem
   local oPrn, oFont

   cName    := "Antonio Linares"
   cCity    := "Marbella"
   cCountry := "Spain"
   cItem    := "123456789012"

   TPrinter():lUseHaruPDF := .t.

   PRINT oPrn PREVIEW FILE "barcode.pdf"

   DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-14 OF oPrn

   PAGE

   @ 1.00, 1 PRINT TO oPrn TEXT cName    SIZE 4, 0.3 INCHES FONT oFont
   @ 1.30, 1 PRINT TO oPrn TEXT cCity    SIZE 4, 0.3 INCHES FONT oFont
   @ 1.60, 1 PRINT TO oPrn TEXT cCountry SIZE 4, 0.3 INCHES FONT oFont
   @ 1.90, 1 PRINT TO oPrn TEXT cItem    SIZE 4, 0.3 INCHES FONT oFont

   @ 1.00,5.00 PRINT TO oPrn TEXT "Address :" + CRLF + cName + CRLF + cCity + CRLF + cCountry + CRLF + cItem ;
      AS BARCODE TYPE "QR-CODE" SIZE 2,2 INCHES

   @ 3.0, 1 PRINT TO oPrn TEXT cName + " : CODE128" SIZE 4.0, 0.3 INCHES FONT oFont
   @ 3.5, 1 PRINT TO oPrn TEXT cName AS BARCODE TYPE "CODE128" SIZE 4,1 INCHES

   @ 5.5, 1 PRINT TO oPrn TEXT cItem + " : EAN13" SIZE 4.0, 0.3 INCHES FONT oFont
   @ 6.0, 1 PRINT TO oPrn TEXT cItem AS BARCODE TYPE "EAN13" SIZE 4,1 INCHES

   ENDPAGE

   ENDPRINT

   RELEASE FONT oFont

return nil


Please build this sample in the samples folder using buildh.bat or buildx.bat.

This is the screen-shot of PDF file generated with HaruPDF:

Image

Please re-consider.
Do you really need a 3rd party lib?
Why can you not use FWH native capability to generate Bar Codes?
Regards

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

Re: CODIGO DE BARRAS. ERROR CON FILLRECT()

Postby pedroluis » Tue May 14, 2024 1:43 pm

Muchas gracias Sr. Rao, funciona perfecto !
Como dice usted, no hace falta usar una librería externa.

Sólo unos problemitas:

1) En mi programa tengo 17 fonts distintos, y cuando imprime el código de barras realmente no se cuál toma y no se como definirle uno determinado.
2) En el SIZE <nWidth>, si pongo un valor menor que 4, queda igual. No se achica. El BARSIZE <nSize> no funciona. Me da error de compilación.

Pero a pesar de todo, con la respuesta que amablemente me pasó, se pudo solucionar el problema.
Muchisimas gracias !
Pedro L. Lavallen
San Luis (Capital), Argentina
User avatar
pedroluis
 
Posts: 117
Joined: Sun Oct 08, 2017 12:51 pm
Location: San Luis (Capital), Argentina

Re: CODIGO DE BARRAS. ERROR CON FILLRECT()

Postby pedroluis » Tue May 14, 2024 3:08 pm

Sr.Rao

No puedo ajustar el ancho del código de barras
Necesito que tenga 4 cms. de ancho y sale de 4.7 cms.

@ 25.55+x3,01.00 PRINT TO oPrn TEXT mcodbar1 AS BARCODE TYPE "CODE128" SIZE 4,0.8 CM

La altura de 0.8 cms sale bién.

Gracias !
Pedro L. Lavallen
San Luis (Capital), Argentina
User avatar
pedroluis
 
Posts: 117
Joined: Sun Oct 08, 2017 12:51 pm
Location: San Luis (Capital), Argentina

Re: CODIGO DE BARRAS. ERROR CON FILLRECT()

Postby cmsoft » Tue May 14, 2024 3:20 pm

Pedro, con el ejemplo de Mr. Rao, puedes darle el ancho y largo al codigo de barra o QR en el mismo SIZE
Te dejo el ejemplo
Code: Select all  Expand view
#include "fivewin.ch"

REQUEST FWZEBRA
REQUEST FWHARU

function Main()

   local cName, cCity, cCountry, cItem
   local oPrn, oFont

   cName    := "Antonio Linares"
   cCity    := "Marbella"
   cCountry := "Spain"
   cItem    := "123456789012"

   TPrinter():lUseHaruPDF := .t.

   PRINT oPrn PREVIEW FILE "barcode.pdf"

   DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-14 OF oPrn

   PAGE

   @ 1.00, 1 PRINT TO oPrn TEXT cName    SIZE 4, 0.3 INCHES FONT oFont
   @ 1.30, 1 PRINT TO oPrn TEXT cCity    SIZE 4, 0.3 INCHES FONT oFont
   @ 1.60, 1 PRINT TO oPrn TEXT cCountry SIZE 4, 0.3 INCHES FONT oFont
   @ 1.90, 1 PRINT TO oPrn TEXT cItem    SIZE 4, 0.3 INCHES FONT oFont

   @ 1.00,5.00 PRINT TO oPrn TEXT "Address :" + CRLF + cName + CRLF + cCity + CRLF + cCountry + CRLF + cItem ;
      AS BARCODE TYPE "QR-CODE" SIZE 2,2 INCHES
   @ 1.00,7.50 PRINT TO oPrn TEXT "Address :" + CRLF + cName + CRLF + cCity + CRLF + cCountry + CRLF + cItem ;
      AS BARCODE TYPE "QR-CODE" SIZE 0.5,0.5 INCHES   // Mas chico

   @ 3.0, 1 PRINT TO oPrn TEXT cName + " : CODE128" SIZE 4.0, 0.3 INCHES FONT oFont
   @ 3.5, 1 PRINT TO oPrn TEXT cName AS BARCODE TYPE "CODE128" SIZE 4,1 INCHES
   @ 3.5, 5.2 PRINT TO oPrn TEXT cName AS BARCODE TYPE "CODE128" SIZE 1.2,0.3 INCHES //Mas chico

   @ 5.5, 1 PRINT TO oPrn TEXT cItem + " : EAN13" SIZE 4.0, 0.3 INCHES FONT oFont
   @ 6.0, 1 PRINT TO oPrn TEXT cItem AS BARCODE TYPE "EAN13" SIZE 4,1 INCHES
   @ 6.0, 5.2 PRINT TO oPrn TEXT cItem AS BARCODE TYPE "EAN13" SIZE 0.5,0.2 INCHES //Mas chico

   ENDPAGE

   ENDPRINT

   RELEASE FONT oFont

return nil

Image
User avatar
cmsoft
 
Posts: 1203
Joined: Wed Nov 16, 2005 9:14 pm
Location: Mercedes - Bs As. Argentina

Re: CODIGO DE BARRAS. ERROR CON FILLRECT()

Postby nageswaragunupudi » Tue May 14, 2024 5:44 pm

1) En mi programa tengo 17 fonts distintos, y cuando imprime el código de barras realmente no se cuál toma y no se como definirle uno determinado.


Barcode does not use any font. Nothing to do with fonts.


2) En el SIZE <nWidth>, si pongo un valor menor que 4, queda igual. No se achica. El BARSIZE <nSize> no funciona. Me da error de compilación.


We need to provide both width and height in the SIZE clause
Code: Select all  Expand view
.. SIZE  nWidth, nHeight UNITS INCHES/CM/MM


Please give me a sample text and the maximum width and height ( in CM ) you want.
In any case, text of a given length requires a minimum width because each character requires some minimum number of pixels.
Regards

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

Re: CODIGO DE BARRAS. ERROR CON FILLRECT()

Postby pedroluis » Tue May 14, 2024 8:12 pm

Este código de barras, tendría que tener 4 CM 100003222186321900 (18 dígitos)
Este otro código de barras tendría que tener 8.5 CM 30634973938A00030000322274188595079486 (38 dígitos)
Pedro L. Lavallen
San Luis (Capital), Argentina
User avatar
pedroluis
 
Posts: 117
Joined: Sun Oct 08, 2017 12:51 pm
Location: San Luis (Capital), Argentina

Re: CODIGO DE BARRAS. ERROR CON FILLRECT()

Postby cmsoft » Tue May 14, 2024 9:14 pm

Asi podrias definirlas
Code: Select all  Expand view
#include "fivewin.ch"

REQUEST FWZEBRA
REQUEST FWHARU

function Main()

   local cName, cCity, cCountry, cItem, cItem2
   local oPrn, oFont, oFont1

   cName    := "Antonio Linares"
   cCity    := "Marbella"
   cCountry := "Spain"
   cItem    := "100003222186321900"
   cItem2   := "30634973938A00030000322274188595079486"

   TPrinter():lUseHaruPDF := .t.

   PRINT oPrn PREVIEW FILE "barcode.pdf"

   DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-14 OF oPrn
   DEFINE FONT oFont1 NAME "TAHOMA" SIZE 0,-07 OF oPrn

   PAGE

   @ 1.00, 1 PRINT TO oPrn TEXT cName    SIZE 4, 0.3 CM FONT oFont
   @ 2.00, 1 PRINT TO oPrn TEXT cCity    SIZE 4, 0.3 CM FONT oFont
   @ 3.00, 1 PRINT TO oPrn TEXT cCountry SIZE 4, 0.3 CM FONT oFont
   @ 4.00, 1 PRINT TO oPrn TEXT cItem    SIZE 4, 0.3 CM FONT oFont

   @ 5.0, 1 PRINT TO oPrn TEXT cItem   SIZE 7.5, 3 CM FONT oFont1
   @ 5.0, 9 PRINT TO oPrn TEXT cItem AS BARCODE TYPE "CODE128" SIZE 4,1 CM


   @ 7.5, 1 PRINT TO oPrn TEXT cItem2 SIZE 7.5, 3 CM FONT oFont1
   @ 7.5, 9 PRINT TO oPrn TEXT cItem2 AS BARCODE TYPE "CODE128" SIZE 8.5,1 CM
   

   ENDPAGE

   ENDPRINT

   RELEASE FONT oFont

return nil


Image
User avatar
cmsoft
 
Posts: 1203
Joined: Wed Nov 16, 2005 9:14 pm
Location: Mercedes - Bs As. Argentina

Re: CODIGO DE BARRAS. ERROR CON FILLRECT()

Postby pedroluis » Wed May 15, 2024 1:04 am

Hola amigo !

El tema es que el primero quiero que me quede de un tamaño de 4 cmts. y el segundo de 8,5 una vez impresos,
y eso es lo que no logro.
Pedro L. Lavallen
San Luis (Capital), Argentina
User avatar
pedroluis
 
Posts: 117
Joined: Sun Oct 08, 2017 12:51 pm
Location: San Luis (Capital), Argentina

Re: CODIGO DE BARRAS. ERROR CON FILLRECT()

Postby JoseAlvarez » Wed May 15, 2024 2:07 am

pedroluis wrote:Hola amigo !

El tema es que el primero quiero que me quede de un tamaño de 4 cmts. y el segundo de 8,5 una vez impresos,
y eso es lo que no logro.


Una idea loca, prueba con (4.00) , (0.8 )
"Los errores en programación, siempre están entre la silla y el teclado..."

Fwh 19.06 32 bits + Harbour 3.2 + Borland 7.4 + MariaDB + TDolphin

Carora, Estado Lara, Venezuela.
User avatar
JoseAlvarez
 
Posts: 738
Joined: Sun Nov 09, 2014 5:01 pm

Re: CODIGO DE BARRAS. ERROR CON FILLRECT()

Postby nageswaragunupudi » Wed May 15, 2024 9:26 am

pedroluis wrote:Hola amigo !

El tema es que el primero quiero que me quede de un tamaño de 4 cmts. y el segundo de 8,5 una vez impresos,
y eso es lo que no logro.


Is this a legal requirement? Don't we have any choice to increase the size by an extra of 1/2 cm?
Regards

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

Re: CODIGO DE BARRAS. ERROR CON FILLRECT()

Postby cmsoft » Wed May 15, 2024 12:43 pm

Pedro, tienes razón
Aunque le indicamos 4cm el ancho del codigo de barra es 4.5 cm aprox y el de 8.5 es casi 9.5 cm
No habia hecho la prueba de medirlos
Tambien probé con mm y el resultado es el mismo.
Tal vez Mr. Rao nos pueda explicar si hay alguna solucion
User avatar
cmsoft
 
Posts: 1203
Joined: Wed Nov 16, 2005 9:14 pm
Location: Mercedes - Bs As. Argentina

Re: CODIGO DE BARRAS. ERROR CON FILLRECT()

Postby nageswaragunupudi » Wed May 15, 2024 12:57 pm

Barcode requires a minimum width in pixels depending on the length of the text.
Harupdf uses 72 pixels per inch and so the barcode can not fit the size you require.
So let us not use Harupdf. FWH can still produce PDF files without using Harupdf

Please try this:
Code: Select all  Expand view

#include "fivewin.ch"

REQUEST FWZEBRA
REQUEST FWHARU

//----------------------------------------------------------------------------//

function Main()

   local cItem1   := "100003222186321900"
   local cItem2   := "30634973938A00030000322274188595079486"
   local oPrn, oPen, oFont

   TPrinter():lUseHaruPDF := .F.   // Not using HaruPDF

   PRINT oPrn PREVIEW FILE "barcode.pdf"

   DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-14 OF oPrn
   DEFINE PEN oPen WIDTH 1 COLOR CLR_HRED OF oPrn

   PAGE

   @  3, 2 PRINT TO oPrn TEXT cItem1 SIZE 10,1 CM FONT oFont
   oPrn:Lines( { { 4, 2 }, { 4, 6 }, { 4.4, 6 } }, oPen, "CM" )
   @ 4.5, 2 PRINT TO oPrn TEXT cItem1 AS BARCODE TYPE "CODE128" SIZE 4,1 CM

   @ 10, 2 PRINT TO oPrn TEXT cItem2 SIZE 20,1 CM FONT oFont
   oPrn:Lines( { { 11, 2 }, { 11, 10.5 }, { 11.4, 10.5 } }, oPen, "CM" )
   @ 11.5, 2 PRINT TO oPrn TEXT cItem2 AS BARCODE TYPE "CODE128" SIZE 8.5,1 CM

   ENDPAGE

   ENDPRINT

   RELEASE FONT oFont

return nil

Now the barcodes fit within 4.0 cm and 8.5 cm. I checked by printing on paper and measuring it.
Regards

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

Re: CODIGO DE BARRAS. ERROR CON FILLRECT()

Postby pedroluis » Wed May 15, 2024 1:54 pm

Ok Sr. Rao.
Entendido !!!
Muchas gracias y disculpe las molestias.
Pedro L. Lavallen
San Luis (Capital), Argentina
User avatar
pedroluis
 
Posts: 117
Joined: Sun Oct 08, 2017 12:51 pm
Location: San Luis (Capital), Argentina

PreviousNext

Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 28 guests