|
-
Jan 28th, 2008, 05:05 AM
#1
Thread Starter
Hyperactive Member
Printing HTML [Resolved]
Does anyone know of a way to print HTML without using the Internet Explorer Object? I ask as I need a way to print multiple pages (only asking for the settings at the start and using them throughout), and to print without the headers and footers that IE adds by default
Thanks
Last edited by Arachnid13; Jan 28th, 2008 at 10:46 AM.
Reason: Resolved
Do you wake up in the morning feeling sleepy and grumpy? Then you must be Snow White
-
Jan 28th, 2008, 05:10 AM
#2
Re: Printing HTML
Wouldn't you need to first get the HTML from the site? Or do you already have it? You just want to print out specific parts of it?
-
Jan 28th, 2008, 06:47 AM
#3
Addicted Member
Regards
Srinivasan Baskaran
India
-
Jan 28th, 2008, 07:12 AM
#4
Re: Printing HTML
But that code bank entry is all based upon the web browser control (IE).
If you download the html source of the page using Inet control you can write it to a file for printing locally as any regular file you would do.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Jan 28th, 2008, 08:02 AM
#5
Thread Starter
Hyperactive Member
Re: Printing HTML
The HTML is stored locally. RobDog, how would you print an html file locally using code without getting the header/footers?
Do you wake up in the morning feeling sleepy and grumpy? Then you must be Snow White
-
Jan 28th, 2008, 08:21 AM
#6
Addicted Member
Re: Printing HTML
I managed to do this using the ie control
all I did was when I printed, changed the registry so it didn't add all the header and footer infor , then when it had finished printing it put it back to default.
maybe not the nicest way of doing it but it worked for me
-
Jan 28th, 2008, 08:32 AM
#7
Re: Printing HTML
How about something as simple as
Code:
Private Function PrintTextFile(sTextFile As String) As String
If Dir(sTextFile) <> vbNullString Then
Open sTextFile For Binary As #1
PrintTextFile = Input(LOF(1), 1)
Close #1
End If
End Function
Private Sub Command1_Click()
Screen.MousePointer = vbHourglass
Printer.Print PrintTextFile("c:\MyPage.htm")
Printer.EndDoc
Screen.MousePointer = vbDefault
End Sub
-
Jan 28th, 2008, 08:45 AM
#8
Addicted Member
Re: Printing HTML
Code:
ShellExecute 0&, "Print", "C:\Innovation\Temp\<filename>.html", "", "", vbNormalFocus
Try the above code...
Regards
Srinivasan Baskaran
India
-
Jan 28th, 2008, 09:09 AM
#9
Thread Starter
Hyperactive Member
Re: Printing HTML
Not able to test either right now but Hack wont your solution just print the source code? And cheenu_vasan all your way does is print it with internet explorer behind the scenes so it will again rely on the registry values, i think i'm gonna have to use ooKmonkeys method and edit the registry, does anyone know if the values are always in HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\PageSetup? or are they in different places for earlier versions of ie?
Do you wake up in the morning feeling sleepy and grumpy? Then you must be Snow White
-
Jan 28th, 2008, 10:04 AM
#10
Re: Printing HTML
 Originally Posted by Arachnid13
Not able to test either right now but Hack wont your solution just print the source code?
Yes, but this
 Originally Posted by Arachnid13
The HTML is stored locally.
tells me that you have a local file of HTML that you want printed.
-
Jan 28th, 2008, 10:45 AM
#11
Thread Starter
Hyperactive Member
Re: Printing HTML
My apologies hack, i have the html locally because it's my program thats generating it, and i want to print it as it would look when rendered in a browser, anyway i solved the second part of my problem with the registry editing myself so this thread is now resolved.
Thanks everyone
Do you wake up in the morning feeling sleepy and grumpy? Then you must be Snow White
-
Jan 28th, 2008, 10:46 AM
#12
Re: Printing HTML [Resolved]
Post your resolution as it might benefit someone else with the same or similiar problem.
-
Jan 28th, 2008, 10:52 AM
#13
Thread Starter
Hyperactive Member
Re: Printing HTML [Resolved]
No problem,
I used the module attached by schoolbusdriver in post #7 of this thread:
http://www.vbforums.com/showthread.php?t=491870
The UpdateKey and GetKeyValue procedures were exactly what i needed
Do you wake up in the morning feeling sleepy and grumpy? Then you must be Snow White
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|