public void InternalWriteText(string text) { LibLogger.Debug(this.GetType(), "InternalWriteText"); var fontAttr = gstate.font.Attr; if (fontAttr.type == (uint)HPDF_FontType.HPDF_FONT_TYPE0_TT) { stream.HPDF_Stream_WriteStr("<"); stream.HPDF_Stream_WriteBinary(HPDF_Utils.StringToByteArray(text), null as HPDF_Encrypt); stream.HPDF_Stream_WriteStr(">"); return; } if (fontAttr.type == (uint)HPDF_FontType.HPDF_FONT_TYPE0_CID) { stream.HPDF_Stream_WriteStr("<"); stream.HPDF_Stream_WriteBinary(HPDF_Utils.StringToByteArray(text, true, "cn-gb"), null as HPDF_Encrypt); stream.HPDF_Stream_WriteStr(">"); return; } stream.HPDF_Stream_WriteEscapeText(text, fontAttr.encoder); }
private void WriteTrailer(HPDF_Stream stream) { LibLogger.Debug(this.GetType(), "WriteTrailer"); int maxObjId = (int)Entries.Count + StartOffset; Trailer.HPDF_Dict_AddNumber("Size", maxObjId); if (Prev != null) { Trailer.HPDF_Dict_AddNumber("Prev", Prev.Addr); } stream.HPDF_Stream_WriteStr(HPDF_Utils.ParseString("trailer\\012")); //trailer.HPDF_Dict_Write ( stream, null); stream.HPDF_Dict_Write(Trailer, null as HPDF_Encrypt); stream.HPDF_Stream_WriteStr(HPDF_Utils.ParseString("\\012startxref\\012")); stream.HPDF_Stream_WriteUInt((uint)Addr); stream.HPDF_Stream_WriteStr(HPDF_Utils.ParseString("\\012%%EOF\\012")); }