示例#1
0
        /// <summary>
        /// Add Image Resources to the pdf page
        /// </summary>
        internal void AddResource(PdfImageEntry ie, int contentRef)
        {
            if (imageRef == null || imageRef.IndexOf("/" + ie.name) < 0)                // only need it once per page
//				imageRef+=string.Format("/XObject << /{0} {1} 0 R >>",ie.name,ie.objectNum);
            {
                imageRef += string.Format("/{0} {1} 0 R ", ie.name, ie.objectNum);
            }
            if (contentRef > 0)
            {
                contents = string.Format("/Contents {0} 0 R", contentRef);
            }
        }
示例#2
0
        internal string GetPdfImage(PdfPage p, string imgname, int contentRef, ImageFormat imf, byte[] ba, int width, int height)
        {
            PdfImageEntry ie;

            if (imgname != null)
            {
                ie = (PdfImageEntry)images[imgname];
                if (ie != null)
                {
                    p.AddResource(ie, contentRef);
                    return(ie.name);
                }
            }
            else
            {
                imgname = "I" + (images.Count + 1).ToString();
            }
            ie = new PdfImageEntry(pa, p, contentRef, imgname, imf, ba, width, height);
            images.Add(imgname, ie);
            return(ie.name);
        }