Ejemplo n.º 1
0
        /// <summary>
        /// Add image to the page.  Adds a new XObject Image and a reference to it.
        /// </summary>
        /// <returns>string Image name</returns>
        public string AddImage(PdfImages images, string name, int contentRef, StyleInfo si,
                               ImageFormat imf, float x, float y, float width, float height, RectangleF clipRect,
                               byte[] im, int samplesW, int samplesH, string url, string tooltip)
        {
            //MITEK:START----------------------------------
            //Duc Phan added 20 Dec, 2007 clip image
            if (!clipRect.IsEmpty)
            {
                elements.AppendFormat(NumberFormatInfo.InvariantInfo,
                                      "\r\nq\t{0} {1} {2} {3} re W n",
                                      clipRect.X + pSize.leftMargin, pSize.yHeight - clipRect.Y - clipRect.Height - pSize.topMargin, clipRect.Width, clipRect.Height);
            }
            //MITEK:END----------------------------------

            string imgname = images.GetPdfImage(this.p, name, contentRef, imf, im, samplesW, samplesH);

            elements.AppendFormat(NumberFormatInfo.InvariantInfo,
                                  "\r\nq\t{2} 0 0 {3} {0} {1} cm\t",
                                  x, pSize.yHeight - y - height, width, height);              // push graphics state, positioning

            elements.AppendFormat(NumberFormatInfo.InvariantInfo, "\t/{0} Do\tQ\t", imgname); // do the image then pop graphics state
            //MITEK:START----------------------------------

            //Duc Phan added 20 Dec, 2007 clip image
            if (!clipRect.IsEmpty)
            {
                elements.AppendFormat("\tQ\t");   //pop graphics state
            }

            //MITEK:END----------------------------------


            if (url != null)
            {
//				p.AddHyperlink(x, pSize.yHeight-y, height, width, url);
                p.AddHyperlink(x + pSize.leftMargin,
                               pSize.yHeight - y - pSize.topMargin,
                               height, width, url);// Duc Phan modified 4 Sep, 2007 to account for the page margin
            }
            if (tooltip != null)
            {
                p.AddToolTip(x + pSize.leftMargin,
                             pSize.yHeight - y - pSize.topMargin,
                             height, width, tooltip);
            }


            // Border goes around the image padding
            AddBorder(si, x - si.PaddingLeft, y - si.PaddingTop,
                      height + si.PaddingTop + si.PaddingBottom,
                      width + si.PaddingLeft + si.PaddingRight);                // add any required border

            return(imgname);
        }
Ejemplo n.º 2
0
		/// <summary>
		/// Add image to the page.  Adds a new XObject Image and a reference to it.
		/// </summary>
		/// <returns>string Image name</returns>
		public string AddImage(PdfImages images, string name, int contentRef, StyleInfo si,
            ImageFormat imf, float x, float y, float width, float height, RectangleF clipRect,
			byte[] im, int samplesW, int samplesH, string url,string tooltip)
		{
            //MITEK:START---------------------------------- 
            //Duc Phan added 20 Dec, 2007 clip image 
            if (!clipRect.IsEmpty)
            {
                elements.AppendFormat(NumberFormatInfo.InvariantInfo,
                                      "\r\nq\t{0} {1} {2} {3} re W n",
                                      clipRect.X + pSize.leftMargin, pSize.yHeight - clipRect.Y - clipRect.Height - pSize.topMargin, clipRect.Width, clipRect.Height);
            }
            //MITEK:END---------------------------------- 
            
            string imgname = images.GetPdfImage(this.p, name, contentRef, imf, im, samplesW, samplesH);
			
			elements.AppendFormat(NumberFormatInfo.InvariantInfo,
				"\r\nq\t{2} 0 0 {3} {0} {1} cm\t",
				x, pSize.yHeight-y-height, width, height);	// push graphics state, positioning

			elements.AppendFormat(NumberFormatInfo.InvariantInfo, "\t/{0} Do\tQ\t", imgname);	// do the image then pop graphics state
            //MITEK:START---------------------------------- 

            //Duc Phan added 20 Dec, 2007 clip image 
            if (!clipRect.IsEmpty)
            {
                elements.AppendFormat("\tQ\t");   //pop graphics state 
            }

            //MITEK:END---------------------------------- 


			if (url != null)
//				p.AddHyperlink(x, pSize.yHeight-y, height, width, url);
                p.AddHyperlink(x + pSize.leftMargin, 
                               pSize.yHeight - y - pSize.topMargin, 
                               height, width, url);// Duc Phan modified 4 Sep, 2007 to account for the page margin 

            if(tooltip != null)
                p.AddToolTip(x + pSize.leftMargin,
                              pSize.yHeight - y - pSize.topMargin,
                              height, width, tooltip);


            // Border goes around the image padding
			AddBorder(si, x-si.PaddingLeft, y-si.PaddingTop, 
                height + si.PaddingTop+ si.PaddingBottom, 
                width + si.PaddingLeft + si.PaddingRight);			// add any required border

			return imgname;
		}