LB Booster
« Printer issue »

Welcome Guest. Please Login or Register.
Apr 1st, 2018, 04:02am



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
We apologize Conforums does not have any export functions to migrate data.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

Thank you Conforums members.
Speed up Liberty BASIC programs by up to ten times!
Compile Liberty BASIC programs to compact, standalone executables!
Overcome many of Liberty BASIC's bugs and limitations!
LB Booster Resources
LB Booster documentation
LB Booster Home Page
LB Booster technical Wiki
Just BASIC forum
BBC BASIC Home Page
Liberty BASIC forum (the original)

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: Printer issue  (Read 429 times)
Monkfish
Full Member
ImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 104
xx Printer issue
« Thread started on: Jan 2nd, 2016, 3:00pm »

Sounds like Richard has just retired :'(

Big thanks to the immense amount of work he has put in over the years ;D

So I guess I must throw this open to anyone.

The following code simply reproduces a general problem I am having printing out the contents of graphics windows under certain circumstances in landscape mode.

The program should print out a black cross, but on my computer/printer it just spits out a blank sheet. On my neighbour's computer/printer it prints the cross but also prints a vertical black bar down the page.

I don't have a clue why this should be.

Here's the code:

Code:
    nomainwin
    WindowWidth=769
    WindowHeight=994
    graphicbox #main.gfx,0,40,763,922
    open "Test" for window_nf as #main
    print #main.gfx, "setfocus"
    print #main.gfx, "vertscrollbar on 0 576"
    print #main.gfx, "color black"
    print #main.gfx, "backcolor white"
    print #main.gfx, "size 5"
    print #main.gfx, "down"
    print #main.gfx, "line 0 0 742 1496"
    print #main.gfx, "line 742 0 0 1496"
    print #main.gfx, "flush"

    printerdialog
    print #main.gfx, "print 2088"
    close #main
    end
 
User IP Logged

tsh73
Full Member
ImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 210
xx Re: Printer issue
« Reply #1 on: Jan 2nd, 2016, 3:58pm »

Try to put white box whole page size before printing anything else.
User IP Logged

Monkfish
Full Member
ImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 104
xx Re: Printer issue
« Reply #2 on: Jan 4th, 2016, 10:52am »

You mean like this?

Code:
    nomainwin
    WindowWidth=769
    WindowHeight=994
    graphicbox #main.gfx,0,40,763,922
    open "Test" for window_nf as #main
    print #main.gfx, "setfocus"
    print #main.gfx, "vertscrollbar on 0 576"
    print #main.gfx, "color white"
    print #main.gfx, "backcolor white"
    print #main.gfx, "down"
    print #main.gfx, "place 0 0"
    print #main.gfx, "boxfilled 742 1496" 
    print #main.gfx, "color black"       
    print #main.gfx, "size 5"
    print #main.gfx, "line 0 0 742 1496"
    print #main.gfx, "line 742 0 0 1496"
    print #main.gfx, "flush"

    printerdialog
    print #main.gfx, "print 2088"
    close #main
    end 


Had no effect :(

User IP Logged

Rod
Full Member
ImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 110
xx Re: Printer issue
« Reply #3 on: Jan 4th, 2016, 12:45pm »

If you are trying to print a landscape cross then your x should be longer than your y. You are drawing a tall narrow cross. In landscape printing you should draw it 1496,742 and print it with size 1496. Then it will fill the landscape page.

The printer paper needs set to landscape as well.
« Last Edit: Jan 4th, 2016, 12:47pm by Rod » User IP Logged

Monkfish
Full Member
ImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 104
xx Re: Printer issue
« Reply #4 on: Jan 4th, 2016, 2:01pm »

Well this is just an example. It comes from my program for generating and printing rotas. The rotas can be of any dimension... long and squat, tall and thin. My program needs to print them as large as will fit onto the paper in either landscape or portrait but without changing the rota's aspect ratio.

The program works very well in most cases, but seems to have a problem occasionally. Below is the actual code from the program:

Code:
   printerdialog
    if PrinterName$="" then return
    !hDCprt = @prthdc%
    calldll #gdi32, "GetDeviceCaps", hDCprt as ulong, _HORZRES as long, width as long
    calldll #gdi32, "GetDeviceCaps", hDCprt as ulong, _VERTRES as long, height as long
    if pixhgt/pixwth<=height/width then
        pr=pixwth
    else
        pr=pixhgt*width/height
    end if
    print #main.gfx, "print ";pr
    return
 


Where pixwth/pixhgt are the width and height of the graphics box and width/height is the paper size/orientation.

I suppose I could try to make the canvas the same aspect ratio as the paper, but as I don't know ahead of time whether the user will print in landscape or portrait that might be tricky. But worth a test.
User IP Logged

Monkfish
Full Member
ImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 104
xx Re: Printer issue
« Reply #5 on: Jan 4th, 2016, 3:15pm »

Okay, tried changing the box size to:

"boxfilled 2088 1496"

which makes the graphics area the same aspect ratio as my paper in landscape, but no dice. My printer is still spitting out the paper without printing anything. Haven't had a chance to test it on my neighbour's PC yet to see if the black bar disappears (their system does actually print it out, but usually with a black bar).
User IP Logged

Rod
Full Member
ImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 110
xx Re: Printer issue
« Reply #6 on: Jan 4th, 2016, 5:31pm »

print out the variables to debug :

pixwth,pixhgt,width,height
User IP Logged

Monkfish
Full Member
ImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 104
xx Re: Printer issue
« Reply #7 on: Jan 4th, 2016, 6:46pm »

Pixwth=742
Pixhgt=1496
Width=3349
Height=2399
User IP Logged

Rod
Full Member
ImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 110
xx Re: Printer issue
« Reply #8 on: Jan 5th, 2016, 10:34am »

Your original code printed just fine on my printer and no black bar. So I would start to check if your print drivers are up to date.
User IP Logged

Monkfish
Full Member
ImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 104
xx Re: Printer issue
« Reply #9 on: Jan 5th, 2016, 7:12pm »

Rod, did you print in landscape mode?
User IP Logged

Rod
Full Member
ImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 110
xx Re: Printer issue
« Reply #10 on: Jan 6th, 2016, 08:18am »

Ok, sorry I had enlarged the graphicbox and not realized the significance.

My printer returns 4125 x 2892 for width and height using those sizes for the graphicbox eliminates the black bar.

Try your own parameters

Code:
nomainwin
    WindowWidth=769
    WindowHeight=994
    graphicbox #main.gfx,0,40,2892,4125
    open "Test" for window_nf as #main
    print #main.gfx, "setfocus"
    print #main.gfx, "vertscrollbar on 0 576"
    print #main.gfx, "color white"
    print #main.gfx, "backcolor white"
    print #main.gfx, "down"
    print #main.gfx, "place 0 0"
    print #main.gfx, "boxfilled 2892 4125" 
    print #main.gfx, "color black"       
    print #main.gfx, "size 5"
    print #main.gfx, "line 0 0 742 1496"
    print #main.gfx, "line 742 0 0 1496"
    print #main.gfx, "flush"

    printerdialog
    print #main.gfx, "print 2892"
    close #main
    end  


More to investigate I think but out of time right now.
User IP Logged

Monkfish
Full Member
ImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 104
xx Re: Printer issue
« Reply #11 on: Jan 6th, 2016, 2:40pm »

Hi Rod, thanks for giving it a try. This works for me also and if I set the print resolution to 2088 I get the printout I expected. This gives me something to work with. Maybe I can now find the exact setting and reason that is causing the problem. smiley
User IP Logged

Monkfish
Full Member
ImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 104
xx Re: Printer issue
« Reply #12 on: Jan 12th, 2016, 1:58pm »

The following code prints out...

Code:
    nomainwin
    WindowWidth=769
    WindowHeight=994
    graphicbox #main.gfx,0,40,1571,2088
    open "Test" for window_nf as #main
    print #main.gfx, "setfocus"
    print #main.gfx, "color black"
    print #main.gfx, "backcolor white"
    print #main.gfx, "size 5"
    print #main.gfx, "down"
    print #main.gfx, "line 0 0 742 1496"
    print #main.gfx, "line 742 0 0 1496"
    print #main.gfx, "flush"
    printerdialog
    print #main.gfx, "print 2088"
    close #main 


...but reducing the graphics box width by one pixel causes my printer to just eject the page...

Code:
    WindowWidth=769
    WindowHeight=994
    graphicbox #main.gfx,0,40,1570,2088
    open "Test" for window_nf as #main
    print #main.gfx, "setfocus"
    print #main.gfx, "color black"
    print #main.gfx, "backcolor white"
    print #main.gfx, "size 5"
    print #main.gfx, "down"
    print #main.gfx, "line 0 0 742 1496"
    print #main.gfx, "line 742 0 0 1496"
    print #main.gfx, "flush"
    printerdialog
    print #main.gfx, "print 2088"
    close #main
    end 


My neighbour's system prints out under both conditions so it is definitely my printer drivers, which are up-to-date, but still obviously flaky. We are talking WinXP and 12 year-old drivers.

Strange though.
User IP Logged

Rod
Full Member
ImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 110
xx Re: Printer issue
« Reply #13 on: Jan 12th, 2016, 5:33pm »

Ok so it needs more investigation. But I am a bit confused as to why you choose the parameters that you do.

The X parameter is the driver, the width. The size parameter determines how many pixels are spread across the width of the printed page whether it is portrait or landscape. Portrait will obviously be taller landscape wider
So why do you say print 2088 when your drawing is 742 wide?

Using the 1.4142 ratio for A4 paper on 742 pixel width would give you 1049 pixels down the page on A4 portrait, not 1496.

Try drawing within the expected dimensions.
« Last Edit: Jan 12th, 2016, 6:30pm by Rod » User IP Logged

Monkfish
Full Member
ImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 104
xx Re: Printer issue
« Reply #14 on: Jan 12th, 2016, 6:50pm »

Hi Rob, these dimensions were just an example of dimensions that were causing the problem. In my actual application the size of my graphics box is set to the size of the graphics loaded at the time. This can have any aspect ratio. I can't make the graphics box the same size as A4 because the user could print in portraite or landscape. Also, if the graphics is too large to fit on the screen then the app window is scaled to fit the maximum desktop work area and scrollbars are added as required to scroll the graphics box. If the graphics box is made larger than the graphics themselves (to fit to an A4 format) I was having trouble with the scrollbars being pushed outside the visible app window.
User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls