本文介绍了Fusion图表如何更新导出(服务器端)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 我正在使用FuscionChart FCExporter类将图表导出到Pdf,PNG等。我面临的问题是我希望图表后面的页面显示数据中的网格视图打印。 实现此目的有几个选项: 1.创建图表PDF然后gridview PDF并合并两个文件 -Problem:我不知道从哪里开始。我不确定在课堂上哪个地方打电话 另一个文件并合并。 2.更新例程以允许GridView成为将图表元素添加到 docuement后添加。 问题:我最接近它的工作是在文档中打印第二页但网格视图永远不会显示,我不确定为什么。 代码用于向PDF添加元素: private byte [ ] getPDFObjects(bool isCompressed) { MemoryStream PDFBytes = new MemoryStream(); //存储此临时字符串中的所有PDF对象都要写入ByteArray string strTmpObj =; // start xref数组 ArrayList xRefList = new ArrayList(); xRefList.Add(xref\\\0); xRefList .Add(0000000000 65535 f \ n); //地址refenrece到obj 0 //按顺序构建PDF对象 //版本和标题 strTmpObj =%PDF-1.3 \ n%{FC} \ n; PDFBytes.Write(stringToBytes(strTmpObj),0,strTmpObj.Length); // OBJECT 1:info(可选) strTmpObj =1 0 obj<< \\\ / Author(FusionCharts)\ n / Title(FusionCharts) )\ n / Creator(FusionCharts)\ n>> \ nendobj \ n; xRefList.Add(calculateXPos((int)PDFBytes.Length)); // refenrece to obj 1 PDFBytes.Write(stringToBytes(strTmpObj),0,strTmpObj.Length); // OBJECT 2 :从页面目录开始 strTmpObj =2 0 obj \ n<< / Type / Catalog / Pages 3 0 R>> \ nendobj \ n; xRefList.Add(calculateXPos((int)PDFBytes.Length)); // refenrece to obj 2 PDFBytes.Write(stringToBytes(strTmpObj),0,strTmpObj.Length); // OBJECT 3 :页面树(对目录页面的引用) strTmpObj =3 0 obj \ n<< / Type / Pages / Kids [; for( int i = 0; i< numPages; i ++) { strTmpObj + =(((i + 1)* 3)+ 1)+0 R \\ \\ n; } strTmpObj + =] /计数+ numPages +>> \ nndobj \ n; xRefList.Add(calculateXPos((int)PDFBytes.Length)); // refenrece to obj 3 PDFBytes.Write(stringToBytes(strTmpObj),0,strTmpObj.Length); //每个图像页面 for(int itr = 0; itr< numPages; itr ++) { string iWidth = getMeta(width,itr); string iHeight = getMeta(height,itr); // OBJECT 4..7..10 .. n:页面配置 strTmpObj =(((itr + 2)* 3) - 2)+0 obj\\\<< \\\ / Type / Page / Parent 3 0 R \\ \\ n / MediaBox [0 0+ iWidth ++ iHeight +] \ n / Resources<< \ n / ProcSet [/ PDF] \ n / XObject<< / R+( itr + 1)++((itr + 2)* 3)+0 R>> \\\>> \ n / Contents [+(((itr + 2)* 3) - 1 )+0 R] \ n>> \ nndobj \ n; xRefList.Add(calculateXPos((int)PDFBytes.Length)); // refenrece to obj 4,7,10,13,16 ... PDFBytes.Write(stringToBytes(strTmpObj),0,strTmpObj.Length); // OBJECT 5 ... 8 ... 11 ... n:页面资源对象(转换图像的xobject资源) xRefList.Add(calculateXPos((int)PDFBytes.Length)); // refenrece to obj 5,8,11,14,17 ... string xObjR = getXObjResource(itr); PDFBytes.Write(stringToBytes(xObjR), 0,xObjR.Length); //对象6 ... 9 ... 12 ... n:页面的二进制xobject(图像) byte [] imgBA = addImageToPDF(itr,isCompressed); xRefList.Add(calculateXPos((int)PDFBytes.Length)); // refenrece to obj 6,9, 12,15,18 ... PDFBytes.Write(imgBA,0,imgBA.Length); } //外部参考编译 xRefList [0] + =((xRefList.Count - 1)+\ n); //获取预告片 string trailer = getTrailer((int)PDFBytes.Length,xRefList.Count - 1); //将外部参照和预告片写入PDF string strXRefs = string.Join(,(string [])xRefList.ToArray(typeof(string))) ; PDFBytes.Write(stringToBytes(strXRefs),0,strXRefs.Length); // PDFBytes.Write(stringToBytes(trailer) ),0,trailer.Length); //写EOF string strEOF =%% EOF \ n; PDFBytes.Write(stringToBytes(strEOF),0,strEOF.Length); PDFBytes.Close(); 返回PDFBytes.ToArray(); } I'm using FuscionChart FCExporter class to export charts to Pdf, PNG, etc. The problem I'm facing is I want a page after the chart to show a Grid View print out of the data.There a few options for implementing this:1. Create chart PDF then gridview PDF and merge the two documents -Problem: I have no idea where to start with this. I'm unsure where in the class to call the other document and merge.2. Update routine to allow a GridView to be added after the chart element is added to the docuement. Problem: The closest I came to it working was getting a second page to print in the document but the Grid View would never show and I'm unsure why. Code For adding elements to PDF: private byte[] getPDFObjects(bool isCompressed) { MemoryStream PDFBytes = new MemoryStream(); //Store all PDF objects in this temporary string to be written to ByteArray string strTmpObj = ""; //start xref array ArrayList xRefList = new ArrayList(); xRefList.Add("xref\n0 "); xRefList.Add("0000000000 65535 f \n"); //Address Refenrece to obj 0 //Build PDF objects sequentially //version and header strTmpObj = "%PDF-1.3\n%{FC}\n"; PDFBytes.Write(stringToBytes(strTmpObj), 0, strTmpObj.Length); //OBJECT 1 : info (optional) strTmpObj = "1 0 obj<<\n/Author (FusionCharts)\n/Title (FusionCharts)\n/Creator (FusionCharts)\n>>\nendobj\n"; xRefList.Add(calculateXPos((int)PDFBytes.Length)); //refenrece to obj 1 PDFBytes.Write(stringToBytes(strTmpObj), 0, strTmpObj.Length); //OBJECT 2 : Starts with Pages Catalogue strTmpObj = "2 0 obj\n<< /Type /Catalog /Pages 3 0 R >>\nendobj\n"; xRefList.Add(calculateXPos((int)PDFBytes.Length)); //refenrece to obj 2 PDFBytes.Write(stringToBytes(strTmpObj), 0, strTmpObj.Length); //OBJECT 3 : Page Tree (reference to pages of the catalogue) strTmpObj = "3 0 obj\n<< /Type /Pages /Kids ["; for (int i = 0; i < numPages; i++) { strTmpObj += (((i + 1) * 3) + 1) + " 0 R\n"; } strTmpObj += "] /Count " + numPages + " >>\nendobj\n"; xRefList.Add(calculateXPos((int)PDFBytes.Length)); //refenrece to obj 3 PDFBytes.Write(stringToBytes(strTmpObj), 0, strTmpObj.Length); //Each image page for (int itr = 0; itr < numPages; itr++) { string iWidth = getMeta("width", itr); string iHeight = getMeta("height", itr); //OBJECT 4..7..10..n : Page config strTmpObj = (((itr + 2) * 3) - 2) + " 0 obj\n<<\n/Type /Page /Parent 3 0 R \n/MediaBox [ 0 0 " + iWidth + " " + iHeight + " ]\n/Resources <<\n/ProcSet [ /PDF ]\n/XObject <</R" + (itr + 1) + " " + ((itr + 2) * 3) + " 0 R>>\n>>\n/Contents [ " + (((itr + 2) * 3) - 1) + " 0 R ]\n>>\nendobj\n"; xRefList.Add(calculateXPos((int)PDFBytes.Length)); //refenrece to obj 4,7,10,13,16... PDFBytes.Write(stringToBytes(strTmpObj), 0, strTmpObj.Length); //OBJECT 5...8...11...n : Page resource object (xobject resource that transforms the image) xRefList.Add(calculateXPos((int)PDFBytes.Length)); //refenrece to obj 5,8,11,14,17... string xObjR = getXObjResource(itr); PDFBytes.Write(stringToBytes(xObjR), 0, xObjR.Length); //OBJECT 6...9...12...n : Binary xobject of the page (image) byte[] imgBA = addImageToPDF(itr, isCompressed); xRefList.Add(calculateXPos((int)PDFBytes.Length));//refenrece to obj 6,9,12,15,18... PDFBytes.Write(imgBA, 0, imgBA.Length); } //xrefscompilation xRefList[0] += ((xRefList.Count - 1) + "\n"); //get trailer string trailer = getTrailer((int)PDFBytes.Length, xRefList.Count - 1); //write xref and trailer to PDF string strXRefs = string.Join("", (string[])xRefList.ToArray(typeof(string))); PDFBytes.Write(stringToBytes(strXRefs), 0, strXRefs.Length); // PDFBytes.Write(stringToBytes(trailer), 0, trailer.Length); //write EOF string strEOF = "%%EOF\n"; PDFBytes.Write(stringToBytes(strEOF), 0, strEOF.Length); PDFBytes.Close(); return PDFBytes.ToArray(); } 推荐答案 这篇关于Fusion图表如何更新导出(服务器端)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
10-14 16:54