Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
HTML to PDF?
Message
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Miscellaneous
Thread ID:
00886411
Message ID:
00886433
Views:
12
Something like this, without any 'tool' though.
Procedure Yhtml2pdf

lcHTMLFileName="c:\cus.htm"
lcPDFFileName="C:\cus.pdf"
ERASE (lcPDFFileName)

lcPDFPrinter="Win2PDF"
lcPDF_printWindowTitle="Win2PDF file save"

lcCurPrinterName=SET("printer",2)

READYSTATE_COMPLETE = 4
MAX_TIME = 30

*Set  PDF printer as default
oWSHNet = CREATEOBJECT('Wscript.Network')
oWSHNet.SetDefaultPrinter(lcPDFPrinter)
oShell = CreateObject("WScript.Shell")

* open the html file and invoke PDF print dialog
oIE = CreateObject("InternetExplorer.Application")
oIE.Navigate(lcHTMLFileName)

nStart = SECONDS()
DO WHILE oIE.ReadyState <> 4 AND (SECONDS()-nStart < MAX_TIME)
	INKEY(2)
ENDDO
*oIE.visible=.t.     && if you wish
IF  oIE.ReadyState = 4 AND NOT  oIE.busy
	oIE.Execwb(6,2)		&&print it, without print  dialog
	
	lnstart=second()
	do while not oShell.AppActivate(lcPDF_printWindowTitle) and second()-lnstart <=MAX_TIME
		inkey(2)
	ENDDO
	if oShell.AppActivate(lcPDF_printWindowTitle)
		oShell.SendKeys(lcPDFFileName)
		oShell.SendKeys("%S")
	endif
else
*     Error message goes here
endif

oShell=null
* Set default printer back
oWSHNet.SetDefaultPrinter(lcCurPrinterName)
oWSHNet=null
oie=null
>Does anyone know any tool to transform an HTML doc to a PDF doc?
>
>Thanks....
Previous
Reply
Map
View

Click here to load this message in the networking platform