Printer paper size in Powerbuilder

I am trying to print some W2 forms. The form in the printer is for 2 W2s per page. The first one prints properly. The second is always off despite all the manipulations to the datawindow. So I want to set the paper page size to 8 1/2 by 5 1/2. Is it possible to change the paper size? I tried this but I was getting an error:
dw_1.Object.DataWindow.Print.Size = 256
dw_1.Object.DataWindow.Print.CustomPage.Length = 139.7
dw_1.Object.DataWindow.Print.CustomePage.Width = 215.9
I got an error on the second line: incompatible data type.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.


you can assign only Long value to Length and width property. Cannot assign decimal. See PB help for more detail.

This should work

dw_1.Object.DataWindow.Print.paper.Size = 256
dw_1.Object.DataWindow.Print.CustomPage.Length = 139
dw_1.Object.DataWindow.Print.CustomPage.Width = 215


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial

I think you can also use the paper.size = 6 without any length and width modification. You may need to select either portrait or landscape based on your format and paper.

see PB help

dw_1.Object.DataWindow.Print.paper.Size = 6
dw_1.Object.DataWindow.Print.orientation = 1 or 2
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Editors IDEs

From novice to tech pro — start learning today.