本文整理汇总了C#中PdfArray类的典型用法代码示例。如果您正苦于以下问题:C# PdfArray类的具体用法?C# PdfArray怎么用?C# PdfArray使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PdfArray类属于命名空间,在下文中一共展示了PdfArray类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PdfType0Font
public PdfType0Font(PdfDocument document, XFont font, bool vertical)
: base(document)
{
Elements.SetName(Keys.Type, "/Font");
Elements.SetName(Keys.Subtype, "/Type0");
Elements.SetName(Keys.Encoding, vertical ? "/Identity-V" : "/Identity-H");
OpenTypeDescriptor ttDescriptor = (OpenTypeDescriptor)FontDescriptorCache.GetOrCreateDescriptorFor(font);
FontDescriptor = new PdfFontDescriptor(document, ttDescriptor);
_fontOptions = font.PdfOptions;
Debug.Assert(_fontOptions != null);
_cmapInfo = new CMapInfo(ttDescriptor);
_descendantFont = new PdfCIDFont(document, FontDescriptor, font);
_descendantFont.CMapInfo = _cmapInfo;
// Create ToUnicode map
_toUnicode = new PdfToUnicodeMap(document, _cmapInfo);
document.Internals.AddObject(_toUnicode);
Elements.Add(Keys.ToUnicode, _toUnicode);
BaseFont = font.GlyphTypeface.GetBaseName();
// CID fonts are always embedded
BaseFont = PdfFont.CreateEmbeddedFontSubsetName(BaseFont);
FontDescriptor.FontName = BaseFont;
_descendantFont.BaseFont = BaseFont;
PdfArray descendantFonts = new PdfArray(document);
Owner._irefTable.Add(_descendantFont);
descendantFonts.Elements.Add(_descendantFont.Reference);
Elements[Keys.DescendantFonts] = descendantFonts;
}
示例2: PdfPageTree
public PdfPageTree(PdfObjectId objectId)
: base(objectId)
{
this[PdfName.Names.Type] = PdfName.Names.Pages;
this.kids = new PdfArray();
this[PdfName.Names.Kids] = kids;
}
示例3: ArrowAnnotation
/// <summary>
/// Initializes a new instance of the <see cref="ArrowAnnotation"/> class.
/// </summary>
/// <param name="color">The arrow color.</param>
/// <param name="x1">The x1.</param>
/// <param name="y1">The y1.</param>
/// <param name="x2">The x2.</param>
/// <param name="y2">The y2.</param>
public ArrowAnnotation(XColor color, float x1, float y1, float x2, float y2)
{
Elements.SetName(Keys.Subtype, "/Line");
var line = new PdfArray();
line.Elements.Add(new PdfReal(x1));
line.Elements.Add(new PdfReal(y1));
line.Elements.Add(new PdfReal(x2));
line.Elements.Add(new PdfReal(y2));
Elements["/L"] = line;
// change line ending
PdfArray end = new PdfArray();
end.Elements.Add(new PdfName("/ClosedArrow"));
end.Elements.Add(new PdfName("/None"));
Elements["/LE"] = end;
// change all color properties
Elements.SetColor("/IC", color);
Color = color;
// change line width
var bsDict = new PdfBorderStyle(3, BorderStyle.Solid);
Elements[Keys.BS] = bsDict;
}
示例4: Get
/**
<summary>Gets the color corresponding to the specified components.</summary>
<param name="components">Color components to convert.</param>
*/
public static DeviceNColor Get(
PdfArray components
)
{
return (components != null
? new DeviceNColor(components)
: null
);
}
示例5: PdfResources
static PdfResources()
{
DefaultProcedureSets = new PdfArray();
DefaultProcedureSets.Add(PdfName.Names.PDF);
DefaultProcedureSets.Add(PdfName.Names.Text);
DefaultProcedureSets.Add(PdfName.Names.ImageB);
DefaultProcedureSets.Add(PdfName.Names.ImageC);
DefaultProcedureSets.Add(PdfName.Names.ImageI);
}
示例6: PdfGoToRemote
static PdfGoToRemote()
{
DefaultDestination = new PdfArray();
DefaultDestination.Add(new PdfNumeric(0));
DefaultDestination.Add(PdfName.Names.XYZ);
DefaultDestination.Add(PdfNull.Null);
DefaultDestination.Add(PdfNull.Null);
DefaultDestination.Add(PdfNull.Null);
}
示例7: Write
protected internal override void Write(PdfWriter writer)
{
PdfArray dest = new PdfArray();
dest.Add(pageReference);
dest.Add(PdfName.Names.XYZ);
dest.Add(new PdfNumeric(xPosition));
dest.Add(new PdfNumeric(yPosition));
dest.Add(PdfNull.Null);
this[PdfName.Names.D] = dest;
base.Write(writer);
}
示例8: Visit
public virtual PdfObject Visit(
PdfArray obj,
object data
)
{
foreach(PdfDirectObject item in obj)
{
if(item != null)
{item.Accept(this, data);}
}
return obj;
}
示例9: CleverPdfArrayClone
private PdfObject CleverPdfArrayClone(PdfArray array) {
PdfArray newArray = new PdfArray();
for (int i = 0; i < array.Size; i++) {
PdfObject obj = array[i];
if (obj is PdfDictionary)
newArray.Add(CleverPdfDictionaryClone((PdfDictionary) obj));
else
newArray.Add(obj);
}
return newArray;
}
示例10: Get
/**
<summary>Gets the color corresponding to the specified components.</summary>
<param name="components">Color components to convert.</param>
*/
public static DeviceColor Get(
PdfArray components
)
{
if(components == null)
return null;
switch(components.Count)
{
case 1:
return DeviceGrayColor.Get(components);
case 3:
return DeviceRGBColor.Get(components);
case 4:
return DeviceCMYKColor.Get(components);
default:
return null;
}
}
示例11: PdfPage
public PdfPage(
PdfResources resources,
PdfContentStream contents,
int pagewidth,
int pageheight,
PdfObjectId objectId)
: base(objectId)
{
this[PdfName.Names.Type] = PdfName.Names.Page;
this[PdfName.Names.Resources] = resources.GetReference();
this[PdfName.Names.Contents] = contents.GetReference();
PdfArray mediaBox = new PdfArray();
mediaBox.Add(new PdfNumeric(0));
mediaBox.Add(new PdfNumeric(0));
mediaBox.Add(new PdfNumeric(pagewidth));
mediaBox.Add(new PdfNumeric(pageheight));
this[PdfName.Names.MediaBox] = mediaBox;
}
示例12: FreeTextAnnotation
/// <summary>
/// Initializes a new instance of the <see cref="FreeTextAnnotation"/> class.
/// </summary>
/// <param name="color">The text color.</param>
/// <param name="font">The font name.</param>
/// <param name="fontSize">Size of the font.</param>
public FreeTextAnnotation(XColor color, string font, double fontSize)
{
Elements.SetName(Keys.Subtype, "/FreeText");
string daString = string.Format(CultureInfo.InvariantCulture,
"{0} {1} {2} rg /{3} {4} Tf /BG []",
color.R / (double)byte.MaxValue,
color.G / (double)byte.MaxValue,
color.B / (double)byte.MaxValue,
font, fontSize);
Elements["/DA"] = new PdfString(daString);
// no border
var border = new PdfArray();
border.Elements.Add(new PdfInteger(0));
border.Elements.Add(new PdfInteger(0));
border.Elements.Add(new PdfInteger(0));
Elements[Keys.Border] = border;
}
示例13: SetMatrix
public void SetMatrix(float a, float b, float c, float d, float e, float f) {
matrix = new PdfArray();
matrix.Add(new PdfNumber(a));
matrix.Add(new PdfNumber(b));
matrix.Add(new PdfNumber(c));
matrix.Add(new PdfNumber(d));
matrix.Add(new PdfNumber(e));
matrix.Add(new PdfNumber(f));
}
示例14: FieldLock
/** Creates a FieldLock instance */
public FieldLock(PdfName action, PdfArray fields) {
this.action = action;
this.fields = fields;
}
示例15: OutputDss
private void OutputDss(PdfDictionary dss, PdfDictionary vrim, PdfArray ocsps, PdfArray crls, PdfArray certs) {
writer.AddDeveloperExtension(PdfDeveloperExtension.ESIC_1_7_EXTENSIONLEVEL5);
PdfDictionary catalog = reader.Catalog;
stp.MarkUsed(catalog);
foreach (PdfName vkey in validated.Keys) {
PdfArray ocsp = new PdfArray();
PdfArray crl = new PdfArray();
PdfArray cert = new PdfArray();
PdfDictionary vri = new PdfDictionary();
foreach (byte[] b in validated[vkey].crls) {
PdfStream ps = new PdfStream(b);
ps.FlateCompress();
PdfIndirectReference iref = writer.AddToBody(ps, false).IndirectReference;
crl.Add(iref);
crls.Add(iref);
}
foreach (byte[] b in validated[vkey].ocsps) {
PdfStream ps = new PdfStream(b);
ps.FlateCompress();
PdfIndirectReference iref = writer.AddToBody(ps, false).IndirectReference;
ocsp.Add(iref);
ocsps.Add(iref);
}
foreach (byte[] b in validated[vkey].certs) {
PdfStream ps = new PdfStream(b);
ps.FlateCompress();
PdfIndirectReference iref = writer.AddToBody(ps, false).IndirectReference;
cert.Add(iref);
certs.Add(iref);
}
if (ocsp.Size > 0)
vri.Put(PdfName.OCSP, writer.AddToBody(ocsp, false).IndirectReference);
if (crl.Size > 0)
vri.Put(PdfName.CRL, writer.AddToBody(crl, false).IndirectReference);
if (cert.Size > 0)
vri.Put(PdfName.CERT, writer.AddToBody(cert, false).IndirectReference);
vrim.Put(vkey, writer.AddToBody(vri, false).IndirectReference);
}
dss.Put(PdfName.VRI, writer.AddToBody(vrim, false).IndirectReference);
if (ocsps.Size > 0)
dss.Put(PdfName.OCSPS, writer.AddToBody(ocsps, false).IndirectReference);
if (crls.Size > 0)
dss.Put(PdfName.CRLS, writer.AddToBody(crls, false).IndirectReference);
if (certs.Size > 0)
dss.Put(PdfName.CERTS, writer.AddToBody(certs, false).IndirectReference);
catalog.Put(PdfName.DSS, writer.AddToBody(dss, false).IndirectReference);
}