Postal bar code

Postal bar code

Postby TimStone » Mon Oct 17, 2022 11:43 pm

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 ?
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2944
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: Postal bar code

Postby Marc Venken » Tue Oct 18, 2022 7:26 am

Inside samples BarCod01.

Code: Select all  Expand view  RUN

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

 
Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1439
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: Postal bar code

Postby Marc Venken » Tue Oct 18, 2022 7:42 am

Sorry Tim,

It's not the method version I see now .....
Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1439
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: Postal bar code

Postby karinha » Tue Oct 18, 2022 1:21 pm

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

Re: Postal bar code

Postby karinha » Tue Oct 18, 2022 1:53 pm

// C:\FWH..\SAMPLES\FWBARCOD.PRG - By Nages.

Code: Select all  Expand view  RUN

#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.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7831
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Postal bar code

Postby TimStone » Wed Oct 19, 2022 6:38 pm

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.
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2944
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: Postal bar code

Postby karinha » Wed Oct 19, 2022 6:57 pm

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.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7831
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Postal bar code

Postby James Bott » Mon Jan 02, 2023 5:33 pm

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.
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: Postal bar code

Postby TimStone » Tue Jan 03, 2023 7:25 pm

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.
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2944
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 61 guests