PBDR.COM

About   -   Contact   -   Purchase   -   Search   -   What's New

 
 
Hand Coding Reports
This is an example of code used to print barcodes using the PowerBuilder printer commands. This tip was sent in by Bart O'Toole. It is a good example of how to print your own custom reports without using the datawindow.

Attached are two functions, one to print and one to set the fonts.

//  this function sets up the initial set op fonts
//
// this sets fonts for arial - 8 point
// normal
// this sets fonts for arial - 7 point
// normal
PrintDefineFont(Job,1, "3 of 9 Barcode", &
   -24, 400,Variable!,Decorative!,FALSE,FALSE)

// this 3 of 9 Barcode fonts for arial - 8 point3 of 9 Barcode
// bold
PrintDefineFont(Job,2, "barcod39",       &
   -24, 400,Variable!,Decorative!,FALSE,FALSE)

// this sets fonts for arial - 6 point
//normal
PrintDefineFont(Job,3,"3 of 9 Barcode(True Type)", &
   -24, 400,Default!,Decorative!,FALSE,FALSE)

// this sets fonts for arial - 10 point
// bold
PrintDefineFont(Job,4,"Barcode 3 of 9",&
   -24, 400,Variable!,Decorative!,FALSE,FALSE)

// this sets fonts for arial - 12 point
// normal
PrintDefineFont(Job,5,"Barcode 3 of 9 Normal",  &
   -24, 400,Variable!,Decorative!,FALSE,FALSE)

// this sets fonts for arial - 12 point
// bold
PrintDefineFont(Job, 6,"Barcode 3 of 9 (True Type)", &
   -24, 400,Variable!,Decorative!,FALSE,FALSE)

// this sets fonts for arial - 7 point
// normal
PrintDefineFont(Job,7,"barcod39",       &
   -24, 400,Variable!,Decorative!,FALSE,FALSE)

// this sets fonts for arial - 7 point
// normal
PrintDefineFont(Job,8,"Arial (True Type)", &
   -10, 400,Fixed!,Decorative!,FALSE,FALSE)

return job

//      this function prints a blank form 1099-8
//
//      revised 10-11-96
//
s_job           str_job

string  sTitle
int             i_count
dec             i_x
dec             i_y
//
string  s_start
string  s_end

// at home
//i_x_offset = -187.5
//i_y_offset = -124

// at office
str_job.i_x_offset = -250
str_job.i_y_offset = -250

str_job.job = printopen()

// set the font to Swiss
f_p_form2560(str_job.job)
//f_courier(str_job.job)

printSetFont(str_job.job, 8 )

// Print line 1
sTitle = 'Job,1,3 of 9 Barcode(True Type),&
   -24, 400,Variable!,Decorative!,FALSE,FALSE'
i_x             =       1000
i_y             +=      500
//
PrintText( str_job.job, sTitle, i_x + str_job.i_x_offset, &
   i_y + str_job.i_y_offset, 8)
//
sTitle  =       "*99904601*"
i_x             =       1000
i_y             =       687.5
//
PrintText( str_job.job, sTitle, i_x + str_job.i_x_offset, &
   i_y + str_job.i_y_offset,    1)
//
// Print line 2 
sTitle  =       "Job,2,barcod39(True Type),&
   -24, 400,Variable!,Decorative!,FALSE,FALSE)"
i_x             =       1000
i_y             +=      500
PrintText( str_job.job,         sTitle, i_x + str_job.i_x_offset, &
   i_y + str_job.i_y_offset, 8)

sTitle  =       "*99904602*"
i_x             =       1000
i_y             +=      500
PrintText( str_job.job,         sTitle, i_x + str_job.i_x_offset, &
   i_y + str_job.i_y_offset, 2)

// Print line 3         
sTitle  =       '*99904603*'
i_x             =       1000
i_y             +=      500
PrintText( str_job.job,         sTitle, i_x + str_job.i_x_offset, &
   i_y + str_job.i_y_offset, 3)
// Print line 4         
sTitle  =       '*99904604*'
i_x             =       1000
i_y             +=      500
PrintText( str_job.job,         sTitle, i_x + str_job.i_x_offset, &
   i_y + str_job.i_y_offset, 4)
// Print line 5         
sTitle  =       "Job,5,Barcode 3 of 9 Normal, &
   -24, 400,Variable!,Decorative!,FALSE,FALSE"
i_x             =       1000
i_y             +=      500
PrintText( str_job.job,         sTitle, i_x + str_job.i_x_offset, &
   i_y + str_job.i_y_offset, 5)

sTitle  =       '*99904605*'
i_x             =       1000
i_y             +=      500
PrintText( str_job.job,         sTitle, i_x + str_job.i_x_offset, &
   i_y + str_job.i_y_offset, 5)
// Print line 2         
sTitle  =       '*99904606*'
i_x             =       1000
i_y             +=      500
PrintText( str_job.job,         sTitle, i_x + str_job.i_x_offset, &
   li_y + str_job.i_y_offset, 6)
// Print line 2         
sTitle  =       '*99904607*'
i_x             =       1000
i_y             +=      500
PrintText( str_job.job,         sTitle, i_x + str_job.i_x_offset, &
   li_y + str_job.i_y_offset, 7)

// Print line 2         
sTitle  =       '*99904608*'
i_x             =       1000
i_y             +=      500
PrintText( str_job.job,         sTitle, i_x + str_job.i_x_offset, &
   i_y + str_job.i_y_offset, 8)

printclose(str_job.job)

 

Top of Page

Legal Notice

Ken Howe 2011