public PDF(Stream os, int compliance) { this.os = os; this.compliance = compliance; DateTime now = new DateTime(DateTime.Now.Ticks); SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMddHHmmss'Z'"); SimpleDateFormat simpleDateFormat2 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss"); this.creationDate = simpleDateFormat.Format(now); this.createDate = simpleDateFormat2.Format(now); this.Append("%PDF-1.4\n"); this.Append('%'); this.Append(242); this.Append(243); this.Append(244); this.Append(245); this.Append(246); this.Append('\n'); if (compliance == Compliance.PDF_A_1B) { this.metadataObjNumber = this.AddMetadataObject("", true); this.outputIntentObjNumber = this.AddOutputIntentObject(); } }
// Here is the layout of the PDF document: // // Metadata Object // Output Intent Object // Fonts // Images // Resources Object // Content1 // Content2 // ... // ContentN // Annot1 // Annot2 // ... // AnnotN // Page1 // Page2 // ... // PageN // Pages // StructElem1 // StructElem2 // ... // StructElemN // StructTreeRoot // Info // Root // xref table // Trailer public PDF(Stream os, int compliance) { this.os = os; this.compliance = compliance; DateTime date = new DateTime(DateTime.Now.Ticks); SimpleDateFormat sdf1 = new SimpleDateFormat("yyyyMMddHHmmss"); SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss"); creationDate = sdf1.Format(date); createDate = sdf2.Format(date); Append("%PDF-1.5\n"); Append('%'); Append((byte) 0x00F2); Append((byte) 0x00F3); Append((byte) 0x00F4); Append((byte) 0x00F5); Append((byte) 0x00F6); Append('\n'); if (compliance == Compliance.PDF_A_1B || compliance == Compliance.PDF_UA) { metadataObjNumber = AddMetadataObject("", false); outputIntentObjNumber = AddOutputIntentObject(); } }