Printing Support

Previous topic - Next topic

spicypixel

http://www.spicypixel.net | http://www.facebook.com/SpicyPixel.NET

Comps Owned - ZX.81, ZX.48K, ZX.128K+2, Vic20, C64, Atari-ST, A500.600.1200, PC, Apple Mini-Mac.

matchy

Good! HTML to OS browser would be my first quick and easy choice. Problem solved! Tea and scones anyone?

ampos

On my TPV proam done in Blitz3D, I use this system to print (pseudo-code):

Code (glbasic) Select
OPENOUT 1,"ticket.txt"
PRINT #1,texts$
CLOSEFILE 1
EXEC "print.bat"


and the print.bat file has:

Code (glbasic) Select
type ticket.txt >lpt1

Kitty Hello

Nah. Just call InternetExplorer with an HTML file and "/P" in the parameter list.
Or Wordpad (write.exe) on any windows.

ampos

It would be nice to know... 5 years ago :)

I have been using this since I did my first TPV program looooong ago in TurboBasic.

TI-994A

Quote from: Kitty Hello on 2011-Jun-08
There's 2 very easy ways to do it.

1st: Write a temp HTML file with optional PNG images and call a webbrowser to print it (OK, you must make that platform specific, but only 3 platforms, right?)

2nd: Write an RTF file (a bit harder but gives very accurate control of everything. It's a WORD doc in ASCII so to say. Use Wordpad to get started with the format.
Not very preferable workarounds, ruling out WYSIWYG formatting. The API option would seem to be the only solution, but is there an equivalent call for OSX?
Texas Instruments TI-99/4A Home Computer: the first home computer with a 16bit processor, crammed into an 8bit architecture. Great hardware - Poor design - Wonderful BASIC engine. And it could talk too!

Slydog

You could write the equivalent code for OSX using GLB wrappers probably.
Here's some OSX printing info:
http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/Printing/Printing.html

Or, this may be more difficult and not what you want, but you can create PDFs from code using Adobe SDK.
This will give you pixel perfect control of the final document, but wont print it for you.
I don't know how this is done or how hard it would be to do through GLB but nothing is impossible.
http://www.adobe.com/devnet/pdf/library.html
My current project (WIP) :: TwistedMaze <<  [Updated: 2015-11-25]

TI-994A

Quote from: Slydog on 2011-Jun-10
You could write the equivalent code for OSX using GLB wrappers probably.
Here's some OSX printing info:
http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/Printing/Printing.html

Or, this may be more difficult and not what you want, but you can create PDFs from code using Adobe SDK.
This will give you pixel perfect control of the final document, but wont print it for you.
I don't know how this is done or how hard it would be to do through GLB but nothing is impossible.
http://www.adobe.com/devnet/pdf/library.html
Thanks for the info; will give it a try.
Texas Instruments TI-99/4A Home Computer: the first home computer with a 16bit processor, crammed into an 8bit architecture. Great hardware - Poor design - Wonderful BASIC engine. And it could talk too!

Moru

But what do you want to print with bitmap fonts? :-)

TI-994A

Quote from: Moru on 2011-Jun-10
But what do you want to print with bitmap fonts? :-)
My font of preference would be TrueType, not bitmap. In VB, these fonts can be placed in a LOGFONT structure and drawn with precise positioning and scalability using the CREATEFONT and DRAWTEXT functions. Even images can be positioned and scaled with similar precision using functions like CREATEBMP and BITBLT / STRETCHBLT.

When printing functions are relegated to HTML or RTF output, format control is lost.
Texas Instruments TI-99/4A Home Computer: the first home computer with a 16bit processor, crammed into an 8bit architecture. Great hardware - Poor design - Wonderful BASIC engine. And it could talk too!

Moru

But GLBasic only has bitmap fonts what I know of.

Moebius

Save as png, print that.  Full control using GLB's commands.   :enc:

GLB is designed really for games, and VB is intended for applications.  Unfortunately, you can't expect to find all the features of one programming language in another.  That said, compare how complex it is to have 3D - or even 2D - graphics in VB as opposed to GLB...
Endless Loop: n., see Loop, Endless.
Loop, Endless: n., see Endless Loop.
- Random Shack Data Processing Dictionary

TI-994A

Quote from: Serpent on 2011-Jun-11
Save as png, print that.  Full control using GLB's commands.   :enc:

GLB is designed really for games, and VB is intended for applications.  Unfortunately, you can't expect to find all the features of one programming language in another.  That said, compare how complex it is to have 3D - or even 2D - graphics in VB as opposed to GLB...
Can GLB print PNG files?

The functions indicated in the previous post (CREATEFONT / DRAWTEXT / BITBLT / etc) are not native VB commands, but rather a subset of the Win32 API. GLBasic can also call and use these functions; the only difference is, with VB these routines can be done in BASIC, while in GLBasic they have to be coded through inline C/C++.

And it's true that VB isn't well suited for extensive graphics programming, which is yet another reason why VB isn't a tool of choice. However, to say that such a powerful cross-compiler like GLBasic should be considered specifically for game development, is selling it short. PureBasic also handles 2D/3D graphics with similar ease, and it is pretty much an all-round development tool. But with the mobile platform support (WinCE / iPhone / etc), GLBasic has a clear advantage.

Considering all these points, expecting native printing support within GLBasic shouldn't be too much to ask.
Texas Instruments TI-99/4A Home Computer: the first home computer with a 16bit processor, crammed into an 8bit architecture. Great hardware - Poor design - Wonderful BASIC engine. And it could talk too!

Kitty Hello

RTF is a file format pretty close to wysiwyg. Also, I found out that PDF files are pretty simple text files as well. Pasting a PNG file within a pdf might not be too complicated. That would be worth a try.

TI-994A

Quote from: Kitty Hello on 2011-Jun-20
RTF is a file format pretty close to wysiwyg. Also, I found out that PDF files are pretty simple text files as well. Pasting a PNG file within a pdf might not be too complicated. That would be worth a try.
Thank you, and you're right; the RTF format does produce close to WYSIWYG output, so this is worth looking into. However, the actual printing is still delegated to an external application, assumedly through their command line switches.

Once again, thank you, and to all who have enthusiastically given their suggestions.
Texas Instruments TI-99/4A Home Computer: the first home computer with a 16bit processor, crammed into an 8bit architecture. Great hardware - Poor design - Wonderful BASIC engine. And it could talk too!