示例#1
0
        //public PDFImageXObject GetImage(string path)
        //{
        //    foreach (PDFResource resx in this.Items)
        //    {
        //        if (resx.Type == PDFObjectTypes.ImageXObject)
        //        {
        //            PDFImageXObject xobj = resx as PDFImageXObject;
        //            if (string.Equals(xobj.Source, path, StringComparison.OrdinalIgnoreCase))
        //                return xobj;
        //        }
        //    }
        //    return null;

        //}

        //public PDFFontResource GetFont(Scryber.Drawing.PDFFont font)
        //{
        //    foreach (PDFResource resx in this.Items)
        //    {
        //        if (resx.Type == PDFObjectTypes.FontResource)
        //        {
        //            PDFFontResource f = (PDFFontResource)resx;
        //            if (font != null && f.Equals(font))
        //                return f;

        //        }
        //    }
        //    return null;
        //}


        public PDFResource Add(PDFResource resource)
        {
            foreach (PDFResource resx in this.Items)
            {
                if (resx.Equals(resource))
                {
                    return(resx);
                }
            }
            this.Items.Add(resource);
            return(resource);
        }
示例#2
0
        public void EnsureInList(PDFResource rsrc)
        {
            PDFResourceItemList items;

            if (this.types.Contains(rsrc.ResourceType) == false)
            {
                items = new PDFResourceItemList(rsrc.ResourceType);
                this.types.Add(items);
            }
            else
            {
                items = this.types[rsrc.ResourceType];
            }

            if (items.Contains(rsrc.Name) == false)
            {
                items.Add(rsrc);
            }
        }
        PDFName Register(PDFResource rsrc)
        {
            if (null == rsrc.Name || string.IsNullOrEmpty(rsrc.Name.Value))
            {
                string name = this.Document.GetIncrementID(rsrc.Type);
                rsrc.Name = (PDFName)name;
            }
            if (this.Container is IPDFComponent)
            {
                rsrc.RegisterUse(this.Resources, (IPDFComponent)this.Container);
            }
            else
            {
                rsrc.RegisterUse(this.Resources, this.Document);
            }
            //    throw new InvalidCastException(string.Format(Errors.CouldNotCastObjectToType, "IPDFComponent", this.Container.GetType()));

            return(rsrc.Name);
        }
示例#4
0
 protected virtual PDFName DoRegisterResource(Scryber.Resources.PDFResource rsrc)
 {
     return(this.PageOwner.Register(rsrc));
 }
示例#5
0
 PDFName IPDFResourceContainer.Register(Scryber.Resources.PDFResource rsrc)
 {
     return(this.DoRegisterResource(rsrc));
 }
 PDFName IPDFResourceContainer.Register(PDFResource rsrc)
 {
     return(this.Register(rsrc));
 }