Esempio 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);
        }
        public void Start()
        {
            // Create the anchor for all pdf objects
            CompressionConfig cc = RdlEngineConfig.GetCompression();

            anchor = new PdfAnchor(cc != null);

            //Create a PdfCatalog
            string lang;

            if (r.ReportDefinition.Language != null)
            {
                lang = r.ReportDefinition.Language.EvaluateString(this.r, null);
            }
            else
            {
                lang = null;
            }
            catalog = new PdfCatalog(anchor, lang);

            //Create a Page Tree Dictionary
            pageTree = new PdfPageTree(anchor);

            //Create a Font Dictionary
            fonts = new PdfFonts(anchor);

            //Create a Pattern Dictionary
            patterns = new PdfPattern(anchor);

            //Create an Image Dictionary
            images = new PdfImages(anchor);

            //Create an Outline Dictionary
            outline = new PdfOutline(anchor);

            //Create the info Dictionary
            info = new PdfInfo(anchor);

            //Set the info Dictionary.
            info.SetInfo(r.Name, r.Author, r.Description, "");          // title, author, subject, company

            //Create a utility object
            pdfUtility = new PdfUtility(anchor);

            //write out the header
            int size = 0;

            tw.Write(pdfUtility.GetHeader("1.5", out size), 0, size);
            filesize = size;
        }
		public void Start()		
		{
			// Create the anchor for all pdf objects
			CompressionConfig cc = RdlEngineConfig.GetCompression();
			anchor = new PdfAnchor(cc != null);

			//Create a PdfCatalog
			string lang;
			if (r.ReportDefinition.Language != null)
				lang = r.ReportDefinition.Language.EvaluateString(this.r, null);
			else
				lang = null;
			catalog= new PdfCatalog(anchor, lang);

			//Create a Page Tree Dictionary
			pageTree= new PdfPageTree(anchor);

			//Create a Font Dictionary
			fonts = new PdfFonts(anchor);

            //Create a Pattern Dictionary
            patterns = new PdfPattern(anchor);

			//Create an Image Dictionary
			images = new PdfImages(anchor);

            //Create an Outline Dictionary
            outline = new PdfOutline(anchor);

            //Create the info Dictionary
			info=new PdfInfo(anchor);

			//Set the info Dictionary. 
			info.SetInfo(r.Name,r.Author,r.Description,"");	// title, author, subject, company

			//Create a utility object
			pdfUtility=new PdfUtility(anchor);

			//write out the header
			int size=0;
			tw.Write(pdfUtility.GetHeader("1.5",out size),0,size);
            filesize = size;
		}
		/// <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;
		}