Ask a Question related to Macromedia Director Lingo, Design and Development.
-
Creative Acceleration #1
creating HTML for Print
Hi guys,
i was looking for a print solution some time back, and had a suggestion that
i could create a HTML (that makes the printing look really formatted) and
then print that file ..
pls. gimme suggestion / bahaviours that can create a html page, no $$$ xtras
please..
Guess i can use the FileXtra {free :-} and create HTML files, like creating
normal text files ..
Thanx
Kart
Creative Acceleration Guest
-
Creating a print button on a PDF
I am trying to map a graphic on my PDF so that when a user clicks on it, the print dialog box opens up and allows them to print the PDF. Is this... -
Creating PDFs from Freehand -- print to PDFvs. export vs. print/scan to PDF?
I've had a lot of compatibility problems with created presentations so have started using Acrobat instead of trying to export my Macromedia Freehand... -
Creating a print window
I am working on creating a print window (TitleWindow) that can be used throughout my application as a "canvas" to drop in visual objects that need... -
How to use HTML::Parser to remove HTML tags and print result
I am trying to use HTML::Parser to parse an HTML file, remove all HTML tags (including comments, etc.), replace all ENTITIES (e.g. &), and put... -
Creating a logo for print and web
hello forum! can someone tell me where in this forum or archives there was a posting about using a file for both print and web, specifically... -
Andrew Morton #2
Re: creating HTML for Print
You can use the writeString function in the fileIO xtra (free with Director) to
write the actual html to a file on disk.
To create the html, you just build it in a string:
myHtml="<html><head><title>A Title</title></head>"
myHtml=myHtml & "<body><H1>The Heading</H1>"
myHtml=myHtml & </body></html>"
-- get an unused filename in user's temp folder
tryNextName=true
repeat while not(tryNextName)
fName=baGetFolder("temp") & string(the milliseconds) & ".html"
if not(baFileExists(fName)) then tryNextName=false
end repeat
handle=new(xtra "fileIO") -- instantiate xtra
openFile(handle, fName, 0) -- open for r/w access
createFile(handle, fName) -- create file
writeString(handle, myHtml) -- write data
closeFile(handle) -- done with writing to file
handle=void -- done with xtra
baPrintFile(fName)
baDeleteFile(fName)
fileXtra4 has equivalent functions to the buddyAPI ones I showed (the ones
starting "ba").
You should check the error status for the fileIO and buddyAPI/fileXtra4
functions after every usage of it them.
HTH
Andrew Morton
Andrew Morton Guest
-
Gretchen Macdowall #3
Re: creating HTML for Print
In article <bjgvtk$qg3$1@forums.macromedia.com>, "Creative Acceleration"
<karthkyn@hotmail.com> wrote:
In addition to Andrew's idea, if you don't have to add any graphics, which> i was looking for a print solution some time back, and had a suggestion that
> i could create a HTML (that makes the printing look really formatted) and
> then print that file ..
>
text members don't support, you can use the html property of a text member
to make your html for you. Put the text you want in a text member and
then use member("textMember").html for your output to the file you want to
print.
member("textMember").line[1] = "hi there"
member("textMember").line[1].font = "Arial"
htmlOutput = member("textMember").html
inst = new(xtra "fileio")
inst.openFile("c:\temp\somefile.html",2)
inst.writeString(htmlOutput)
Gretchen Macdowall
[url]http://www.updatestage.com/[/url]
Gretchen Macdowall Guest
-
Andrew Morton #4
Re: creating HTML for Print
> ... you can use the html property of a text member
As long as the browser which will print the html does not mind incorrect html
markup. Make a word bold and italic in a text member and its html will be
<B><I>word</B></I>. I don't even want to think about what it might do to <table>
markup.
Andrew
Andrew Morton Guest
-
Creative Acceleration #5
Re: creating HTML for Print
Thanks guys !
Kart
"Creative Acceleration" <karthkyn@hotmail.com> wrote in message
news:bjgvtk$qg3$1@forums.macromedia.com...that> Hi guys,
>
> i was looking for a print solution some time back, and had a suggestionxtras> i could create a HTML (that makes the printing look really formatted) and
> then print that file ..
>
> pls. gimme suggestion / bahaviours that can create a html page, no $$$creating> please..
> Guess i can use the FileXtra {free :-} and create HTML files, like> normal text files ..
>
> Thanx
> Kart
>
>
Creative Acceleration Guest
-
Bertil Flink #6
Re: creating HTML for Print
Just adding to the good suggestions already posted.
I found it easiest to build the html data from pre-made snippets of html
code combined with variable data.
Having the html code visible in field members made it easy to fine tune the
formatting of the page.
The field member names will give you an idea of the setup:
html_start
table_rule
img_start
img_end
title_start
title_end
author_start
author_end
group_start
group_end
html_end
This was a program where children voted for their favourite books.
The result was then sent to an ASP page where the book data populated a
form.
The form functioned as a preview where you could change & add further info
before submittal.
Nothing fancy here.
Perhaps you can extract something useful from the script below.
BuddyAPI is used here, but you can probably use FileXtra instead.
Watch out for line breaks, as usual.
------------------------------<moviescript>----------------------------
--Last edit: 2002-01-24/02:15 (Berra)
--Xtras used: BuddyAPI
global gMoviePrefs
--========================== PRINTING =======================
--GenerateHTML-version of the book list
on generateHTML me
-- write HTML start:
htm = member("html_start").text &RETURN
-- write Rule:
htm = htm & member("table_rule").text &RETURN
infoList = getBookData() --list of titles, authors, age group, etc.
endCount = gMoviePrefs.listed.count
-- write Table entries:
repeat with n = 1 to endCount
theBook = gMoviePrefs.listed[n]
theImage = theBook & ".jpg"
theInfo = infoList.getProp(theBook)
theTitle = theInfo.title
theAuthor = theInfo.author
case (theBook.char[1]) of
"1": theGroup = gMoviePrefs.groupInfo.g1
"2": theGroup = gMoviePrefs.groupInfo.g2
"3": theGroup = gMoviePrefs.groupInfo.g3
"4": theGroup = gMoviePrefs.groupInfo.g4
end case
-- write Image:
htm = htm & member("img_start").text
htm = htm & theImage & member("img_end").text
-- write Title:
htm = htm & member("title_start").text
htm = htm & theTitle & member("title_end").text
-- write Author:
htm = htm & member("author_start").text
htm = htm & theAuthor & member("author_end").text
-- write Group:
htm = htm & member("group_start").text
htm = htm & theGroup & member("group_end").text &RETURN
-- write Rule:
htm = htm & member("table_rule").text &RETURN
end repeat
-- write HTML end:
htm = htm & member("html_end").text &RETURN
return htm
end
--Save the generated HTML document
on savePrintDoc theText, theFile
-- create the FileIO instance
fileObj = new(xtra "FileIO")
-- set the filter mask to text/html files
if the platform contains "mac" then
setFilterMask(fileObj,"TEXT")
else
setFilterMask(fileObj,"HTML-dokument,*.htm*,Alla Filer,*.*")
end if
-- if no file path was passed - open save dialog box
if voidP(theFile) then
theFile = displaySave(fileObj,"","")
-- check to see if cancel was hit
if theFile = "" then return FALSE
end if
-- delete existing file, if any
openFile (fileObj,theFile,2)
delete(fileObj)
-- create and open the file
createFile(fileObj,theFile)
openFile(fileObj,theFile,2)
-- check to see if file opened ok
if status(fileObj) <> 0 then
err = error(fileObj,status(fileObj))
alert "Error:"&&err
return FALSE
end if
-- write the file
writeString(fileObj,theText)
-- set the file type
if the platform contains "Mac" then
setFinderInfo(fileObj, "TEXT MSIE")
end if
-- close the file
closeFile(fileObj)
fileObj = 0
return TRUE
end
--========================== VOTING =======================
-- <Submit Votes> --------------------------------
on submitVote (theURL)
argASP = generateASP()
NetOK = baOpenURL(theURL & argASP, "normal")
return NetOK
end
on generateASP
infoList = getBookData() --Internal/2: "CM: Boktips/Bokjuryn - Databas
200?"
gMoviePrefs.listed.sort() --Behövs?
endCount = min(5, gMoviePrefs.listed.count)
-- Build string of arguments:
args = "?"
repeat with n = 1 to endCount
theBook = gMoviePrefs.listed[n]
theInfo = infoList.getProp(theBook)
theTitle = theInfo.title
theAuthor = theInfo.author
theNum = string(n)
args = args & "title" &theNum& "=" & theTitle & "&author" &theNum& "=" &
theAuthor
if n < endCount then args = args & "&"
end repeat
return args
end
-- </Submit Votes> --------------------------------
--------------------------------------<moviescript/>------------------------
-------
Hope this helps,
--
Bertil Flink
Creative Media
"Creative Acceleration" <karthkyn@hotmail.com> skrev i meddelandet
news:bjgvtk$qg3$1@forums.macromedia.com...that> Hi guys,
>
> i was looking for a print solution some time back, and had a suggestionxtras> i could create a HTML (that makes the printing look really formatted) and
> then print that file ..
>
> pls. gimme suggestion / bahaviours that can create a html page, no $$$creating> please..
> Guess i can use the FileXtra {free :-} and create HTML files, like> normal text files ..
>
> Thanx
> Kart
>
>
Bertil Flink Guest
-
Gretchen Macdowall #7
Re: creating HTML for Print
In article <bjhurq$dm9$1@forums.macromedia.com>, "Andrew Morton"
<akm@in-press.co.uk.invalid> wrote:
<table>> As long as the browser which will print the html does not mind incorrect html
> markup. Make a word bold and italic in a text member and its html will be
> <B><I>word</B></I>. I don't even want to think about what it might do toCertainly has its "quirks" like flawed markup and only supporting HTML> markup.
>
1.0. FWIW I just tried printing some Director-created HTML in IE that
included the bold/italic combo and a simple table and it seemed to work
OK. Guess it would depend on how fancy one wanted to get with the HTML.
Gretchen Macdowall
[url]http://www.updatestage.com/[/url]
Gretchen Macdowall Guest



Reply With Quote

