Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / MrTAToad please read, printer dll

Author
Message
SpecTre1
23
Years of Service
User Offline
Joined: 24th Feb 2003
Location: United Kingdom
Posted: 18th May 2003 15:02
I'm trying to use your printer dll file to print out a bitmap for my colouring book program.

I've downloaded the dll but do you put it in the windows/system folder or the project folder for my program?

Also here is the code that IanM supplied for saving a bitmap



How would I incorporate your code to print the bitmap out?

Heres what I'm trying to do:

My screen size is 800x600 on bitmap 0, the part of the screen I need to save and print out is start x,y= 139,10 and width=640 height=430.

Please help.


Also does anyone know of a program to create an install exe like when you get a game, so I can put all my files into it and then the person downloading the program has to run it and my program then installs onto the hard drive with all the correct files in place?

New to DBPro comin from AMOS on the Amiga!
http://homepage.ntlworld.com/paul.harthen/banner.jpg[/img]
MrTAToad
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 18th May 2003 15:21
If your going to use the DLL as a plug-in, you put the file in \compiler\plugins-user - as stated on my web site

You would then call IanM's code, save the bitmap to a file and then use my routine to print the bitmap (passing it the filename and the X & Y coordinates).

There are plenty of free installer programs around...

Good news everyone! I really am THAT good...
http://www.nickk.nildram.co.uk/ for great plug-ins - oh my, yes!
SpecTre1
23
Years of Service
User Offline
Joined: 24th Feb 2003
Location: United Kingdom
Posted: 18th May 2003 15:48
If I put it in as a plug in, would the compiled program when finished save the dll with it, so the preson downloading won't have to mess with the dll?

Not seen any installer programs, u know any links?



New to DBPro comin from AMOS on the Amiga!
MrTAToad
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 18th May 2003 17:58
Yes, the code for plug-ins is intergrated into the main code at compile time, so they arent needed on another machine

Good news everyone! I really am THAT good...
http://www.nickk.nildram.co.uk/ for great plug-ins - oh my, yes!
SpecTre1
23
Years of Service
User Offline
Joined: 24th Feb 2003
Location: United Kingdom
Posted: 18th May 2003 19:23
thanks. found an installer by the way

New to DBPro comin from AMOS on the Amiga!
MrTAToad
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 18th May 2003 20:35 Edited at: 18th May 2003 20:41
Thats good! Let me know if you have any problems with Printing...

Good news everyone! I really am THAT good...
http://www.nickk.nildram.co.uk/ for great plug-ins - oh my, yes!
SpecTre1
23
Years of Service
User Offline
Joined: 24th Feb 2003
Location: United Kingdom
Posted: 24th May 2003 23:22
Having probs with the printer!!!

Doing this test program:



Need to include your print routine to run with this, but can't seem to get your demo program that is with the dll to work!

I have put the dll into the plugins folder but need to put some code in the line where the REM statement is to print!

Could you help please?

as you can see the program saves the area of the screen to a file called "prnt" and I can see this on my hard drive but I can't get to print the bugger out!!!

HELP

Thanks

New to DBPro comin from AMOS on the Amiga!
MrTAToad
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 24th May 2003 23:58 Edited at: 25th May 2003 00:07
Probably because I left my test graphic in my plug-in...

I've update the plug-in...

The code you want to use is :



It should be noted that 32-bit mode doesn't generate a valid bitmap file.

Good news everyone! I really am THAT good...
http://www.nickk.nildram.co.uk/ for great plug-ins - oh my, yes!
SpecTre1
23
Years of Service
User Offline
Joined: 24th Feb 2003
Location: United Kingdom
Posted: 25th May 2003 02:41
I'm running 16bit, so will check it tom. Thanks m8

New to DBPro comin from AMOS on the Amiga!
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 25th May 2003 03:00
I'm not quite sure what you're getting at MrTAToad.

I know that the SaveBitmap function generates correct images for both 16 and 32 bit modes. I discovered by accident that in 16 bit mode, the POINT() function returns a colour value converted to 24 bit colour.

I haven't tested it myself, but the few changes that Spectre has made to the loops should work OK too.
MrTAToad
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 25th May 2003 03:20
Try loading the saved bitmap into paint...
I was using a small 32x32 bitmap, when loaded back into Paint, I get 4 copies across and the rest of the screen is invalid data...

Good news everyone! I really am THAT good...
http://www.nickk.nildram.co.uk/ for great plug-ins - oh my, yes!
MrTAToad
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 25th May 2003 03:22 Edited at: 25th May 2003 03:36


As you can see, this is the complete bitmap file saved - note the 6 copies of the arrow (when only 1 was on screen).

You get this, of course, when printing too (just smaller...)
P4.1 of course, 1024x768 32-bit screen and the program runs in WFSM

Good news everyone! I really am THAT good...
http://www.nickk.nildram.co.uk/ for great plug-ins - oh my, yes!
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 25th May 2003 03:47
Hmmm, paint was what I used to do the testing with.

I've just tested various resolutions and depths, and no problems detected.

Can you post the code you are using ... or email it to me, and I'll investigate.
MrTAToad
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 25th May 2003 05:40
The code I'm using is the following. I'll E-Mail the bitmap later if you like.

load bitmap "interface.bmp",1
copy bitmap 1,0
wait key

SaveBitmap("prnt.bmp",1)
sync
rem need print stuff here!!!
x=LSelectPrinter()
sync
x=LStartNewPage()
x=LPrintBitmap("prnt.bmp",0,0,100.0,100.0)
x=LPrintPage()
x=LFinishPrinting()
print "DONE":sync
wait key
end

function SaveBitmap(File as string, Bmp as integer)
local x as integer
local y as integer
local Colour as dword

local OldBmp as integer
local Width as integer
local Height as integer
local PadSize as integer

OldBmp=current bitmap()
set current bitmap Bmp

Width=640
Height=430

PadSize=4-((Width*3) mod 4)
if PadSize=4 then PadSize=0

if file exist(File) then delete file File
open to write 1, File

write byte 1, asc("B")
write byte 1, asc("M")
write long 1, 26+( ((Width*3)+PadSize) * Height )
write word 1, 0
write word 1, 0
write long 1, 26

write long 1, 12
write word 1, Width
write word 1, Height
write word 1, 1
write word 1, 24

Width=Width-1
Height=Height-1

lock pixels

for y=10+Height to 10 step -1
for x=139 to 139+Width
Colour=point(x,y)
write byte 1, Colour
write byte 1, Colour >> 8
write byte 1, Colour >> 16
next x
if PadSize > 0
for x=1 to PadSize
write byte 1,0
next x
endif
next y

unlock pixels

close file 1
set current bitmap OldBmp
endfunction

Good news everyone! I really am THAT good...
http://www.nickk.nildram.co.uk/ for great plug-ins - oh my, yes!
SpecTre1
23
Years of Service
User Offline
Joined: 24th Feb 2003
Location: United Kingdom
Posted: 25th May 2003 13:00
Not tested yet cos I got to go to work now but I will be running the program in 16bit, with screen size of 800x600.

The start x,y on screen is 139,10 and the width and height are 640,430

Will try tonight when get home

New to DBPro comin from AMOS on the Amiga!
David T
Retired Moderator
23
Years of Service
User Offline
Joined: 27th Aug 2002
Location: England
Posted: 25th May 2003 15:11
http://www.gentee.com/setupgen/

I find setuo generator does the job. If you have visual studio, then you could have a look at MS Visual Studio Installer.

You are the th person to view this signature.
Programmers don't die, they just Gosub without return....
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 25th May 2003 19:19
MrTAToad: If you can please

SpecTre: So many people want to save areas of bitmaps, I'll put another bitmap saver together I think - and mabe for images too.

David89: What?!?!?

Why oh why do people have so many case changes in their names?
MrTAToad
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 25th May 2003 20:06
The bitmaps are on the way...

Good news everyone! I really am THAT good...
http://www.nickk.nildram.co.uk/ for great plug-ins - oh my, yes!
SpecTre1
23
Years of Service
User Offline
Joined: 24th Feb 2003
Location: United Kingdom
Posted: 25th May 2003 22:53
Nice one m8

David89 - What you on about there!?

New to DBPro comin from AMOS on the Amiga!
SpecTre1
23
Years of Service
User Offline
Joined: 24th Feb 2003
Location: United Kingdom
Posted: 25th May 2003 22:55
Oh, mmm , sorry David89 just realised what you were goin on about !! LOL

Allready downloaded "Setup2Go" but thanks for the advice anyway m8.

New to DBPro comin from AMOS on the Amiga!
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 25th May 2003 23:39
Doh! I've just figured it out.

You used SpecTre's changed version of the code!

You are forcing a specific sized bitmap to be saved (640x430), but pointing it at a much smaller bitmap (32x32). It seems that the POINT() function is not clipped to the limits of the bitmap, so is reading off the end of the bitmap.

It works fine if you use the original routine
MrTAToad
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 26th May 2003 01:19
Ah, fair enough - As my printing system works okay, I'ld say there isn't a problem.

Good news everyone! I really am THAT good...
http://www.nickk.nildram.co.uk/ for great plug-ins - oh my, yes!
SpecTre1
23
Years of Service
User Offline
Joined: 24th Feb 2003
Location: United Kingdom
Posted: 26th May 2003 01:58
Can't get the print to work!?



Code above is what I'm using.

What happens:

Picture comes on screen
I press a button and file is saved
Press again and printer window comes up
I press print
Sheet of paper just comes out quick with nothing on it?
as if it is just doing form feed

New to DBPro comin from AMOS on the Amiga!
SpecTre1
23
Years of Service
User Offline
Joined: 24th Feb 2003
Location: United Kingdom
Posted: 26th May 2003 02:03
Bitmap is saved correctly as just viewed it in Paint Shop Pro but can't get it to print ?

New to DBPro comin from AMOS on the Amiga!
SpecTre1
23
Years of Service
User Offline
Joined: 24th Feb 2003
Location: United Kingdom
Posted: 26th May 2003 02:35
By the way I can print text out "[000400,000400]This is a test of manual positioning"

Still not pic though

I have Epson C70, think it is something to do with BMP?

New to DBPro comin from AMOS on the Amiga!
MrTAToad
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 26th May 2003 11:37 Edited at: 26th May 2003 18:03
It comes out with my laser printer... It could be the scaling value is way too small - try 1000.0,1000.0 instead of 100.0

And dont forget to download the updated plug-in.

Good news everyone! I really am THAT good...
http://www.nickk.nildram.co.uk/ for great plug-ins - oh my, yes!
SpecTre1
23
Years of Service
User Offline
Joined: 24th Feb 2003
Location: United Kingdom
Posted: 26th May 2003 23:59
Ooops! I had the old dll not the new one

Found 650,650 filled the full sheet of A4 in landscape mode
Nice one!!!

Does it have a command to do auto landscape mode rather than having to change the preferences every time?

Only when running the program in exclusive mode the printer box is quite often hiding!!

Prints out great though!!

New to DBPro comin from AMOS on the Amiga!
MrTAToad
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 27th May 2003 01:31
Yes, its annoying the box doesn't always appear - the sync usually helps.

An command to set orientation (before the selection window appears) is possible - I'll see what I can do.

Good news everyone! I really am THAT good...
http://www.nickk.nildram.co.uk/ for great plug-ins - oh my, yes!
SpecTre1
23
Years of Service
User Offline
Joined: 24th Feb 2003
Location: United Kingdom
Posted: 27th May 2003 01:42
Nice one m8

It's funny because my program wont work proper in windows mode thats why I have to run it in 800x600 16bit exclusive mode otherwise the fill wont work!! Very odd

Print routine is great! Pics are coming out full A4 size!!!

New to DBPro comin from AMOS on the Amiga!
MrTAToad
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 27th May 2003 12:31
I think its because the Printer window is tied to the DBPro window (you actually get a different printer selection window if its not) - its my way of making it harder to use in a non-DB enviroment, if you know what I mean.

Good news everyone! I really am THAT good...
http://www.nickk.nildram.co.uk/ for great plug-ins - oh my, yes!
SpecTre1
23
Years of Service
User Offline
Joined: 24th Feb 2003
Location: United Kingdom
Posted: 27th May 2003 21:43
Would be nice if you could turn off window so you could just select landscape and it just print without having to mess with printer window, especially for esclusive mode due to above prob

New to DBPro comin from AMOS on the Amiga!
SpecTre1
23
Years of Service
User Offline
Joined: 24th Feb 2003
Location: United Kingdom
Posted: 27th May 2003 22:07
I've been playing with my program for the last couple of hours and I have managed to make it work in any mode!!!!!!

I'm really chuffed!!

So now I can run it in Windows desktop mode 32bit, print routine works great as window is now visible!!

It would be really great to have the portrait or landscape control though so the kid would just have to press print!

Nice one.

MrTAToad goes into my special thanks screen now as well!

New to DBPro comin from AMOS on the Amiga!
MrTAToad
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 27th May 2003 23:17
It'll take a while to get the orientation system up - as its not that easy.

Good news everyone! I really am THAT good...
http://www.nickk.nildram.co.uk/ for great plug-ins - oh my, yes!
SpecTre1
23
Years of Service
User Offline
Joined: 24th Feb 2003
Location: United Kingdom
Posted: 27th May 2003 23:25
LOL don't imagine it would be easy doin dll's!!!

You done a good job with it so far though!

New to DBPro comin from AMOS on the Amiga!
MrTAToad
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 27th May 2003 23:42
Thanks...

Good news everyone! I really am THAT good...
http://www.nickk.nildram.co.uk/ for great plug-ins - oh my, yes!
MrTAToad
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 29th May 2003 01:14
The modified printer plug-in is now availiable - you can select portrait or landscape orientation, but only before the printer dialog window is displayed.

Dont forget the user can override the setting.

Good news everyone! I really am THAT good...
http://www.nickk.nildram.co.uk/ for great plug-ins - oh my, yes!
SpecTre1
23
Years of Service
User Offline
Joined: 24th Feb 2003
Location: United Kingdom
Posted: 31st May 2003 01:53
Nice one m8 your a star!

What are the commands and where would I put it in this?

SaveBitmap("prnt.bmp",1)
sync
rem need print stuff here!!!
x=LSelectPrinter()
sync
x=LStartNewPage()
x=LPrintBitmap("prnt.bmp",0,0,100.0,100.0)
x=LPrintPage()
x=LFinishPrinting()
print "DONE":sync
wait key
end

Thanks again m8

New to DBPro comin from AMOS on the Amiga!
MrTAToad
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 31st May 2003 03:37 Edited at: 31st May 2003 03:39
The command to change the orientation is LSetOrientation. This command must go before the printer selection command.

Why not download by keywords file, and the constant files too.

Good news everyone! I really am THAT good...
http://www.nickk.nildram.co.uk/ for great plug-ins - oh my, yes!
SpecTre1
23
Years of Service
User Offline
Joined: 24th Feb 2003
Location: United Kingdom
Posted: 11th Jun 2003 03:22
hmmmm can't find them!?

New to DBPro comin from AMOS on the Amiga!
MrTAToad
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 11th Jun 2003 11:08
Its in the plug-ins section.

Good news everyone! I really am THAT good...
http://www.nickk.nildram.co.uk/ for great plug-ins - oh my, yes!
MrTAToad
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 11th Jun 2003 23:09
Did you find the example, dll download etc ?

Good news everyone! I really am THAT good...
http://www.nickk.nildram.co.uk/ for great plug-ins - oh my, yes!
SpecTre1
23
Years of Service
User Offline
Joined: 24th Feb 2003
Location: United Kingdom
Posted: 12th Jun 2003 23:34
? Found an example program but couldn't find a list of commands??

Where are they?

New to DBPro comin from AMOS on the Amiga!
MrTAToad
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 13th Jun 2003 00:43 Edited at: 13th Jun 2003 13:34
Both in the example program and the keywords200.ini file. The INI file is in the hyperlink at the top of the plug-ins page. All the printer commands are in the demo program.

Good news everyone! I really am THAT good...
http://www.nickk.nildram.co.uk/ for great plug-ins - oh my, yes!
MrTAToad
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 22nd Jun 2003 13:04
Have you looked in the plug-ins section ?
The keywords file is downloaded from the 'The IDE help text is available here. Just save into EDITOR\KEYWORDS' line.
Printers is downloaded from the relevant plug-in name column. The rest are downloaed to the right of that. Couldn't be simpler.

Good news everyone! I really am THAT good...
http://www.nickk.nildram.co.uk/ for great plug-ins - oh my, yes!
SpecTre1
23
Years of Service
User Offline
Joined: 24th Feb 2003
Location: United Kingdom
Posted: 22nd Jun 2003 17:06
Found it but don't seem to work here's the code



Have I done it right?

New to DBPro comin from AMOS on the Amiga!
MrTAToad
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 22nd Jun 2003 17:22
What isn't happening ?

Good news everyone! I really am THAT good...
http://www.nickk.nildram.co.uk/ for great plug-ins - oh my, yes!
SpecTre1
23
Years of Service
User Offline
Joined: 24th Feb 2003
Location: United Kingdom
Posted: 22nd Jun 2003 18:09
ooops

The thing is printing it's the orientation that's not.

New to DBPro comin from AMOS on the Amiga!
MrTAToad
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 22nd Jun 2003 19:49
Works here okay, both text and graphics. Do you have the constants file ?

Good news everyone! I really am THAT good...
http://www.nickk.nildram.co.uk/ for great plug-ins - oh my, yes!
SpecTre1
23
Years of Service
User Offline
Joined: 24th Feb 2003
Location: United Kingdom
Posted: 22nd Jun 2003 22:30


What do I do with that?

New to DBPro comin from AMOS on the Amiga!
MrTAToad
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 22nd Jun 2003 22:33
Well, generall you have to download it, and then either insert the contents into the main file or add it to source files list.

Good news everyone! I really am THAT good...
http://www.nickk.nildram.co.uk/ for great plug-ins - oh my, yes!

Login to post a reply

Server time is: 2026-07-17 21:15:31
Your offset time is: 2026-07-17 21:15:31