View Full Version : Looking for ideas on certificate
discotheque
12-16-2004, 06:11 PM
I'm designing a training program and on the final page the user prints a certificate of completion. Last year I accomplished this by having a html file open, having the users fil in their name, and then printing the document. The problem was that users could access the file in the directory in the CD and print out the file without completing the course. I'm trying to thwart this process and am in search of ideas. It sounds like auto play can't simply print the page the user is on.... so that's where I am at!
Here’s a few ideas you might try:
1. Hide your certificate.html document by giving it a different extension i.e. call it something like 936.dat You’ll still be able to open it as a web object I you want.
2. Don’t distribute your program with the certificate.html file, instead write it out dynamically only after the person has completed the course.
3. Use a combination of ideas 1 & 2
4. Use Worms Screen Capture DLL to capture your AMS screen and print it out
Get his DLL and a sample APZ here:
http://www.indigorose.com/forums/showthread.php?t=8795
TJ_Tigger
12-16-2004, 08:47 PM
Disco,
I am working on the same thing with a Training Tracking program that I am building that keeps track of who has been trained on what and where. I have it so that when The course is completed, I can build a html file for them dynamically as their certificate. I will extract the code and post it here. It might be tomorrow however.
In short it takes the users name and with one function it builds the certificate for them. If the course is distributed on CD and you are using images, those images might need to be copied to the directory to which you write your template.
tigg
TJ_Tigger
12-17-2004, 10:38 AM
The function is a little long but it gets the job done. I ended up redoing the function since the function within my project is closely tied to other functions.
I hope you find it useful.
Tigg
markstaylor
12-17-2004, 12:44 PM
TJ_Tigger,
That's just what I could use. I don't know html at all, but I think I can follow your code.
Can the Cert be printed from the App? And can it be viewed as a Web object instead of in IE.
Thanks for the great info once again
Mark
TJ_Tigger
12-17-2004, 12:59 PM
Mark,
I really don't know html either. I leveraged the certificate template from another internal source from my company. I used the double brackets to preserve the format of the code. just copied and pasted it from notepad, added the variables I needed in the middle and wrote it to a file.
Yes you can easily open the file in AMS. Just use the Web.Load action
Web.LoadURL("Web1", _TempFolder.."\\"..sName..".htm");
and once it is loaded use
Web.Print("Web1", true);
Hope that helps
Tigg
TJ_Tigger
12-17-2004, 01:04 PM
Try this one.
TJ_Tigger
12-17-2004, 01:07 PM
Let me search for it, but I remember there being a function that someone created to turnoff the page number, title and url from being printed with certificate.
If anyone has it, please post it.
Tigg
EDIT
Here is the key in the registry. HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\PageSetup
You could blank the header and footer then print then reset them.
http://support.microsoft.com/default.aspx?scid=kb;en-us;311280
markstaylor
12-17-2004, 01:14 PM
That was easy!
I made a project for my sons cub scouts, and this will work great for that.
Would it be hard to make it full page landscape? without the IE file info and header that is on the print out.
Either way, This is great.
Thanks
Mark
TJ_Tigger
12-17-2004, 01:16 PM
And here is the registry entry for setting page size and landscape.
Printer Settings
Settings in the HKEY_CURRENT_USER\Software\Microsoft\Windows\Curre ntVersion\Internet Settings key define printing preferences.
The following table shows the named values.
Value : type Description
PageOrientation : REG_DWORD Specifies page orientation. Valid settings are 1=portrait, 2=landscape. Default setting is 1.
PrintQuality : REG_DWORD Specifies print quality. Valid settings are 1=draft, 2=final. Default setting is 1.
PaperSize : REG_DWORD Specifies paper size. Valid settings are 1=letter, 5=Legal, 9=A4, 13=B5.Default setting is 1.
Intrigued
12-17-2004, 01:27 PM
Thanks from me too TJ_TIGGER!
This project is definitely going up on amsuser.com!
Very Sincerely,
TJ_Tigger
12-17-2004, 02:13 PM
I can get it to print without the headers but I am having difficulty getting it to print landscape. I will continue to work on it and post it when I am finished.
TJ_Tigger
12-17-2004, 05:11 PM
Here is the latest that will output without header and footer. Thanks to KP who posted a function on this originally.
Still can't get the landscape to work programatically. Might have to change the Web.Print value to false so the user can set their page to landscape. I will keep digging on the landscape but no luck so far.
Tigg
Corey
12-18-2004, 04:21 AM
I can make it print nice and big with razor sharp vectors, and it even brings up the user preferences so they can choose landscape. But I can't figure out how to get it to override margins. Try the attached, choose landscape when prompted to print, and let me know what happened... :yes Main thing I'm trying to see is what size, sharpness, and alignment gets output, i.e. was it centered on the page? Etc...
TJ_Tigger
12-18-2004, 10:26 AM
As a side note, margins are found in this registry key
HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\PageSetup
so if you wanted to set the margins smaller you could add that to the function. Here is a link to KPsmith's post on how to do the same.
http://www.indigorose.com/forums/showthread.php?t=7587
And lastly, if you have a background graphic that you would like to print, there is a print background option in
HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main
called Print_Background
You can change this to yes to have it print the background.
There are a couple of CSS tags that are supposed to allow you to define a page as landscape but they are not supported by IE at this time. Firefox and Opera appear to support them however. The first better than the latter.
HTH
TJ_Tigger
12-18-2004, 10:28 AM
Corey, that printed nicely, but on my printer is was not centered. It was closer to the left than to the right.
Tigg
Corey
12-18-2004, 10:32 AM
Yeah mine too. Hmm, OK well now that I know it's consistent I can try and tweak it, I bet I can get it centered. :) I'll let you know.
markstaylor
12-20-2004, 10:02 AM
Is there a way to have the Print Dialog window popup to allow the user to select a printer and LANDSCAPE. In TJ_Tiggers project example.
Thats all that is left and I can use it in my project.
Still would love to have it print in Landscape automatically to the default printer though.
Mark
TJ_Tigger
12-20-2004, 10:35 AM
Is there a way to have the Print Dialog window popup to allow the user to select a printer and LANDSCAPE. In TJ_Tiggers project example.
Thats all that is left and I can use it in my project.
Still would love to have it print in Landscape automatically to the default printer though.
Mark
Mark,
On the Print button, set the line that says
Web.Print("Web1", true);
to
Web.Print("Web1", false);
The true/false in the Web.Print says whether or not to use the default printer. By setting it to false it will open the print dialog.
Tigg
Here's my "spin" on Tig's code.
TJ_Tigger
12-20-2004, 12:48 PM
Spin, yuck yuck
It was a pun, 2/3 of one, p u
markstaylor
12-20-2004, 04:09 PM
Worm,
Is there a vbscript or is that built in? Is there one to center it in Landscape?
Corey
12-20-2004, 04:13 PM
I always forget how many puns in a quip, seems to me 2/3 of a pun is *somewhere* around a quip and half, but the exchange rate has been doing funny things lately so I might be off by a paronomasia or two. Then again,what's a few measly paronomasia between friends.
I messed with Tig's code to get it that far. To center it, I'd suggest putting your certificate inside another table with only one cell, and setting it's alignment to center, and middle. Seems like it would work.
The vbscript is a function I wrote to apply the style, it's really not needed, but it makes it so that you can view the certificate normally, then spin it to print.
Protocol
12-21-2004, 11:13 AM
Another way that you might consider hiding the file is to zip it up, then rename it. That way if they try to open it, it's one level deeper. Then when you open it legitimately, you just unzip it. Badda-bing.
I've used this a few times. Shhhhh...
markstaylor
12-26-2004, 01:42 PM
To center it, I'd suggest putting your certificate inside another table with only one cell, and setting it's alignment to center, and middle.
Can some one help with the HTML code, I cannot figure out how to do this or much HTML coding. Please....
Mark
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.