1. Sivaprakash BKR
  2. PowerBuilder
  3. Saturday, 6 January 2018 07:40 AM UTC

Hello,

I face alignment issue in all reports, where we design a report for a particular printer and printed in another printer.  The output is not as designed and we need to redesign it for that particular printer again.   This is more when we need to print in a pre-printed form and the user could choose to print in different printers.   We used to set all possible settings in dw itself and just a single line of code dw_1.print().  

Difference could be either margin (top & left), sometimes every column in grid / tabular dw need adjustment.  It becomes tedious when we need to redesign the same report for every printer (same client) or for every other client.   Even the same printer (model) attached to 2 different computers requires redesign. 

Looks like I'm missing some available configuration, but couldn't figure it out.   We used to set    Paper orientation, Paper size, Paper source, Margins in the Printer specification tab itself.  And just dw_1.print() command to print the dw.

What else I should set to get the exact output in every printer ?  Any direction to find the solution ?

This issue is with PB 10.5, Pb 11.5.  Not yet tested in PB 2017 for this particular issue.  

Happiness Always
BKR Sivaprakash

Outputs' image taken in two different printer is there with me.  Don't know how to attach those image files here.

 

Sivaprakash BKR Accepted Answer Pending Moderation
  1. Thursday, 11 January 2018 06:45 AM UTC
  2. PowerBuilder
  3. # 1

Thanks Brad Mettee.

// We've done prints to pre-printed forms in the past, and never had alignment issues (on a variety of printers).

That's really cool...


//  Powerbuilder itself does NOT send PCL codes (or any other codes) directly to the printer. PB uses the Windows Printer Device Context to render a page based on the printers abilities, then submits it to the print queue. Windows then converts that block of data into printer control codes (PCL, Postscript, whatever) based on the printer definition.

Yes that's what I guessed......

 

//  What units do you have the datawindows designed in?

PB units.

 

//Are there any formulas on the x,y positions of objects? (these formulas must match the units of the design mode, or you'll end up with things moving to incorrect places).

No calculation, no run time changes of any co-ordinates. It prints perfectly for the designed printer / system.

 

//  Are the objects you're printing mis-placed consistently? (in other words, is everything too far up/down/left/right by the same amount, or does it vary from object to object?)

Both.  In few system / printer combo it varies from object to object.  We need to align every object, particularly tabular dw objects.  

 

//  If you select different printers as default in your app, then preview on screen, does the content move around?

Yes, it move around.


//  Allowing the user to adjust/save defaults per printer for top/left margins should be enough to get everything in the right places (as long as all objects are misplaced consistently). We usually set the right/bottom margins to zero so the print driver minimizes them to their smallest value (when setting to zero, the print driver will still set it to it's internal minimum value).

For one report, I tried setting all margins to zero in my design printer, but at client's place the top margin was there in preview !. [ Same model / brand printer, where no choice to set the margins in printer driver ]

 

We can't avoid pre-printed form printing al-together.  Tried designing and printing at client's place itself where different brands of printers available.   After the first correct printout in one printer, we try to print the same in the next printer, which so far hasn't succeeded.  

Happiness Always
BKR Sivaprakash

 

Comment
There are no comments made yet.
Sivaprakash BKR Accepted Answer Pending Moderation
  1. Wednesday, 10 January 2018 13:56 PM UTC
  2. PowerBuilder
  3. # 2

Thanks David for your detailed reply.   Let me go with plain paper printing or print through pdf.

But I think this is only temporary solution.  Either PB is missing to something [ to send proper PCL codes to printer (driver) ] as we set everything either in dw or through script, like paper size, margins etc.   Why not PB send all those codes to printer through driver ?  May be I'm ignorant on these communication part.  

But when word or excel or pdf could achieve the same, why not powerbuilder ?  

Happiness Always
BKR Sivaprakash

 

Comment
  1. Brad Mettee
  2. Wednesday, 10 January 2018 14:44 PM UTC
We've done prints to pre-printed forms in the past, and never had alignment issues (on a variety of printers).



Powerbuilder itself does NOT send PCL codes (or any other codes) directly to the printer. PB uses the Windows Printer Device Context to render a page based on the printers abilities, then submits it to the print queue. Windows then converts that block of data into printer control codes (PCL, Postscript, whatever) based on the printer definition.



What units do you have the datawindows designed in?



Are there any formulas on the x,y positions of objects? (these formulas must match the units of the design mode, or you'll end up with things moving to incorrect places).



Are the objects you're printing mis-placed consistently? (in other words, is everything too far up/down/left/right by the same amount, or does it vary from object to object?)



If you select different printers as default in your app, then preview on screen, does the content move around?



Allowing the user to adjust/save defaults per printer for top/left margins should be enough to get everything in the right places (as long as all objects are misplaced consistently). We usually set the right/bottom margins to zero so the print driver minimizes them to their smallest value (when setting to zero, the print driver will still set it to it's internal minimum value).

  1. Helpful
There are no comments made yet.
David Peace (Powersoft) Accepted Answer Pending Moderation
  1. Monday, 8 January 2018 17:24 PM UTC
  2. PowerBuilder
  3. # 3

Hi

The issue is that the page settings, margin etc are different on each printer. The correct way to solve this is to send the printer control language (PCL)codes to set the margins etc to a standard size for your document. Alternatively agree the settings that are needed for the report and manually amend them in the printer set-up.

To set printer control codes you need to open a print job and send the PCL codes to the printer before printing the DW to the job. The syntax for print codes may change for the printer and manufacturer so you may need to do some work on setting up and string for each.

Printing preprinted forms has always been a bitch in any language.

I must admit that we do not print on preprinted forms anymore because of these issues. We now would print the whole form including the boxes etc. on plain paper. It's cheaper than writing code to work round the problems.

Hope that helps

Cheers

David

Comment
There are no comments made yet.
Sivaprakash BKR Accepted Answer Pending Moderation
  1. Monday, 8 January 2018 15:17 PM UTC
  2. PowerBuilder
  3. # 4

Thanks Eduardo G and Olan.

I'll try printing to pdf and then to all possible printer.  

That means there is no direct way to print dw(s) rightly to all printers ?   Is that a bug or the way it's designed... 

Happiness Always
BKR Sivaprakash

 

Comment
There are no comments made yet.
Olan Knight Accepted Answer Pending Moderation
  1. Monday, 8 January 2018 14:42 PM UTC
  2. PowerBuilder
  3. # 5

Eduardo G is correct. If you supply the PDF printer with your application then the output will always be the same when you print to PDF.

Olan

Comment
There are no comments made yet.
Eduardo G. Accepted Answer Pending Moderation
  1. Monday, 8 January 2018 12:14 PM UTC
  2. PowerBuilder
  3. # 6

To avoid the problem you mention I advise you to always make the printing to pdf and then print the pdf file, so you will never have problems.
A greeting.

Comment
There are no comments made yet.
Sivaprakash BKR Accepted Answer Pending Moderation
  1. Monday, 8 January 2018 05:19 AM UTC
  2. PowerBuilder
  3. # 7

Thanks Clarence A Chamorro for your nice idea.   

But my problem is that report designed to work perfectly in one printer is not printing the same if taken in other printer from the same system.   So I'm forced to re-design the same report for every possible printers.   That's a big headache.  Looks like I'm missing something somewhere that I couldn't figure it out.

Happiness Always
BKR Sivaprakash

 

Comment
There are no comments made yet.
Clarence A Chamorro Accepted Answer Pending Moderation
  1. Sunday, 7 January 2018 06:13 AM UTC
  2. PowerBuilder
  3. # 8
If you scan the preprinted form as a jpg file and placed it as a picture in the dw. Then place the columns aligned with in the form. If you do this technic you will never have a problem with any printer. You will have to use a inject or laser printer. Dotmetric printers will be very slow. Clarence A Chamorro
Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.