Exemple #1
1
        /// <summary>
        /// Gets a PdfImage from an XImage. If no PdfImage already exists, a new one is created.
        /// </summary>
        public PdfImage GetImage(XImage image)
        {
            ImageSelector selector = image.selector;

            if (selector == null)
            {
                selector       = new ImageSelector(image);
                image.selector = selector;
            }
            PdfImage pdfImage;

            if (!images.TryGetValue(selector, out pdfImage))
            {
                pdfImage = new PdfImage(owner, image);
                //pdfImage.Document = this.document;
                Debug.Assert(pdfImage.Owner == owner);
                images[selector] = pdfImage;
                //if (this.document.EarlyWrite)
                //{
                //  //pdfFont.Close(); delete
                //  //pdfFont.AssignObjID(ref this.document.ObjectID); // BUG just test code!!!!
                //  //pdfFont.WriteObject(null);
                //}
            }
            return(pdfImage);
        }
        /// <summary>
        /// Gets the resource name of the specified image within this dictionary.
        /// </summary>
        internal string GetImageName(XImage image)
        {
            PdfImage pdfImage = _document.ImageTable.GetImage(image);

            Debug.Assert(pdfImage != null);
            string name = Resources.AddImage(pdfImage);

            return(name);
        }
 /// <summary>
 /// Adds the specified image to this resource dictionary
 /// and returns its local resource name.
 /// </summary>
 public string AddImage(PdfImage image)
 {
   string name;
   if (!this.resources.TryGetValue(image, out name))
   {
     name = NextImageName;
     this.resources[image] = name;
     if (image.Reference == null)
       Owner.irefTable.Add(image);
     XObjects.Elements[name] = image.Reference;
   }
   return name;
 }
 /// <summary>
 /// Adds the specified image to this resource dictionary
 /// and returns its local resource name.
 /// </summary>
 public string AddImage(PdfImage image)
 {
   string name = (string)this.resources[image];
   if (name == null)
   {
     name = NextImageName;
     this.resources[image] = name;
     if (image.Reference == null)
       this.Owner.irefTable.Add(image);
     XObjects.Elements[name] = image.Reference;
   }
   return name;
 }
Exemple #5
0
        /// <summary>
        /// Adds the specified image to this resource dictionary
        /// and returns its local resource name.
        /// </summary>
        public string AddImage(PdfImage image)
        {
            string name;

            if (!_resources.TryGetValue(image, out name))
            {
                name = NextImageName;
                _resources[image] = name;
                if (image.Reference == null)
                {
                    Owner._irefTable.Add(image);
                }
                XObjects.Elements[name] = image.Reference;
            }
            return(name);
        }
Exemple #6
0
        /// <summary>
        /// Gets a PdfImage from an XImage. If no PdfImage already exists, a new one is created.
        /// </summary>
        public PdfImage GetImage(XImage image)
        {
            ImageSelector selector = image._selector;
            if (selector == null)
            {
                selector = new ImageSelector(image);
                image._selector = selector;
            }
            PdfImage pdfImage;
            if (!_images.TryGetValue(selector, out pdfImage))
            {
                pdfImage = new PdfImage(Owner, image);
                //pdfImage.Document = _document;
                Debug.Assert(pdfImage.Owner == Owner);
                _images[selector] = pdfImage;
 }
            return pdfImage;
        }
Exemple #7
0
        /// <summary>
        /// Gets a PdfImage from an XImage. If no PdfImage already exists, a new one is created.
        /// </summary>
        public PdfImage GetImage(XImage image)
        {
            ImageSelector selector = image._selector;

            if (selector == null)
            {
                selector        = new ImageSelector(image);
                image._selector = selector;
            }
            PdfImage pdfImage;

            if (!_images.TryGetValue(selector, out pdfImage))
            {
                pdfImage = new PdfImage(Owner, image);
                //pdfImage.Document = _document;
                Debug.Assert(pdfImage.Owner == Owner);
                _images[selector] = pdfImage;
            }
            return(pdfImage);
        }
 /// <summary>
 /// Gets a PdfImage from an XImage. If no PdfImage already exists, a new one is created.
 /// </summary>
 public PdfImage GetImage(XImage image)
 {
   PdfImageTable.ImageSelector selector = image.selector;
   if (selector == null)
   {
     selector = new ImageSelector(image);
     image.selector = selector;
   }
   PdfImage pdfImage;
   if (!this.images.TryGetValue(selector, out pdfImage))
   {
     pdfImage = new PdfImage(this.owner, image);
     //pdfImage.Document = this.document;
     Debug.Assert(pdfImage.Owner == this.owner);
     this.images[selector] = pdfImage;
     //if (this.document.EarlyWrite)
     //{
     //  //pdfFont.Close(); delete 
     //  //pdfFont.AssignObjID(ref this.document.ObjectID); // BUG just test code!!!!
     //  //pdfFont.WriteObject(null);
     //}
   }
   return pdfImage;
 }