本文整理匯總了C#中iTextSharp.text.pdf.PdfArray.Add方法的典型用法代碼示例。如果您正苦於以下問題:C# PdfArray.Add方法的具體用法?C# PdfArray.Add怎麽用?C# PdfArray.Add使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類iTextSharp.text.pdf.PdfArray
的用法示例。
在下文中一共展示了PdfArray.Add方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: GetOCGOrder
private static void GetOCGOrder(PdfArray order, PdfLayer layer) {
if (!layer.OnPanel)
return;
if (layer.Title == null)
order.Add(layer.Ref);
List<PdfLayer> children = layer.Children;
if (children == null)
return;
PdfArray kids = new PdfArray();
if (layer.Title != null)
kids.Add(new PdfString(layer.Title, PdfObject.TEXT_UNICODE));
for (int k = 0; k < children.Count; ++k) {
GetOCGOrder(kids, children[k]);
}
if (kids.Size > 0)
order.Add(kids);
}
示例2: PdfCollectionSort
/**
* Constructs a PDF Collection Sort Dictionary.
* @param keys the keys of the fields that will be used to sort entries
*/
public PdfCollectionSort(String[] keys) : base(PdfName.COLLECTIONSORT) {
PdfArray array = new PdfArray();
for (int i = 0; i < keys.Length; i++) {
array.Add(new PdfName(keys[i]));
}
Put(PdfName.S, array);
}
示例3: GetSpotObject
protected internal virtual PdfObject GetSpotObject(PdfWriter writer) {
PdfArray array = new PdfArray(PdfName.SEPARATION);
array.Add(name);
PdfFunction func = null;
if (altcs is ExtendedColor) {
int type = ((ExtendedColor)altcs).Type;
switch (type) {
case ExtendedColor.TYPE_GRAY:
array.Add(PdfName.DEVICEGRAY);
func = PdfFunction.Type2(writer, new float[]{0, 1}, null, new float[]{0}, new float[]{((GrayColor)altcs).Gray}, 1);
break;
case ExtendedColor.TYPE_CMYK:
array.Add(PdfName.DEVICECMYK);
CMYKColor cmyk = (CMYKColor)altcs;
func = PdfFunction.Type2(writer, new float[]{0, 1}, null, new float[]{0, 0, 0, 0},
new float[]{cmyk.Cyan, cmyk.Magenta, cmyk.Yellow, cmyk.Black}, 1);
break;
default:
throw new Exception(MessageLocalization.GetComposedMessage("only.rgb.gray.and.cmyk.are.supported.as.alternative.color.spaces"));
}
}
else {
array.Add(PdfName.DEVICERGB);
func = PdfFunction.Type2(writer, new float[]{0, 1}, null, new float[]{1, 1, 1},
new float[]{(float)altcs.R / 255, (float)altcs.G / 255, (float)altcs.B / 255}, 1);
}
array.Add(func.Reference);
return array;
}
示例4: SetSortOrder
/**
* Defines the sort order of the field (ascending or descending).
* @param ascending an array with every element corresponding with a name of a field.
*/
public void SetSortOrder(bool[] ascending) {
PdfObject o = (PdfObject)Get(PdfName.S);
if (o is PdfArray) {
if (((PdfArray)o).Size != ascending.Length) {
throw new InvalidOperationException("The number of booleans in this array doesn't correspond with the number of fields.");
}
PdfArray array = new PdfArray();
for (int i = 0; i < ascending.Length; i++) {
array.Add(new PdfBoolean(ascending[i]));
}
Put(PdfName.A, array);
}
else {
throw new InvalidOperationException("You need a single bool for this collection sort dictionary.");
}
}
示例5: GetPdfObject
public virtual PdfObject GetPdfObject(PdfWriter writer) {
PdfArray array = new PdfArray(PdfName.LAB);
PdfDictionary dictionary = new PdfDictionary();
if (whitePoint == null
|| whitePoint.Length != 3
|| whitePoint[0] < 0.000001f || whitePoint[2] < 0.000001f
|| whitePoint[1] < 0.999999f || whitePoint[1] > 1.000001f)
throw new Exception(MessageLocalization.GetComposedMessage("lab.cs.white.point"));
dictionary.Put(PdfName.WHITEPOINT, new PdfArray(whitePoint));
if (blackPoint != null) {
if (blackPoint.Length != 3
|| blackPoint[0] < -0.000001f || blackPoint[1] < -0.000001f || blackPoint[2] < -0.000001f)
throw new Exception(MessageLocalization.GetComposedMessage("lab.cs.black.point"));
dictionary.Put(PdfName.BLACKPOINT, new PdfArray(blackPoint));
}
if (range != null) {
if (range.Length != 4 || range[0] > range[1] || range[2] > range[3])
throw new Exception(MessageLocalization.GetComposedMessage("lab.cs.range"));
dictionary.Put(PdfName.RANGE, new PdfArray(range));
}
array.Add(dictionary);
return array;
}
示例6: AddDirectImageSimple
/**
* Adds an image to the document but not to the page resources. It is used with
* templates and <CODE>Document.Add(Image)</CODE>.
* @param image the <CODE>Image</CODE> to add
* @param fixedRef the reference to used. It may be <CODE>null</CODE>,
* a <CODE>PdfIndirectReference</CODE> or a <CODE>PRIndirectReference</CODE>.
* @return the name of the image added
* @throws PdfException on error
* @throws DocumentException on error
*/
public PdfName AddDirectImageSimple(Image image, PdfIndirectReference fixedRef) {
PdfName name;
// if the images is already added, just retrieve the name
if (images.ContainsKey(image.MySerialId)) {
name = images[image.MySerialId];
}
// if it's a new image, add it to the document
else {
if (image.IsImgTemplate()) {
name = new PdfName("img" + images.Count);
if (image is ImgWMF){
ImgWMF wmf = (ImgWMF)image;
wmf.ReadWMF(PdfTemplate.CreateTemplate(this, 0, 0));
}
}
else {
PdfIndirectReference dref = image.DirectReference;
if (dref != null) {
PdfName rname = new PdfName("img" + images.Count);
images[image.MySerialId] = rname;
imageDictionary.Put(rname, dref);
return rname;
}
Image maskImage = image.ImageMask;
PdfIndirectReference maskRef = null;
if (maskImage != null) {
PdfName mname = images[maskImage.MySerialId];
maskRef = GetImageReference(mname);
}
PdfImage i = new PdfImage(image, "img" + images.Count, maskRef);
if (image is ImgJBIG2) {
byte[] globals = ((ImgJBIG2) image).GlobalBytes;
if (globals != null) {
PdfDictionary decodeparms = new PdfDictionary();
decodeparms.Put(PdfName.JBIG2GLOBALS, GetReferenceJBIG2Globals(globals));
i.Put(PdfName.DECODEPARMS, decodeparms);
}
}
if (image.HasICCProfile()) {
PdfICCBased icc = new PdfICCBased(image.TagICC, image.CompressionLevel);
PdfIndirectReference iccRef = Add(icc);
PdfArray iccArray = new PdfArray();
iccArray.Add(PdfName.ICCBASED);
iccArray.Add(iccRef);
PdfArray colorspace = i.GetAsArray(PdfName.COLORSPACE);
if (colorspace != null) {
if (colorspace.Size > 1 && PdfName.INDEXED.Equals(colorspace[0]))
colorspace[1] = iccArray;
else
i.Put(PdfName.COLORSPACE, iccArray);
}
else
i.Put(PdfName.COLORSPACE, iccArray);
}
Add(i, fixedRef);
name = i.Name;
}
images[image.MySerialId] = name;
}
return name;
}
示例7: FillOCProperties
protected void FillOCProperties(bool erase) {
if (vOCProperties == null)
vOCProperties = new PdfOCProperties();
if (erase) {
vOCProperties.Remove(PdfName.OCGS);
vOCProperties.Remove(PdfName.D);
}
if (vOCProperties.Get(PdfName.OCGS) == null) {
PdfArray gr = new PdfArray();
foreach (PdfLayer layer in documentOCG.Keys) {
gr.Add(layer.Ref);
}
vOCProperties.Put(PdfName.OCGS, gr);
}
if (vOCProperties.Get(PdfName.D) != null)
return;
List<IPdfOCG> docOrder = new List<IPdfOCG>(documentOCGorder);
for (ListIterator<IPdfOCG> it = new ListIterator<IPdfOCG>(docOrder); it.HasNext();) {
PdfLayer layer = (PdfLayer)it.Next();
if (layer.Parent != null)
it.Remove();
}
PdfArray order = new PdfArray();
foreach (PdfLayer layer in docOrder) {
GetOCGOrder(order, layer);
}
PdfDictionary d = new PdfDictionary();
vOCProperties.Put(PdfName.D, d);
d.Put(PdfName.ORDER, order);
PdfArray grx = new PdfArray();
foreach (PdfLayer layer in documentOCG.Keys) {
if (!layer.On)
grx.Add(layer.Ref);
}
if (grx.Size > 0)
d.Put(PdfName.OFF, grx);
if (OCGRadioGroup.Size > 0)
d.Put(PdfName.RBGROUPS, OCGRadioGroup);
if (OCGLocked.Size > 0)
d.Put(PdfName.LOCKED, OCGLocked);
AddASEvent(PdfName.VIEW, PdfName.ZOOM);
AddASEvent(PdfName.VIEW, PdfName.VIEW);
AddASEvent(PdfName.PRINT, PdfName.PRINT);
AddASEvent(PdfName.EXPORT, PdfName.EXPORT);
d.Put(PdfName.LISTMODE, PdfName.VISIBLEPAGES);
}
示例8: Close
/**
* Signals that the <CODE>Document</CODE> was closed and that no other
* <CODE>Elements</CODE> will be added.
* <P>
* The pages-tree is built and written to the outputstream.
* A Catalog is constructed, as well as an Info-object,
* the referencetable is composed and everything is written
* to the outputstream embedded in a Trailer.
*/
public override void Close() {
if (open) {
if ((currentPageNumber - 1) != pageReferences.Count)
throw new Exception("The page " + pageReferences.Count +
" was requested but the document has only " + (currentPageNumber - 1) + " pages.");
pdf.Close();
AddSharedObjectsToBody();
foreach (IPdfOCG layer in documentOCG.Keys) {
AddToBody(layer.PdfObject, layer.Ref);
}
// add the root to the body
PdfIndirectReference rootRef = root.WritePageTree();
// make the catalog-object and add it to the body
PdfDictionary catalog = GetCatalog(rootRef);
// [C9] if there is XMP data to add: add it
if (xmpMetadata != null) {
PdfStream xmp = new PdfStream(xmpMetadata);
xmp.Put(PdfName.TYPE, PdfName.METADATA);
xmp.Put(PdfName.SUBTYPE, PdfName.XML);
if (crypto != null && !crypto.IsMetadataEncrypted()) {
PdfArray ar = new PdfArray();
ar.Add(PdfName.CRYPT);
xmp.Put(PdfName.FILTER, ar);
}
catalog.Put(PdfName.METADATA, body.Add(xmp).IndirectReference);
}
// [C10] make pdfx conformant
if (IsPdfX()) {
CompleteInfoDictionary(Info);
CompleteExtraCatalog(ExtraCatalog);
}
// [C11] Output Intents
if (extraCatalog != null) {
catalog.MergeDifferent(extraCatalog);
}
WriteOutlines(catalog, false);
// add the Catalog to the body
PdfIndirectObject indirectCatalog = AddToBody(catalog, false);
// add the info-object to the body
PdfIndirectObject infoObj = AddToBody(Info, false);
// [F1] encryption
PdfIndirectReference encryption = null;
PdfObject fileID = null;
body.FlushObjStm();
if (crypto != null) {
PdfIndirectObject encryptionObject = AddToBody(crypto.GetEncryptionDictionary(), false);
encryption = encryptionObject.IndirectReference;
fileID = crypto.FileID;
}
else
fileID = PdfEncryption.CreateInfoId(PdfEncryption.CreateDocumentId());
// write the cross-reference table of the body
body.WriteCrossReferenceTable(os, indirectCatalog.IndirectReference,
infoObj.IndirectReference, encryption, fileID, prevxref);
// make the trailer
// [F2] full compression
if (fullCompression) {
WriteKeyInfo(os);
byte[] tmp = GetISOBytes("startxref\n");
os.Write(tmp, 0, tmp.Length);
tmp = GetISOBytes(body.Offset.ToString());
os.Write(tmp, 0, tmp.Length);
tmp = GetISOBytes("\n%%EOF\n");
os.Write(tmp, 0, tmp.Length);
}
else {
PdfTrailer trailer = new PdfTrailer(body.Size,
body.Offset,
indirectCatalog.IndirectReference,
infoObj.IndirectReference,
encryption,
fileID, prevxref);
trailer.ToPdf(this, os);
}
base.Close();
}
}
示例9: AlterContents
virtual internal protected void AlterContents() {
foreach (PageStamp ps in pagesToContent.Values) {
PdfDictionary pageN = ps.pageN;
MarkUsed(pageN);
PdfArray ar = null;
PdfObject content = PdfReader.GetPdfObject(pageN.Get(PdfName.CONTENTS), pageN);
if (content == null) {
ar = new PdfArray();
pageN.Put(PdfName.CONTENTS, ar);
}
else if (content.IsArray()) {
ar = new PdfArray((PdfArray)content);
pageN.Put(PdfName.CONTENTS, ar);
}
else if (content.IsStream()) {
ar = new PdfArray();
ar.Add(pageN.Get(PdfName.CONTENTS));
pageN.Put(PdfName.CONTENTS, ar);
}
else {
ar = new PdfArray();
pageN.Put(PdfName.CONTENTS, ar);
}
ByteBuffer out_p = new ByteBuffer();
if (ps.under != null) {
out_p.Append(PdfContents.SAVESTATE);
ApplyRotation(pageN, out_p);
out_p.Append(ps.under.InternalBuffer);
out_p.Append(PdfContents.RESTORESTATE);
}
if (ps.over != null)
out_p.Append(PdfContents.SAVESTATE);
PdfStream stream = new PdfStream(out_p.ToByteArray());
stream.FlateCompress(compressionLevel);
ar.AddFirst(AddToBody(stream).IndirectReference);
out_p.Reset();
if (ps.over != null) {
out_p.Append(' ');
out_p.Append(PdfContents.RESTORESTATE);
ByteBuffer buf = ps.over.InternalBuffer;
out_p.Append(buf.Buffer, 0, ps.replacePoint);
out_p.Append(PdfContents.SAVESTATE);
ApplyRotation(pageN, out_p);
out_p.Append(buf.Buffer, ps.replacePoint, buf.Size - ps.replacePoint);
out_p.Append(PdfContents.RESTORESTATE);
stream = new PdfStream(out_p.ToByteArray());
stream.FlateCompress(compressionLevel);
ar.Add(AddToBody(stream).IndirectReference);
}
AlterResources(ps);
}
}
示例10: AddOrder
/**
* Recursive method to reconstruct the documentOCGorder variable in the writer.
* @param parent a parent PdfLayer (can be null)
* @param arr an array possibly containing children for the parent PdfLayer
* @param ocgmap a Hashtable with indirect reference Strings as keys and PdfLayer objects as values.
* @since 2.1.2
*/
private void AddOrder(PdfLayer parent, PdfArray arr, Dictionary<string,PdfLayer> ocgmap) {
PdfObject obj;
PdfLayer layer;
for (int i = 0; i < arr.Size; i++) {
obj = arr[i];
if (obj.IsIndirect()) {
layer = ocgmap[obj.ToString()];
if (layer != null) {
layer.OnPanel = true;
RegisterLayer(layer);
if (parent != null) {
parent.AddChild(layer);
}
if (arr.Size > i + 1 && arr[i + 1].IsArray()) {
i++;
AddOrder(layer, (PdfArray)arr[i], ocgmap);
}
}
}
else if (obj.IsArray()) {
PdfArray sub = (PdfArray)obj;
if (sub.IsEmpty()) return;
obj = sub[0];
if (obj.IsString()) {
layer = new PdfLayer(obj.ToString());
layer.OnPanel = true;
RegisterLayer(layer);
if (parent != null) {
parent.AddChild(layer);
}
PdfArray array = new PdfArray();
for (ListIterator<PdfObject> j = sub.GetListIterator(); j.HasNext(); ) {
array.Add(j.Next());
}
AddOrder(layer, array, ocgmap);
}
else {
AddOrder(parent, (PdfArray)obj, ocgmap);
}
}
}
}
示例11: CreateAcroForms
protected void CreateAcroForms() {
if (fieldTree.Count == 0)
return;
form = new PdfDictionary();
form.Put(PdfName.DR, resources);
Propagate(resources, null, false);
form.Put(PdfName.DA, new PdfString("/Helv 0 Tf 0 g "));
tabOrder = new Dictionary<PdfArray,List<int>>();
calculationOrderRefs = new List<object>();
foreach (string sc in calculationOrder)
calculationOrderRefs.Add(sc);
form.Put(PdfName.FIELDS, BranchForm(fieldTree, null, ""));
if (hasSignature)
form.Put(PdfName.SIGFLAGS, new PdfNumber(3));
PdfArray co = new PdfArray();
for (int k = 0; k < calculationOrderRefs.Count; ++k) {
Object obj = calculationOrderRefs[k];
if (obj is PdfIndirectReference)
co.Add((PdfIndirectReference)obj);
}
if (co.Size > 0)
form.Put(PdfName.CO, co);
}
示例12: BranchForm
protected PdfArray BranchForm(Dictionary<string,object> level, PdfIndirectReference parent, String fname) {
PdfArray arr = new PdfArray();
foreach (KeyValuePair<string,object> entry in level) {
String name = entry.Key;
Object obj = entry.Value;
PdfIndirectReference ind = PdfIndirectReference;
PdfDictionary dic = new PdfDictionary();
if (parent != null)
dic.Put(PdfName.PARENT, parent);
dic.Put(PdfName.T, new PdfString(name, PdfObject.TEXT_UNICODE));
String fname2 = fname + "." + name;
int coidx = calculationOrder.IndexOf(fname2);
if (coidx >= 0)
calculationOrderRefs[coidx] = ind;
if (obj is Dictionary<string,object>) {
dic.Put(PdfName.KIDS, BranchForm((Dictionary<string,object>)obj, ind, fname2));
arr.Add(ind);
AddToBody(dic, ind);
}
else {
List<object> list = (List<object>)obj;
dic.MergeDifferent((PdfDictionary)list[0]);
if (list.Count == 3) {
dic.MergeDifferent((PdfDictionary)list[2]);
int page = (int)list[1];
PdfDictionary pageDic = pageDics[page - 1];
PdfArray annots = pageDic.GetAsArray(PdfName.ANNOTS);
if (annots == null) {
annots = new PdfArray();
pageDic.Put(PdfName.ANNOTS, annots);
}
PdfNumber nn = (PdfNumber)dic.Get(iTextTag);
dic.Remove(iTextTag);
AdjustTabOrder(annots, ind, nn);
}
else {
PdfArray kids = new PdfArray();
for (int k = 1; k < list.Count; k += 2) {
int page = (int)list[k];
PdfDictionary pageDic = pageDics[page - 1];
PdfArray annots = pageDic.GetAsArray(PdfName.ANNOTS);
if (annots == null) {
annots = new PdfArray();
pageDic.Put(PdfName.ANNOTS, annots);
}
PdfDictionary widget = new PdfDictionary();
widget.Merge((PdfDictionary)list[k + 1]);
widget.Put(PdfName.PARENT, ind);
PdfNumber nn = (PdfNumber)widget.Get(iTextTag);
widget.Remove(iTextTag);
PdfIndirectReference wref = AddToBody(widget).IndirectReference;
AdjustTabOrder(annots, wref, nn);
kids.Add(wref);
Propagate(widget, null, false);
}
dic.Put(PdfName.KIDS, kids);
}
arr.Add(ind);
AddToBody(dic, ind);
Propagate(dic, null, false);
}
}
return arr;
}
示例13: AdjustTabOrder
private void AdjustTabOrder(PdfArray annots, PdfIndirectReference ind, PdfNumber nn) {
int v = nn.IntValue;
List<int> t;
if (!tabOrder.TryGetValue(annots, out t)) {
t = new List<int>();
int size = annots.Size - 1;
for (int k = 0; k < size; ++k) {
t.Add(zero);
}
t.Add(v);
tabOrder[annots] = t;
annots.Add(ind);
}
else {
int size = t.Count - 1;
for (int k = size; k >= 0; --k) {
if (t[k] <= v) {
t.Insert(k + 1, v);
annots.Add(k + 1, ind);
size = -2;
break;
}
}
if (size != -2) {
t.Insert(0, v);
annots.Add(0, ind);
}
}
}
示例14: ToPdf
/**
* @see com.lowagie.text.pdf.PdfDictionary#toPdf(com.lowagie.text.pdf.PdfWriter, java.io.OutputStream)
*/
public override void ToPdf(PdfWriter writer, Stream os)
{
if (inputStream != null && compressed)
Put(PdfName.FILTER, PdfName.FLATEDECODE);
PdfEncryption crypto = null;
if (writer != null)
crypto = writer.Encryption;
if (crypto != null) {
PdfObject filter = Get(PdfName.FILTER);
if (filter != null) {
if (PdfName.CRYPT.Equals(filter))
crypto = null;
else if (filter.IsArray()) {
PdfArray a = (PdfArray)filter;
if (!a.IsEmpty() && PdfName.CRYPT.Equals(a[0]))
crypto = null;
}
}
}
if (crypto != null && crypto.IsEmbeddedFilesOnly()) {
PdfArray filter = new PdfArray();
PdfArray decodeparms = new PdfArray();
PdfDictionary crypt = new PdfDictionary();
crypt.Put(PdfName.NAME, PdfName.STDCF);
filter.Add(PdfName.CRYPT);
decodeparms.Add(crypt);
if (compressed) {
filter.Add(PdfName.FLATEDECODE);
decodeparms.Add(new PdfNull());
}
Put(PdfName.FILTER, filter);
Put(PdfName.DECODEPARMS, decodeparms);
}
PdfObject nn = Get(PdfName.LENGTH);
if (crypto != null && nn != null && nn.IsNumber()) {
int sz = ((PdfNumber)nn).IntValue;
Put(PdfName.LENGTH, new PdfNumber(crypto.CalculateStreamSize(sz)));
SuperToPdf(writer, os);
Put(PdfName.LENGTH, nn);
}
else
SuperToPdf(writer, os);
os.Write(STARTSTREAM, 0, STARTSTREAM.Length);
if (inputStream != null) {
rawLength = 0;
ZDeflaterOutputStream def = null;
OutputStreamCounter osc = new OutputStreamCounter(os);
OutputStreamEncryption ose = null;
Stream fout = osc;
if (crypto != null)
fout = ose = crypto.GetEncryptionStream(fout);
if (compressed)
fout = def = new ZDeflaterOutputStream(fout, compressionLevel);
byte[] buf = new byte[4192];
while (true) {
int n = inputStream.Read(buf, 0, buf.Length);
if (n <= 0)
break;
fout.Write(buf, 0, n);
rawLength += n;
}
if (def != null)
def.Finish();
if (ose != null)
ose.Finish();
inputStreamLength = osc.Counter;
}
else {
if (crypto == null) {
if (streamBytes != null)
streamBytes.WriteTo(os);
else
os.Write(bytes, 0, bytes.Length);
}
else {
byte[] b;
if (streamBytes != null) {
b = crypto.EncryptByteArray(streamBytes.ToArray());
}
else {
b = crypto.EncryptByteArray(bytes);
}
os.Write(b, 0, b.Length);
}
}
os.Write(ENDSTREAM, 0, ENDSTREAM.Length);
}
示例15: GetFontBaseType
/** Generates the font dictionary for this font.
* @return the PdfDictionary containing the font dictionary
* @param subsetPrefix the subset prefx
* @param firstChar the first valid character
* @param lastChar the last valid character
* @param shortTag a 256 bytes long <CODE>byte</CODE> array where each unused byte is represented by 0
* @param fontDescriptor the indirect reference to a PdfDictionary containing the font descriptor or <CODE>null</CODE>
* @throws DocumentException if there is an error
*/
protected PdfDictionary GetFontBaseType(PdfIndirectReference fontDescriptor, string subsetPrefix, int firstChar, int lastChar, byte[] shortTag)
{
PdfDictionary dic = new PdfDictionary(PdfName.FONT);
if (cff) {
dic.Put(PdfName.SUBTYPE, PdfName.TYPE1);
dic.Put(PdfName.BASEFONT, new PdfName(fontName + style));
}
else {
dic.Put(PdfName.SUBTYPE, PdfName.TRUETYPE);
dic.Put(PdfName.BASEFONT, new PdfName(subsetPrefix + fontName + style));
}
dic.Put(PdfName.BASEFONT, new PdfName(subsetPrefix + fontName + style));
if (!fontSpecific) {
for (int k = firstChar; k <= lastChar; ++k) {
if (!differences[k].Equals(notdef)) {
firstChar = k;
break;
}
}
if (encoding.Equals(CP1252) || encoding.Equals(MACROMAN))
dic.Put(PdfName.ENCODING, encoding.Equals(CP1252) ? PdfName.WIN_ANSI_ENCODING : PdfName.MAC_ROMAN_ENCODING);
else {
PdfDictionary enc = new PdfDictionary(PdfName.ENCODING);
PdfArray dif = new PdfArray();
bool gap = true;
for (int k = firstChar; k <= lastChar; ++k) {
if (shortTag[k] != 0) {
if (gap) {
dif.Add(new PdfNumber(k));
gap = false;
}
dif.Add(new PdfName(differences[k]));
}
else
gap = true;
}
enc.Put(PdfName.DIFFERENCES, dif);
dic.Put(PdfName.ENCODING, enc);
}
}
dic.Put(PdfName.FIRSTCHAR, new PdfNumber(firstChar));
dic.Put(PdfName.LASTCHAR, new PdfNumber(lastChar));
PdfArray wd = new PdfArray();
for (int k = firstChar; k <= lastChar; ++k) {
if (shortTag[k] == 0)
wd.Add(new PdfNumber(0));
else
wd.Add(new PdfNumber(widths[k]));
}
dic.Put(PdfName.WIDTHS, wd);
if (fontDescriptor != null)
dic.Put(PdfName.FONTDESCRIPTOR, fontDescriptor);
return dic;
}