Foxit PDF adapted by Google Chrome

Google has announced to use FoxIT PDF libraries through which you can manipulate PDF operation at browser level.

Indeed, it will further push us to develop software that are specific to Google platform. However, it will be good to see how others, like IE Firefox, will cop up with challenges that will push them to extend support of such features into their browsers as well.

I have been playing around with FoxIT. Overall I could see it is a nice & clean sdk that works in different platform. It can also work with encrypted form.

For .net developers there is a piece of samples available directly from the link:

http://cdn01.foxitsoftware.com/pub/foxit/sdk/net/1.x/1.0/FoxitPDFSDKForNET102_enu.zip

The main problem that I find with such type of SDK is that you have to create even a table through coding. If you want to attach chart, graphs in your pdf then things can go too much of writing. That is the main reason that I am no convinced to for for this product or develop something that is specific to the browser.

Now what could be the solution?

The solution that I recommend to my client is to go through RDLC, which is free (technically not) and it is a Microsoft Product, which is easy to design as well.

Here is the sample code that I can guess solve the problem of generating PDF from RDCL.

Warning[] warnings;

string[] streamIds;
string mimeType = string.Empty;
string encoding = string.Empty;
string extension = string.Empty;
DataSet dsGrpSum, dsActPlan, dsProfitDetails,
dsProfitSum, dsSumHeader, dsDetailsHeader, dsBudCom = null;

//This is optional if you have parameter then you can add parameters as much as you want
ReportParameter[] param = new ReportParameter[5];
param[0] = new ReportParameter("Report_Parameter_0", "1st Para", true);
param[1] = new ReportParameter("Report_Parameter_1", "2nd Para", true);
param[2] = new ReportParameter("Report_Parameter_2", "3rd Para", true);
param[3] = new ReportParameter("Report_Parameter_3", "4th Para", true);
param[4] = new ReportParameter("Report_Parameter_4", "5th Para");


DataSet dsData= "Fill this dataset with your data";
ReportDataSource rdsAct = new ReportDataSource("RptActDataSet_usp_GroupAccntDetails", dsActPlan.Tables[0]);
ReportViewer viewer = new ReportViewer();
viewer.LocalReport.Refresh();
viewer.LocalReport.ReportPath = "Reports/AcctPlan.rdlc"; //This is your rdlc name.
viewer.LocalReport.SetParameters(param);
viewer.LocalReport.DataSources.Add(rdsAct); // Add datasource here

// NOTE: You can also pass first parameter as :Excel.
byte[] bytes = viewer.LocalReport.Render("PDF", null, out mimeType, out encoding, out extension, out streamIds, out warnings);
// byte[] bytes = viewer.LocalReport.Render("Excel", null, out mimeType, out encoding, out extension, out streamIds, out warnings);

Response.Buffer = true;
Response.Clear();
Response.ContentType = mimeType;
Response.AddHeader("content-disposition", "attachment; filename= filename" + "." + extension);
Response.OutputStream.Write(bytes, 0, bytes.Length); // create the file
Response.Flush(); // send it to the client to download
Response.End();

In conclusion, I will give it a go with generating PDF through SDK if I don’t have an access to RDLC technology. If you want to manipulate generated PDF then you might want to see PDF SDK as well. Otherwise, for simple operation such as generating PDF, my recommendation is for RDLC.