Use C # To generate PDF documents (original code)
// Write by wenhui.org
Using System;
Using System. IO;
Using System. Text;
Using System. Collections;
Namespace generator Generator
{
Public class extends Generator
{
Static float pageWidth = 594.0f;
Static float pageDepth = 828366f;
Static float pageMargin = 30366f;
Static float fontSize = 20366f;
Static float leadSize = 10.0f;
Static StreamWriter pPDF = new StreamWriter ("E: mystreamwriter ");
Static MemoryStream mPDF = new MemoryStream ();
Static void ConvertToByteAndAddtoStream (string strMsg)
{
Byte [] buffer = null;
Buffer = ASCIIEncoding. ASCII. GetBytes (strMsg );
MPDF. Write (buffer, 0, buffer. Length );
Buffer = null;
}
Static string xRefFormatting (long xValue)
{
String strMsg = xValue. ToString ();
Int iLen = strMsg. Length;
If (iLen <10)
{
StringBuilder s = new StringBuilder ();
Int I = 10-iLen;
S. Append ('0', I );
StrMsg = s. ToString () + strMsg;
}
Return strMsg;
}
Static void Main (string [] args)
{
ArrayList xRefs = new ArrayList ();
// Byte [] buffer = null;
Float yPos = 0f;
Long streamStart = 0;
Long streamEnd = 0;
Long streamLen = 0;
String strPDFMessage = null;
// PDF document header information
StrPDFMessage = "% PDF-1.1 ";
ConvertToByteAndAddtoStream (strPDFMessage );
XRefs. Add (mPDF. Length );
Str1_message = "1 0 obj ";
ConvertToByteAndAddtoStream (strPDFMessage );
Str1_message = "</Length 2 0 R> ";
ConvertToByteAndAddtoStream (strPDFMessage );