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.

How can I easily tell what caused the error – DbEntityValidationException ?

I came across with the situation where I have used Entity Framework 6.0. While calling SaveChanges on my DbContext, I get the following exception: System.Data.Entity.Validation.DbEntityValidationException: Validation failed for one or more entities. See ‘EntityValidationErrors’ property for more details.   After going into the exception detail all I could get to …

How to create jquery Plugin?

Idea behind this plugin is to catch any event on <a> link and open the URL on new screen. /*! jQuery anchormaaster Plugin – v1.0 – 18/2/2014 * Copyright CM (c) 2014 codebased@hotmail.com; Licensed MIT */ (function ($) { // function that go through each link available in the given …

How to Extend string object in JavaScript?

$(function () { // — DOM is ready to action on. /* Summary: startsWith should take a single argument and return true if the provided string is a prefix of this. */ if (typeof String.prototype.startsWith !== ‘function’) { // checked and there is no startsWith (pre-defined) method. String.prototype.startsWith = function …

How to (re)-register Office 365 Desktop setup?

First, please let each user run the Office 365 Desktop Setup on their computer: Sign in MOP, click Downloads, and click the button Set up under Set up and configure your Office desktop apps. If this issue persists, you can use OSAUI.exe /K to reset and reactivate Office Professional Plus: 1. Click Start, type cmd in the search field, …

ITIL: Change Management Process

Change Management Process Purpose The purpose of this process is “to control the lifecycle of all changes, enabling beneficial changes to be made with minimum disruption to IT services. Objective Keep abreast of the changes that happen in the business environment. Ensure that changes are recorded and evaluated, and that …