PDA

View Full Version : Adobe Acrobat



FanPilot
27th June 2002, 09:46
I have just been shown some wonderful stuff with Acrobat that I never gave it much credit for.

Now, if possible, I need to be able to "generate" pdf on the fly from a web page.

I have seen with acrobat, that you can have form fields and these can be easily populated from a text file.

Now, what I need to do is to have a html form on a web site, which interfaces somehow to acrobat (into a pre-prepared document) then shows the viewer that pdf document with the contents of the form filled in.

Do I just install acrobat on the web server or do I need another product?

I will be using ASP to interface to acrobat.

Lynnj
27th June 2002, 10:17
(that will Adobe Acrobat v5, right?)

FanPilot
27th June 2002, 10:28
Yes.

Tongariro
2nd July 2002, 10:54
www.fineprint.com have a product called pdfFactory (about US$30) which will write pdf docs for you. Much cheaper than full Acrobat Writer.

Gordon

StephenRees
4th July 2002, 12:10
I can send you an actual pdf generator written in C#, aw hell it's pasted below.

It's a bit cumbersome from the look of it but once you have a template sorted then replacing text with stuff from a db or web form would be simple.
Getting that template looking nice is the hard bit.

And you have to learn .NET and host on .NET server for it to work. But it will produce on the fly pdf and save to hdd.

using System;
using System.IO;
using System.Text;
using System.Collections;

namespace PDFGenerator
{
&nbsp &nbsp &nbsp &nbsp /// <summary>
&nbsp &nbsp &nbsp &nbsp /// Application : Generation of PDF file from text
&nbsp &nbsp &nbsp &nbsp /// Author&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp : Pramod Kumar Singh
&nbsp &nbsp &nbsp &nbsp /// Date&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp : 25th July 2001
&nbsp &nbsp &nbsp &nbsp ///</summary>
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp
&nbsp &nbsp &nbsp &nbsp public class PDFGenerator
&nbsp &nbsp &nbsp &nbsp {
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp static float pageWidth = 594.0f;
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp static float pageDepth = 828.0f;
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp static float pageMargin = 30.0f;
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp static float fontSize = 10.0f;
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp static float leadSize = 10.0f;
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp //Create a PDF file.
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp //PDF on Disk
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp static StreamWriter pPDF=new StreamWriter("E:\ \Downloads\\_unzip2\\myPDF.pdf");
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp //PDF in Memory
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp static MemoryStream mPDF= new MemoryStream();
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp //Convert the Text Data to PDF format and write back to
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp //Memory Stream
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp static void ConvertToByteAndAddtoStream(string strMsg)
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp {
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp Byte[] buffer=null;
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp buffer=ASCIIEncoding.ASCII.GetBytes(strMsg);
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp mPDF.Write(buffer,0,buffer.Length);
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp buffer=null;
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp }
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp //Format the data length in xRef Format
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp static string xRefFormatting(long xValue)
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp {
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp string strMsg =xValue.ToString();
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp int iLen=strMsg.Length;
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp if (iLen<10)
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp {
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp StringBuilder s=new StringBuilder();
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp //string s=null;
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp int i=10-iLen;
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp s.Append('0',i);
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp strMsg=s.ToString() + strMsg;
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp }
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp return strMsg;
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp }

&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp //Entry Point
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp static void Main(string[] args)
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp {
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp //Create a ArrayList for xRefs of PDF Document
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp ArrayList xRefs=new ArrayList();
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp Byte[] buffer=null;
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp float yPos =0f;
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp long streamStart=0;
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp long streamEnd=0;
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp long streamLen =0;
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp string strPDFMessage=null;
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp //PDF Header Message
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp strPDFMessage="%PDF-1.1\n";
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp ConvertToByteAndAddtoStream(strPDFMessage);
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp //ID 1 For Containt
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp //ID 2 For Length of the Stream
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp //write the Text
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp //1> Start a new Page
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp xRefs.Add(mPDF.Length);
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp strPDFMessage="1 0 obj\n";
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp ConvertToByteAndAddtoStream(strPDFMessage);
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp strPDFMessage="<< /Length 2 0 R >>\n";
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp ConvertToByteAndAddtoStream(strPDFMessage);
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp strPDFMessage="stream\n";
ConvertToByteAndAddtoStream(strPDFMessage);
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp //Get the start of the stream
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp streamStart=mPDF.Length;
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp strPDFMessage="BT\n/F0 " + fontSize +" Tf\n";
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp ConvertToByteAndAddtoStream(strPDFMessage);
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp yPos = pageDepth - pageMargin;
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp strPDFMessage=pageMargin + " " + yPos +" Td\n" ;
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp ConvertToByteAndAddtoStream(strPDFMessage);
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp strPDFMessage= leadSize+" TL\n" ;
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp ConvertToByteAndAddtoStream(strPDFMessage);
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp //Add the text data to the PDF memory stream
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp strPDFMessage= "(Pramod Kumar Singh)Tj\n" ;
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp ConvertToByteAndAddtoStream(strPDFMessage);
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp strPDFMessage= "ET\n";
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp ConvertToByteAndAddtoStream(strPDFMessage);
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp //Get the End of the stream
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp streamEnd=mPDF.Length;
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp //Get the Length of the stream
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp streamLen=streamEnd-streamStart;
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp strPDFMessage= "endstream\nendobj\n";
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp ConvertToByteAndAddtoStream(strPDFMessage);
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp //Add 2 object to xRef
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp xRefs.Add(mPDF.Length);
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp strPDFMessage="2 0 obj\n"+ streamLen + "\nendobj\n";
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp ConvertToByteAndAddtoStream(strPDFMessage);
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp //Add Page to xRefs
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp xRefs.Add(mPDF.Length);
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp strPDFMessage="3 0 obj\n<</Type/Page/Parent 4 0 R/Contents 1 0 R>>\nendobj\n";
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp ConvertToByteAndAddtoStream(strPDFMessage);
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp //Build the Pages
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp xRefs.Add(mPDF.Length);
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp strPDFMessage="4 0 obj\n<</Type /Pages /Count 1\n";
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp ConvertToByteAndAddtoStream(strPDFMessage);
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp strPDFMessage="/Kids[\n3 0 R\n]\n";
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp ConvertToByteAndAddtoStream(strPDFMessage);
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp strPDFMessage="/Resources<</ProcSet[/PDF/Text]/Font<</F0 5 0 R>> >>\n";
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp ConvertToByteAndAddtoStream(strPDFMessage);
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp strPDFMessage="/MediaBox [ 0 0 "+ pageWidth + " " + pageDepth + " ]\n>>\nendobj\n";
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp ConvertToByteAndAddtoStream(strPDFMessage);
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp //Add font to xRefs
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp xRefs.Add(mPDF.Length);
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp strPDFMessage="5 0 obj\n<</Type/Font/Subtype/Type1/BaseFont/Courier/Encoding/WinAnsiEncoding>>\nendobj\n";
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp ConvertToByteAndAddtoStream(strPDFMessage);
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp //Add the catalog to xRefs
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp xRefs.Add(mPDF.Length);
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp strPDFMessage="6 0 obj\n<</Type/Catalog/Pages 4 0 R>>\nendobj\n";
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp ConvertToByteAndAddtoStream(strPDFMessage);
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp //xRefs Entry
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp streamStart=mPDF.Length;
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp strPDFMessage="xref\n0 7\n0000000000 65535 f \n";
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp for(int i=0;i<xRefs.Count;i++)
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp {
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp strPDFMessage+=xRefFormatting((long) xRefs<!--EZCODE ITALIC START--> )+" 00000 n \n";
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp }
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp ConvertToByteAndAddtoStream(strPDFMessage);
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp //Trailer for the PDF
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp strPDFMessage="trailer\n<<\n/Size "+ (xRefs.Count+1)+"\n/Root 6 0 R\n>>\n";
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp ConvertToByteAndAddtoStream(strPDFMessage);
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp //xRef location entry
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp strPDFMessage="startxref\n" + streamStart+"\n%%EOF\n";
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp ConvertToByteAndAddtoStream(strPDFMessage);
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp //Write the PDF from Memory Stream to File Stream
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp mPDF.WriteTo(pPDF.BaseStream);
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp //Close the Stream
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp mPDF.Close();
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp pPDF.Close();
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp }
&nbsp &nbsp &nbsp &nbsp }
}<!--EZCODE ITALIC END-->

StephenRees
4th July 2002, 12:24
you say you want to interface with Acrobat 'somehow' ?
how ?
unless there is an api written specially for the job - like the office apps - then you can't.

The above code is more similar to writing out chunks of rtf (for word) than it is to operating it remotely, or somewhere in between.

If you do enquire then let me know if Adobe do actually supply a proper interface like word/excel/etc so that it could be remotely executed.

Check www.developa.com/cvdotnet.htm (http://www.developa.com/cvdotnet.htm) for a dotNET 'applet/ActiveX' control that operates Word on the client from the web. You will have to have .NET installed client side and you will also have to drop your security settings in mscorcfg.msc to witness it.

Regards
Steve.

FanPilot
4th July 2002, 13:41
I have found a way to do it, doesn't need as much as that C#, any activex or anything. In fact the way to do it is so easy that it is beyond belief.

PDF has a form definition format. The file type is FDF. Create the FDF (which can easily be done in ASP) and then stream this to the browser. The browser understands what FDF is, and will open Acrobat Reader, which will then open the associated PDF.

Piece of cake once you know what FDF is, and the FDF format is easy as well.

The PDF though will need form fields that are populated by the FDF. We wasn't doing anything special, but we did need to fill out a form from a web form.

ScotsPine
4th July 2002, 18:40
that's a 'nice to know', fanpilot. well done. perhaps you could post a small article? :)

FanPilot
5th July 2002, 10:59
I may do just that... on one of my own web sites. (I have a site devoted to source code for many languages, but the uptake has been a little slower than I anticipated). You can see that site at www.sourcecodecorner.com (http://www.sourcecodecorner.com) (the article isn't there yet, not sure when I can get the article up). If you have ideas for articles, I would be happy to see them.