private static void BuildEntriesSection <T>( bytes::IBuffer buffer, EntryTypeEnum entryType, IList <T> items, BuildEntryDelegate <T> buildEntryFunction, string operatorSuffix, GetOutCodeDelegate outCodeFunction, string outCodeFormat ) { if (items.Count == 0) { return; } for (int index = 0, count = items.Count; index < count; index++) { if (index % SubSectionMaxCount == 0) { if (index > 0) { buffer.Append("end").Append(entryType.Tag()).Append(operatorSuffix).Append("\n"); } buffer.Append(Math.Min(count - index, SubSectionMaxCount).ToString()).Append(" ").Append("begin").Append(entryType.Tag()).Append(operatorSuffix).Append("\n"); } buildEntryFunction(items[index], buffer, outCodeFunction, outCodeFormat); } buffer.Append("end").Append(entryType.Tag()).Append(operatorSuffix).Append("\n"); }
private static bytes::IBuffer BuildCharEntry( KeyValuePair <ByteArray, int> cidChar, bytes::IBuffer buffer, GetOutCodeDelegate outCodeFunction, string outCodeFormat ) { return(buffer.Append("<").Append(ConvertUtils.ByteArrayToHex(cidChar.Key.Data)).Append("> ") .Append(String.Format(outCodeFormat, outCodeFunction(cidChar))).Append("\n")); }
/** * <summary>Sets the Javascript script into the specified base data object.</summary> */ internal static void SetScript(PdfDictionary baseDataObject, PdfName key, string value) { PdfDataObject scriptObject = baseDataObject.Resolve(key); if (!(scriptObject is PdfStream) && value.Length > 256) { baseDataObject[key] = baseDataObject.File.Register(scriptObject = new PdfStream()); } // Insert the script! if (scriptObject is PdfStream) { bytes::IBuffer scriptBuffer = ((PdfStream)scriptObject).Body; scriptBuffer.Clear(); scriptBuffer.Append(value); } else { baseDataObject[key] = new PdfTextString(value); } }