<html>
<head>
<title>Web to PDF</title>
</head>
<body>
<!-- This section displays the heading -->
<%
vPage = request.form("pg")
if ucase(left(vPage,7)) <> "HTTP://" then
vPage = "http://" & vPage
end if
%>
<table border=0 width="95%">
<tr>
<td><b><font size=5>Convert web page to PDF</font></b></td>
<%
if request.form("pg") <> "" then
%>
<td><%=vPage%></td>
<td><input type=button
value='Go Back' onclick='window.history.go(-1)'></td>
<%
end if
%>
<td><input type=button
value='See Code' onclick='window.open("webtopdf_source.htm")'></td>
</tr>
</table>
<hr>
<%
if request.form("pg") = "" then
' This section displays the form
%>
<form name=form1
method=post>
<center>
Page URL to convert: <input
type=text name="pg"
size=75>
<input type=submit
value='Submit'>
</center>
</form>
<%
else
' This section creates the PDF
and displays it in an IFrame
Set theDoc = Server.CreateObject("ABCpdf6.Doc")
theDoc.Rect.Inset 15, 15
theID = theDoc.AddImageUrl(vPage, TRUE, 0, False)
' Add a pages as required
Do
theDoc.FrameRect
If theDoc.GetInfo(theID, "Truncated")
<> "1" Then Exit Do
theDoc.Page = theDoc.AddPage()
theID = theDoc.AddImageToChain(theID)
Loop
'Flatten the pages (This reduces
size of the generated PDF)
For i = 1 To theDoc.PageCount
theDoc.PageNumber = i
theDoc.Flatten
Next
' Save the PDF File
vPath = server.mappath("\") &
"\asp\pdfs\htmlimage.pdf"
theDoc.Save(vPath)
set theDoc = Nothing
'Display the PDF File
response.write("<iframe name='I1' width=100% height=500 src='.\pdfs\htmlimage.pdf'>")
end if
%>
</body>
</html>