1. William Hong
  2. PowerBuilder
  3. Wednesday, 15 May 2024 03:49 AM UTC

The following code cannot move a computed field to the BR corner precisely.

long NewDetailHeight, PrintWidth &
	, CustomPageLength = 297 /*millimeters*/ &
	, CustomPageWidth = 210 /*millimeters*/ &

NewDetailHeight= CustomPageWidth*100 -long(dw_1.Object.DataWindow.Print.Margin.Top) - long(dw_1.Object.DataWindow.Print.Margin.Bottom)
PrintWidth = CustomPageLength*100 - long(dw_1.Object.DataWindow.Print.Margin.Left) - long(dw_1.Object.DataWindow.Print.Margin.Right)

// Change the following adjustment offset to 1 will achieve the correct effect in the preview, but printer RICOH Afficio MP C3002 still complains about incorrect paper size settings
long adjustOffset = 0 // 1

string ms
ms = 	" DataWindow.Print.Preview=yes DataWindow.Print.Orientation=1 " &
	+ " DataWindow.Print.Paper.Size=256 DataWindow.Print.CustomPage.Length=" + string(CustomPageLength) + " DataWindow.Print.CustomPage.Width=" &
	+ string(CustomPageWidth) + " DataWindow.Detail.Height=" + string(NewDetailHeight - adjustOffset)

ms += "compute_2.X=" + string(PrintWidth - long(dw_1.Object.compute_2.width) - adjustOffset * 100)
ms += "compute_2.Y=" + string(NewDetailHeight -  long(dw_1.Object.compute_2.height) - adjustOffset * 100)

dw_1.modify(ms)

cb_insert.post event clicked()

It seems there is a surplus blank page following the data page in preview mode. If press the insert button in my APP attached here more times, more surplus blank pages will appear. Beside this, a paper size error is also reported on my printer.

An adjustment offset was introduced in line 9 of my code. If I change it to 1, the right preview effect will be rendered but the printer still complains a wrong paper size error.

I am wondering if the adjustment offset should be introduced.  If so, what value is suitable for all situations for different print orientation modes and different page sizes?

 

Attachments (1)


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