Page 1 of 1

Postal bar code

Posted: Mon Oct 17, 2022 11:43 pm
by TimStone
In the U.S., we need to print a barcode for the full zipcode below the address.

This requires a specific font. I can print a barcode but it is not at all like what I need to use.

I looked at the sample programs, but I use the printer class directly ( not the command lines ), and I have "sort of" translated it to work, but again the output is not correct.

Has anyone used the oPrn:PrintBarCode( ) Method for doing this with mailing labels ?

Re: Postal bar code

Posted: Tue Oct 18, 2022 7:26 am
by Marc Venken
Inside samples BarCod01.

Code: Select all | Expand


function PrintBarCodes()

   local oPrn, oFont

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

   PAGE

   @ 1, 1 PRINT TO oPrn TEXT "PDF417" INCHES FONT oFont

   @ 1.25, 1 PRINT TO oPrn TEXT "Address :" + CRLF + cName - CRLF - cCity - CRLF - cCountry ;
      AS BARCODE TYPE "PDF417" SIZE 4, 0.75 INCHES

   @ 3.00, 1 PRINT TO oPrn TEXT cName    INCHES FONT oFont
   @ 3.30, 1 PRINT TO oPrn TEXT cCity    INCHES FONT oFont
   @ 3.60, 1 PRINT TO oPrn TEXT cCountry INCHES FONT oFont
   @ 3.90, 1 PRINT TO oPrn TEXT cItem    INCHES FONT oFont

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

   @ 5.5, 1 PRINT TO oPrn TEXT TRIM( cName ) ;
      AS BARCODE TYPE "CODE128" SIZE 4,1 INCHES

   @ 9, 4 PRINT TO oPrn TEXT cItem AS BARCODE TYPE "EAN13" ;
      SIZE 4,1 INCHES

   ENDPAGE

   ENDPRINT

   RELEASE FONT oFont

return nil

 

Re: Postal bar code

Posted: Tue Oct 18, 2022 7:42 am
by Marc Venken
Sorry Tim,

It's not the method version I see now .....

Re: Postal bar code

Posted: Tue Oct 18, 2022 1:21 pm
by karinha

Re: Postal bar code

Posted: Tue Oct 18, 2022 1:53 pm
by karinha
// C:\FWH..\SAMPLES\FWBARCOD.PRG - By Nages.

Code: Select all | Expand


#Include "FiveWin.ch"

#define PAD_LEFT            0
#define PAD_RIGHT           1
#define PAD_CENTER          2

STATIC oWnd

FUNCTION Main()

   LOCAL oBar

   DEFINE WINDOW oWnd TITLE "Printing Barcode"

   DEFINE BUTTONBAR oBar _3D OF oWnd

   DEFINE BUTTON OF oBar ACTION printbarcode()

   SET MESSAGE OF oWnd TO "Printing Barcode" NOINSET CLOCK DATE KEYBOARD

   ACTIVATE WINDOW oWnd

   RETURN NIL

FUNCTION PrintBarcode()

   LOCAL oPrn, oBarcode, oFont
   LOCAL cText := "FiveTechSoft"

   cText := "15140803532877000111550020000018651000018657"

   PRINT oPrn PREVIEW

      DEFINE FONT oFont NAME "Arial" SIZE 0, -16 BOLD OF oPrn

      oPrn:SetPage(9)    // A4
      // oPrn:SetPortrait() // Vertical
      oPrn:SetLandScape()

      PAGE

         oPrn:cmSay( 2.0,  10.5, cText, oFont,,CLR_BLACK,,PAD_CENTER  )

         oBarCode := FWER_BarCode():New( oPrn:hDCOut, cText, 700, 100, 3000, 400, 3 )

         WITH OBJECT oBarCode

            :nBCodeType    := 3  // CODE 128
            :nPinWidth     := 10
            :ShowBarCode()

         END

      ENDPAGE

   ENDPRINT

RETURN nil

// FIN / END
 


Regards, saludos.

Re: Postal bar code

Posted: Wed Oct 19, 2022 6:38 pm
by TimStone
Thanks for responding, but the output is not correct.

U.S. mail barcodes are very specific. They use a special font, and are much thinnner than the output we are achieving with the FW barcode functions/methods.

My label printer software automatically adds them. Microsoft Word also adds them in their mailing program. I've been researching the topic, and know, for example, they are doable in C++, but have not yet attained a solution.

Essentially, the codes are equal in height to a standard print line in a letter.

Re: Postal bar code

Posted: Wed Oct 19, 2022 6:57 pm
by karinha
Dear Tim, Ask at the North American Post Office, if the Code is Two-Dimensional Datamatrix 2D??

Estimado Tim, Pregunte en la oficina de correos de América del Norte si el código es bidimensional Datamatrix 2D?

Thanks

Regards, saludos.

Re: Postal bar code

Posted: Mon Jan 02, 2023 5:33 pm
by James Bott
Tim,

Check out the "USPS Barcode FAQ & Tutorial" here:
barcodefaq.com/usps-postal/

I have never used postal barcodes, so I can't offer any help with this.

I hope you have already solved your problem.

Re: Postal bar code

Posted: Tue Jan 03, 2023 7:25 pm
by TimStone
James,

I checked it out, but was not able to print out the proper sized code. It was not critical, so I just moved on.