Create HTML Page

BlitzMax Forums/BlitzMax Beginners Area/Create HTML Page

Qweeg(Posted 2006) [#1]
Could someone explain how I construct an html page from a blitmax application? I have read in the forums that the best way to print (using the GUI module) is to construct an html page and then create an htmlview and call the gadgetprint() function. But I am not sure how to take an image, which is on part of my GUI canvas and construct an html page for it to print.

Any help would be really appreciated.
Tim


Qweeg(Posted 2006) [#2]
Okay, I kinda thought maybe I need to use banks to do this. Not too sure about how these work, so put together this snippet of code in my app as a stab in the dark. It does create an html file in the right place, but puts a load of garbage in it.

Also if I try this with a blank html file then the htmlview is displayed, but no print dialog box (which sounds like the problem that Gellyware had on another post).

Obviously I am misunderstanding how this stuff works (nothing new there). Could anyone throw some light on this for me please?

Case MENU_PRINT

	Local bnkScreenPrint:TBank = CreateBank(intImageWidth * intImageHeight * 4)
	Local pxmScreenPrint:TPixmap = LockImage(imgPrintable)
	Local intPixel:Int
	Local intCounter:Int		
	For Local y:Int = 0 To intImageHeight - 1
		For Local x:Int = 0 To intImageWidth - 1
			intPixel = ReadPixel(pxmScreenPrint,x,y)
			PokeInt(bnkScreenPrint,IntCounter * 4,intPixel)
			intCounter:+1
		Next
	Next
	UnlockImage(imgPrintable)
	SaveBank(bnkScreenPrint,"Images\Screen.html" )
	Local gdthtmlview:TGadget = CreateHTMLView(0,0,ClientWidth(gdtwindow),ClientHeight(gdtwindow),gdtwindow,HTMLVIEW_NONAVIGATE)
	HtmlViewGo gdthtmlview,AppDir+"/images/Screen.html"
	GadgetPrint(gdthtmlview)



degac(Posted 2006) [#3]
mmm...maybe I have misunderstand something.
Do you want to create a HTML page?
If Yes use the HTML syntax and then load the page with the GUI commands as you used.
The Image cannot be seen as it missed all the info for the html-engine to understand that it is an image...
try to use the pixmap method to save as a .png file (and as stated above - create a html-page to read it)
byez


Qweeg(Posted 2006) [#4]
Thanks degac - I think it was me not understanding :) I was thinking I needed an actual .html file - but I think that is rubbish, I just need a png file that I use for my htmlview.

So - okay I can use SavePixmapPng and save my screen image as a png file. Then I can call it using the CreatehtmlView and HtmlViewGo functions. The Image Appears on the screen as expected...

...but the call to GadgetPrint doesn't seem to do anything at all - I was expecting a print dialog box to pop up. Is there something else I am missing?


Qweeg(Posted 2006) [#5]
Okay got it working now. I needed to check for the EVENT_GADGETDONE and call the gadgetprint funtion from there. Strangely I did get 2 print dialogs popup - which is the same thing logged on the thread from Gellyware about this - but I just used a boolean to check and stop the second dialog from appearing.

Thanks for your help degac.