Solved

What am I missing in this asp code it is not working

Posted on 2004-10-14
4
751 Views
Last Modified: 2013-12-03
What am I missing.

Below is my code of my 2 pages. I entering code into a text field and when I hit the button it is suppose to generate a pdf that I can then save to my desk top. However it is not what am I missing.

Please be spacific as I am learning. thanks
url where these files are located http://www.strokeplay.com/pdf/simple.asp

**************simple.asp code ***************************

<html>
<head>
<title>Untitled Document</title>
</head>
<body>
<SCRIPT LANGUAGE="JavaScript">
var arrItems1 = new Array();  file://Level 1 Array
var arrItemsGrp1 = new Array();
 
arrItems1[1] = "New York";  file://Phantom of the Opera Level 1
arrItemsGrp1[1] = 1;
arrItems1[2] = "London";
arrItemsGrp1[2] = 1;
arrItems1[3] = "Paris";
arrItemsGrp1[3] = 1;
arrItems1[4] = "Bejing";
arrItemsGrp1[4] = 1;
 
arrItems1[5] = "New York"; file://John the Comic Level 1
arrItemsGrp1[5] = 2;
arrItems1[5] = "Paris";
arrItemsGrp1[5] = 2;

arrItems1[9] = "New York";  file://Annie Level 1
arrItemsGrp1[9] = 3;
arrItems1[10] = "Nashville";
arrItemsGrp1[10] = 3;
arrItems1[11] = "Hong Kong";
arrItemsGrp1[11] = 3;

arrItems1[13] = "London";  file://Wild Wild West Level 1
arrItemsGrp1[13] = 4;
arrItems1[14] = "Paris";
arrItemsGrp1[14] = 4;
arrItems1[15] = "Moscow";
arrItemsGrp1[15] = 4;
 
function selectChange(control, controlToPopulate, ItemArray, GroupArray)
{
  var myEle ;
  var x ;
  // Empty the second drop down box of any choices
  for (var q=controlToPopulate.options.length;q>=0;q--) controlToPopulate.options[q] = null;
  if (control.name == "platform") {
    // Empty the third drop down box of any choices
    //for (var q=bos.thirdChoice.options.length;q>=0;q--) bos.thirdChoice.options[q] = null;
 }
  // ADD Default Choice - in case there are no values
  myEle = document.createElement("option") ;
  myEle.value = 0 ;
  myEle.text = "[SELECT]" ;
  controlToPopulate.add(myEle) ;
  // Now loop through the array of individual items
  // Any containing the same child id are added to
  // the second dropdown box
  for ( x = 0 ; x < ItemArray.length  ; x++ )
    {
      if ( GroupArray[x] == control.value )
        {
          myEle = document.createElement("option") ;
          myEle.value = x ;
          myEle.text = ItemArray[x] ;
          controlToPopulate.add(myEle) ;
        }
    }
}
//  End -->
</script>

    <p>

<div align="center">
  <center>
  <table border="0" width="80%">
    <tr>
      <td width="100%">
        <p align="center"><font face="Verdana, Arial, Helvetica, sans-serif" size="5"><b><u>Deco Pavers Quote Form<br>
        </u></b></font></td>
    </tr>
    <tr>
      <td width="100%" bgcolor="#057CA6">
        <p align="center"><font face="Verdana, Arial, Helvetica, sans-serif" size="2" color="#FFFFFF"><b>Introduce
        some info:</b></font></td>
    </tr>
  </table>
  </center>
</div>
<form name="sample" action="print_simple.asp" METHOD="POST">
  <div align="center">
    <center>
  <table width="80%" border="0" cellspacing="0" cellpadding="0">
    <tr>
                  <td align="right"><b><font class="v" size="2" face="Verdana, Arial, Helvetica, sans-serif"><font color="red">*</font>
                    Your Name</font></b></td>
                  <td><input name="FrmName" size="20" value="Name"></td>
    </tr>
    <tr>
                  <td align="right"><b></b></td>
                  <td>&nbsp;</td>
    </tr>
    <tr>
                  <td vAlign="top" align="right"><b><font class="v" size="2" face="Verdana, Arial, Helvetica, sans-serif"><font color="red">*</font>
                    Text</font></b></td>
                  <td><textarea class="v" name="FrmText" rows="6" wrap="physical" cols="70"> Paste your quote here

</textarea></td>
    </tr>
    <tr>
                  <td></td>
                  <td align="left"><input style="FONT-WEIGHT: bold; FONT-SIZE: 8pt; BACKGROUND: #2a2073; CURSOR: hand; COLOR: white; FONT-FAMILY: tahoma, arial" type="submit" value="Generate PDF" name="Submit"></td>
    </tr>
    <tr>
      <td align="center" colspan="2" bgcolor="#057CA6"><font face="Verdana, Arial, Helvetica, sans-serif" color="#FFFFFF"><b>DEMO</b></font></td>
    </tr>
  </table>
    </center>
  </div>
</form>
<p>&nbsp;</p>
<p align="center"><font color="#000000" size="1" face="Verdana, Arial, Helvetica, sans-serif">Download
the source code of this sample</font></p>
</body>
</html>


*********************** print_simple.asp code ********************************

<%
' Clear out the existing HTTP header information
Response.Expires = 0
Response.Buffer = TRUE
Response.Clear

dim PDF, str, streamPDF
const csPropTextFont  = 100
const csPropTextSize  = 101
const csPropTextAlign = 102
const csPropTextColor = 103
const csPropTextUnderline = 104
const csPropTextRender  = 105
const csPropParSpace    = 200
const csPropParLeft       = 201
const csPropParTop             = 202
const csPropPosY          = 206
const csPropInfoTitle       = 300
'
const algLeft = "0"
const algRight = "1"
const algCenter = "2"
const algJustified = "3"
'
const pTrue = "1"
const pFalse = "0"


set PDF = server.createobject("aspPDF.EasyPDF")

      'PDF.DEBUG = True
      'PDF.License( server.mappath("\asp\mipdflic.cli") )
      PDF.SetMargins 20,50,50,50
      PDF.SetProperty csPropTextFont, "F1"
      PDF.SetProperty csPropTextSize, "25"
      PDF.SetProperty csPropTextAlign, algCenter
      ' Start the paragraph bit lower 80 unit
      'YParagraph = int(PDF.GetProperty(csPropParTop))
      'PDF.SetProperty csPropParTop, cstr(YParagraph - 80 )
      ' Get the actual XPos of the cursor
      YPos = int(PDF.GetProperty(csPropPosY))
      PDF.SetPos 0, YPos - 10
      PDF.AddText "aspEasyPDF from MITData<br> <br>"
      PDF.AddLine 60, 65, 520, 65
      ' Change font, size and align of the text
      PDF.SetProperty csPropTextFont, "F2"
      PDF.SetProperty csPropTextSize, "12"
      PDF.SetProperty csPropTextAlign, algJustified
      ' Get User Name
      PDF.AddText "Hello "
      PDF.SetProperty csPropTextColor,"#0000FF"
      PDF.AddText request.Form("FrmName")
      PDF.SetProperty csPropTextColor,"#000000"
      PDF.AddText ",<br> This PDF document file has been generated in realtime from an Internet Server with ASP. <br> <br>"
      PDF.SetProperty csPropTextFont, "F2"
      PDF.SetProperty csPropTextSize, "11"
      PDF.AddText "You wrote the following text from the Form Box:<br> <br>"
      PDF.SetProperty csPropTextFont, "F1"
      PDF.SetProperty csPropTextAlign, algCenter
      PDF.AddText request.Form("FrmText") & " <br>"
      PDF.SetProperty csPropTextAlign, algJustified
      PDF.AddText "<br> Country: " & request.Form("FrmCountry") & "<br> <br>"
      PDF.SetProperty csPropTextAlign, algJustified
      ' This text is from
      str = "THE ORIGINS OF THE Portable Document Format and the Adobe® Acrobat® " & _
              "product family date to early 1990. At that time, the PostScript® page description " & _
              "language was rapidly becoming the worldwide standard for the production of the " & _
              "printed page. PDF builds on the PostScript page description language by layering " & _
              "a document structure and interactive navigation features on PostScript’s under-lying " & _
              "imaging model, providing a convenient, efficient mechanism enabling documents " & _
              "to be reliably viewed and printed anywhere.<br> <br> <br> "
      PDF.AddText str
      PDF.SetProperty csPropTextFont, "F2"
      PDF.SetProperty csPropTextAlign, algLeft
      PDF.AddText "From an internet server with ASP you can provide real time document. This component features:<br> <br>"
      PDF.SetProperty csPropParLeft, "50"
      PDF.AddText "- Paragraphs with 14 standards fonts. "
      PDF.SetProperty csPropTextColor,"#0000FF"
      PDF.AddText "See the font example document<br>"
      PDF.SetProperty csPropTextColor,"#FF0000"
      PDF.AddText "- Text any where and using colors<br>"
      PDF.SetProperty csPropTextColor,"#000000"
      PDF.AddText "- Draw lines, boxes and graphics ( Bitmaps, Gifs and JPEG )<br>"
      PDF.AddText "- Page size, left and top properties for paragraphs position<br>"
      PDF.AddText "- Information property<br>"
      PDF.AddText "- Easy to use and fast to generate the PDF document<br>"
      PDF.AddText "- You don't have to install any additional product on your server to generate the PDF<br>"
      PDF.AddText "- The registred version cost only 50 US dollars per server<br>"


      ' Write it directly to window
      PDF.BinaryWrite
      set pdf = nothing

%>
0
Comment
Question by:drujames
4 Comments
 
LVL 2

Accepted Solution

by:
NaderYacoub earned 250 total points
ID: 12313573
you need to install the object (EasyPDF) on the server/machine that this code is running on. This usually is a dll that you register. So, all you have to do to get rid of this particular error is to install the component (EasyPDF).
0
 
LVL 3

Assisted Solution

by:nan1217
nan1217 earned 250 total points
ID: 12344309
What the previous poster said is true - make sure you have the ASPPDF component installed and that your license hasn't run out.

However, assuming that's all been done, I don't see a statement like

Filename = Doc.Save( Server.MapPath("hello.pdf"), False )

anywhere in the code.  Try this link for information - http://www.asppdf.com/manual_03.html - on this and perhaps consult their own knowledge base - http://www.asppdf.com/support.html - and examples for more help.
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
An enjoyable and seamless user experience can go a long way on an eCommerce site. While a cohesive layout and engaging copy play roles in creating a positive user experience, some sites neglect aspects that seem marginal but in actuality prove very …
This video teaches users how to migrate an existing Wordpress website to a new domain.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

786 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question