當前位置: 首頁>>代碼示例>>C#>>正文


C# Report.RunRenderPdf方法代碼示例

本文整理匯總了C#中fyiReporting.RDL.Report.RunRenderPdf方法的典型用法代碼示例。如果您正苦於以下問題:C# Report.RunRenderPdf方法的具體用法?C# Report.RunRenderPdf怎麽用?C# Report.RunRenderPdf使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在fyiReporting.RDL.Report的用法示例。


在下文中一共展示了Report.RunRenderPdf方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: SaveAsPdf


//.........這裏部分代碼省略.........
            float w = 0;		// width position of image
            string fname=null;
            int index = _StampInfo.LastIndexOf('?');
            bool bClip=false;	// we force clip if either height or width not specified

            if (index >= 0)
            {
                // Get all the arguments for sizing the image
                ListDictionary ld = this.GetParameters(_StampInfo.Substring(index+1));
                fname = _StampInfo.Substring(0, index);
                string ws = (string)ld["x"];
                x = Size(ws);
                ws = (string)ld["y"];
                y = Size(ws);
                ws = (string)ld["h"];
                if (ws == null)
                {
                    bClip = true;
                    ws = "12in";	// just give it a big value
                }
                h = Size(ws);
                ws = (string)ld["w"];
                if (ws == null)
                {
                    bClip = true;
                    ws = "12in";	// just give it a big value
                }
                w = Size(ws);
            }
            else
            {
                fname = _StampInfo;
                // force size
                bClip = true;
                h = Size("12in");
                w = Size("12in");
            }

            // Stamp the first page
            foreach (Page p in pgs)		// we loop then break after obtaining one
            {
                try
                {
                    strm = new FileStream(fname, System.IO.FileMode.Open, FileAccess.Read);
                    im = System.Drawing.Image.FromStream(strm);
                    int height = im.Height;
                    int width = im.Width;
                    MemoryStream ostrm = new MemoryStream();

                    /* Replaced with high quality JPEG encoder
                      * 06122007AJM */
             					ImageFormat imf = ImageFormat.Jpeg;
             					//im.Save(ostrm, imf);
                    System.Drawing.Imaging.ImageCodecInfo[] info;
                    info = ImageCodecInfo.GetImageEncoders();
                    EncoderParameters encoderParameters;
                    encoderParameters = new EncoderParameters(1);
                    encoderParameters.Param[0] = new EncoderParameter(Encoder.Quality, 100L);
                    System.Drawing.Imaging.ImageCodecInfo codec = null;
                    for (int i = 0; i < info.Length; i++)
                    {
                        if (info[i].FormatDescription == "JPEG")
                        {
                            codec = info[i];
                            break;
                        }
                    }
                    im.Save(ostrm, codec, encoderParameters);
                    // end change
                    byte[] ba = ostrm.ToArray();
                    ostrm.Close();
                    PageImage pi = new PageImage(imf, ba, width, height);
                    pi.SI = new StyleInfo();			// defaults are ok; don't want border, etc
                    // Set location, height and width
                    pi.X = x;
                    pi.Y = y;
                    pi.H = h;
                    pi.W = w;
                    pi.Sizing = bClip? ImageSizingEnum.Clip: ImageSizingEnum.FitProportional;

                    p.InsertObject(pi);
                }
                catch (Exception e)
                {
                    // image failed to load, continue processing
                    Console.WriteLine("Stamping image failed.  {0}", e.Message);
                }
                finally
                {
                    if (strm != null)
                        strm.Close();
                    if (im != null)
                        im.Dispose();
                }
                break;			// only stamp the first page
            }

            // Now create the PDF
            report.RunRenderPdf(sg, pgs);
        }
開發者ID:bittercoder,項目名稱:odd-reports,代碼行數:101,代碼來源:RdlCmd.cs


注:本文中的fyiReporting.RDL.Report.RunRenderPdf方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。