Post by Mark Dunham on Jun 22, 2022 13:07:08 GMT -5
Okay. So I don't know who needs this idea or if it has already been shared but when it comes to saving/printing I have always had some challenges with some of the designs I use for Character sheets. But I worked on a project for about 8 months for a friend in Greece and I created a character generator for his game system he designed and that led me to save the character as a data file and then save it in HTML format that allows the user to use print from the browser. Here is the link to the a simplified print project I created to get anyone started that wants to use it as a starting point LB Save as HTML
The save folder has the following files in it for the layout in the browser.
- Parchment_LARGE.jpg (Background Image for the Browser)
- Print.css (CSS Sheet for Printing)
- Save_Style.css (CSS for Saving)
If anyone has any ideas to add to this project or expand upon it I would love any feedback or suggestions.
'LB Save as HTML
'Date: 6.22.2022
'Coded By: Mark A. Dunham
nomainwin
BackgroundColor$ = "darkgray"
ForegroundColor$ = "black"
print DefaultDir$
'VARIABLES
header$ = "LB HTML"
column1$ = "Column 1"
column2$ = "Column 2"
column3$ = "Column 3"
row1$ = "Row 1"
row2$ = "Row 2"
row3$ = "Row 3"
fullName$ = "Peter Pan"
age$ = "27"
size$ = "Average"
height$ = "6'-1" + chr$(34)
weight$ = "260 lbs."
hairColor$ = "Brown"
language$ = "English"
[Main.Menu]
WindowWidth = 640
WindowHeight = 360
UpperLeftX = int((DisplayWidth - WindowWidth)/2)
UpperLeftY = int((DisplayHeight - WindowHeight)/2)
Stylebits #Main, _WS_CAPTION, 0, 0, 0
button #Main.btnSaveHTML, "Save HTML",[SaveHTML],UL,20,250,120,50
graphicbox #Main.gbx1, -1,-1, 640, 360
open "LB Save HTML" for graphics_nsb_nf as #Main
#Main, "trapclose [Main.Quit]"
#Main, "font Viner_Hand_ITC 0 0 bold"
#Main.gbx1, "font Algerian 40 bold"
#Main.gbx1, "down; color 0 0 0"
#Main.gbx1, "Place 15 50"
#Main.gbx1, "\LB Save HTML"
#Main.gbx1, "font Algerian 14 bold"
#Main.gbx1, "Place 15 100"
#Main.gbx1, "\Name: "; fullName$
#Main.gbx1, "Place 15 120"
#Main.gbx1, "\Age: "; age$
#Main.gbx1, "Place 15 140"
#Main.gbx1, "\Size: "; size$
#Main.gbx1, "Place 15 160"
#Main.gbx1, "\Height: "; height$
#Main.gbx1, "Place 15 180"
#Main.gbx1, "\Weight: "; weight$
#Main.gbx1, "Place 15 200"
#Main.gbx1, "\Hair Color: "; hairColor$
#Main.gbx1, "Place 15 220"
#Main.gbx1, "\Language: "; language$
wait
[Main.Quit]
close #Main
wait
end
[SaveHTML]
DefaultDir$ = DefaultDir$ + "\Saves\"
filedialog "Save Character Sheet", "*.html", fileName$
'IF THE FILE EXTENSION IS MISSING ADD IT TO THE FILENAME
if right$(fileName$,5) <> ".html" then
fileName$ = fileName$ + ".html"
end if
open fileName$ for output as #Save
#Save, "<!DOCTYPE html>"
#Save, "<html lang="; chr$(34);"en-US";chr$(34); ">"
#Save, chr$(9);"<head>"
#Save, chr$(9);chr$(9); "<meta charset="; chr$(34);"utf-8"; chr$(34); ">"
#Save, chr$(9);chr$(9); "<link type="; chr$(34); "text/css"; chr$(34); "rel="; chr$(34); "stylesheet"; chr$(34); chr$(34); "media="; chr$(34); "all"; chr$(34); "href="; chr$(34); "Save_Style.css"; chr$(34); "/>"
#Save, chr$(9);chr$(9); "<title>LB Save as HTML</title>"
#Save, chr$(9); "</head>"
#Save, ""
#Save, "<body style="; chr$(34); "background-image: url('Parchment_LARGE.jpg')"; chr$(59);chr$(34); ">"
#Save, "<div class="; chr$(34); "main"; chr$(34); ">"
#Save, "<h1 align="; chr$(34);"center"; chr$(34); ">LB Save as HTML</h1>"
#Save, "<table style="; chr$(34); "width:100%"; chr$(34); "id="; chr$(34); "t01"; chr$(34); ">"
#Save, "<tr>"
#Save, "<td colspan="; chr$(34); "3"; chr$(34); "id="; chr$(34); "t02"; chr$(34);"><b>Column Span</b></td>"
#Save, "</tr>"
#Save, "<tr>"
#Save, "<td id="; chr$(34); "t02"; chr$(34);"><u><b>"; column1$; "</b></u></td>"
#Save, "<td id="; chr$(34); "t02"; chr$(34); "><u><b>"; column2$; "</b></u></td>"
#Save, "<td colspan="; chr$(34); "1"; chr$(34); "id="; chr$(34); "t02"; chr$(34); "><u><b>"; column3$; "</b></u></td>"
#Save, "</tr>"
#Save, "<tr>"
#Save, "<td><u><b>Name:</b></b></u> "; fullName$; "</td>"
#Save, "<td><u><b>Age:</b></u> "; age$; "</td>"
#Save, "<td><u><b>Size:</b></u> "; size$; "</td>"
#Save, "</tr>"
#Save, "<tr>"
#Save, "<td><u><b>Height:</b></u> "; height$; "</td>"
#Save, "<td><u><b>Weight:</b></u> "; weight$; "</td>"
#Save, "<td><u><b>Hair Color:</b></u> "; hairColor$; "</td>"
#Save, "</tr>"
#Save, "<tr>"
#Save, "<td><u><b>Language:</b></u> "; language$;"</td>"
#Save, "<td></td>"
#Save, "<td></td>"
#Save, "</tr>"
#Save, "<tr>"
#Save, "<td colspan="; chr$(34); "3"; chr$(34);"><u><b>"; row1$; "</b></u></td>"
#Save, "</tr>"
#Save, "<tr>"
#Save, "<td colspan="; chr$(34); "3"; chr$(34);"><u><b>"; row2$; "</b></u></td>"
#Save, "</tr>"
#Save, "<tr>"
#Save, "<td colspan="; chr$(34); "3"; chr$(34);"><u><b>"; row3$; "</b></u></td>"
#Save, "</tr>"
#Save, "</table>"
#Save, chr$(9);chr$(9); "</div>"
#Save, chr$(9); "</body>"
#Save, "</html>"
close #Save
run "rundll32.exe url.dll,FileProtocolHandler ";fileName$
wait