How To Generate PDF File In CakePHP

TCPDF is a free and open source software one of the widely used PHP libraries in the world. This is because of the fact that it already included in the most popular PHP-based CMS and applications including CakePHPHow to generate pdf file in cakephp.

The installation is pretty straight forward and easy-to-use in CakePHP Framework. Many web applications use this as output documents like invoices, contracts or just web pages in the PDF format.

 

Following are the steps to integrate TCPDF in CakePHP MVC framework.

Step 1:

  • Go to http://www.tcpdf.org and download the latest version of TCPDF zip file.
  • Then unzip the zip file and save under the Vendor folder in cakephp framework(app\vendors)
  • This creates a directory tcpdf there with tcpdf.php and more in it (app\vendors\tcpdf)
  •  You can configure the PDF file Like header Logo Image, Page Title, page Margin etc. in the TCPDF configure file (app->vendors->tcpdf-> tcpdf_config.php)

Step 2:

You can create your own header and footer page of your PDF file. Create a page “xtcpdf.php” under app/vendors with these contents as shown below.

App::import('Vendor','tcpdf/tcpdf');
class XTCPDF extends TCPDF
{
var $xheadertext = 'PDF created using CakePHP and TCPDF';
var $xheadercolor = array(0,0,200);
var $xfootertext = 'Copyright © %d XXXXXXXXXXX. All rights reserved.';
var $xfooterfont = PDF_FONT_NAME_MAIN ;
var $xfooterfontsize = 8 ;
/* Change header text and font size as per your requirement in the above variable*******/
function Header()
{
list($r, $b, $g) = $this->xheadercolor;
$this->setY(10); // shouldn't be needed due to page margin, but helas, otherwise it's at the page top
$this->SetFillColor($r, $b, $g);
$this->SetTextColor(0 , 0, 0);
$this->Cell(0,20, '', 0,1,'C', 1);
$this->Text(15,26,$this->xheadertext );
}
function Footer()
{
$year = date('Y');
$footertext = sprintf($this->xfootertext, $year);
$this->SetY(-20);
$this->SetTextColor(0, 0, 0);
$this->SetFont($this->xfooterfont,'',$this->xfooterfontsize);
$this->Cell(0,8, $footertext,'T',1,'C');
}
}
?>

Step 3:

Create your layout under app/views/layouts/pdf.ctp;

header("Content-type: application/pdf");
echo $content_for_layout;
?>

Step 4:

Here is the Controller code which will display output code of generating PDF file;

function view_pdf($id = null) {
if (!$id) {
$this->Session->setFlash('Sorry, there was no PDF selected.');
$this->redirect(array('action'=>'index'), null, true);
}
$this->layout = 'pdf'; //this will use the pdf.ctp layout
$this->render();
}

Step 5:

Create a page under your view directory (app/views/) named as “view_pdf.ctp” (this name can be change as per your controller method) and write your HTML code/PHP code.

How To Implement Security Patches On Ruby On Rails Applications

The security of any software product or application is something that every software solution provider is wary of. It is no different in the case of a Ruby on Rails application.

Even after an application is successfully developed and deployed, there can be possibilities for many unseemly activities.

US-based high-end software solution provider Andolasoft.Inc sheds some light on some of the basic precautions that are worked upon before deploying an application.

The Company’s Ruby on Rails developers pay special attention to security issues in every undertaken venture.
Authentication and authorization of the User model are two different things.

Never miss an update from us. Join 10,000+ marketers and leaders.

Actions like create/update/delete always need to be protected. Even popular plug-ins like Restful authentication and Clearance only authenticate whereas providing no helper methods for authorization.

Mass assignment of sensitive attributes from re-assignment should be protected.

This can be taken care of by disabling mass assignment with the help of attr_accessible or attr_protected in the respective models. Attributes like account_id’s and user_id’ should be protected.

Also disabling updates on protected attributes can be by using attr_readonly so that the Ids don’t get updated once set.

Content types of files being uploaded can be faked, so uploaded files should be placed in protected directories or servers.

Also, file extensions should be checked and the web-server should be disabled so as not to execute such files in the uploaded directories.

Sessions are prone to vulnerabilities like hijacks, replaying cookies, and session fixation. Extra caution must be taken regarding storing data in sessions.

Active record Objects should never be stored in sessions which might change that Object’s behavior while migration and future code change.

The best practice is to only store the ids of the records. Also, sensitive data like User access privileges and money based information should not be stored in sessions.

The Horizons of CakePHP Application Development

CakePHP is an open-source web development framework for PHP. It came into prominence around 2006 and it was inspired by the Ruby on Rails framework, which was introduced around a year prior to it.

CakePHP follows MVC pattern architecture. Like RoR, it also follows the two key design features, DRY or “Don’t Repeat Yourself” and CoC or “Convention over Configuration”.

CakePHP development is a rapid development framework with thoughtful, coherent design and is well aided by friendly community contributions. It relies on a ORM (Object-Relation Model) regarding database query interface.

Never miss an update from us. Join 10,000+ marketers and leaders.

Using CakePHP’s ORM, we can create, retrieve, update and delete related data into and from different database tables with simplicity and in a better way. There is no need to write complex SQL queries anymore.

Some of the key features of CakePHP are:

  • Flexible Licensing
  • Compatibility with PHP4 and PHP5
  • Integrated CRUD for database interaction and simplified queries
  • Application Scaffolding
  • Request dispatcher with good looking, custom URLs
  • Built-in Validation
  • Fast and flexible templating (PHP syntax, with helpers)
  • View Helpers for AJAX, JavaScript, HTML Forms and more
  • Security, Session, and Request Handling Components
  • Flexible access control lists
  • Data Sanitization
  • Flexible View Caching

Andolasoft Inc. offers quick and cost effective CakePHP development to built robust and scalable web applications for start-up and established business houses, institutions etc.

Get The Most Out of eCommerce Development!

Thanks to eCommerce development, businesses are no longer restricted to geographical localized market.

With minimal investment, you can get access to a wider range of clientele globally and promote your products and services.

E-commerce development business has grown faster than anyone could have predicted and today many companies from around the world are jumping overboard to get the most benefit out of it.

Today it’s a multi-billion dollar industry that is expected to grow manifolds in the coming days.

Never miss an update from us. Join 10,000+ marketers and leaders.

This online mode of trading has facilitated the distribution of products in an appropriate manner. One can directly reach to the prospective customers without spending extra on additional marketing charges.

E-commerce has amplified the communication of online customers and business owners. However, just like any other business, E-commerce also has its share of limitations. One major issue is the security aspect of online payment.

Although many E-commerce developers use a secure server like Apache, the online mode of payment is still vulnerable to cybercriminals. When it comes to a choice of eCommerce Development Company, Andolasoft is a leading name.

Since its revolution, we are offering bespoke applications by utilizing the cutting edge technologies of E-commerce.

Andolasoft has comprehensive experience in developing and deploying shopping cart and payment gateway based eCommerce solutions.

Andolasoft dedicated developers are using the latest available patches to secure the server and stop the vulnerable attacks of hackers. Our wide range of eCommerce solutions can also be customized as per the clients’ requirements.

Empower Your Development Skill with the Latest Flex Actionscript 3

 

Planning to develop rich and interactive user applications? Flex Actionscript 3 makes it easier to build RIA development. The latest beta version of Flex is considered as the most powerful tool for developing rich Internet-based applications.

Earlier there was a stigma attached among developers regarding developing applications in Actionscript.

But with the release of Flex Actionscript 3 and bar of object-oriented coding approach has augmented considerably and today many developers are making the transition to flex technology.

With this latest version of Actionscript, you can create packages, facilitate strict typing through the compiler.

In addition, the new Flex environment has made it much easier to debug code and see errors or warnings even while writing the codes.

In Flex, all Actionscript is implemented in a class hierarchy. An Actionscript would comprise of visual elements and the component logic.

Flex Actionscript 3 has some prevalent flex component which helps in creating simple application development. For such simple applications, it’s advisable to create the MXML components.

With Flex Actionscript 3, you can develop rich Internet applications, codes on multiple platforms, troubleshoot the code more easily, achieve better scalability, leverage from the community libraries, run the application faster and thus achieve greater performance on your application.

Andolasoft offers dedicated services in Flex Actionscript 3. From data models to sophisticated client-side business logic, our expert Flex developers diligently work to meet up our clients’ business requirements.

Our expert developers develop chic RIA that is fast in processing and has seamless navigation. With successful enterprise development, we ensure to improve business productivity.

IT Consulting Services & Its Offerings

Consulting Service

In this era of stiff competition, everyone wants to capitalize on the cost-effectiveness factor. Lower is the cost; higher is the profit margin for any organization.

IT consulting services not only offer to garner more profits for your business, they enable your business to reach the pinnacle of success.

The dimension of IT consulting services can be manifolds. Starting from website designing, development, testing to data migration, monitoring, and maintenance, etc.; IT consulting covers it all.

Consulting service providers develop target specific IT solutions as per their clients’ business requirements.

IT consultation has facilitated and brought a Win-Win situation for the clients. With the right quality of service, you not only reduce your operational costs but also improve your productivity for your business.

And since service providers take care of most of the issues like conceptualizing, developing, and implementing your business plans, you can concentrate on your core business to maximize its performance and growth.

Do you want to catalyze your business growth and profit aspects?

Then Andolasoft’s IT consulting services can be a trusted choice. Andolasoft offers a full range of IT service consultations including strategic consulting, system integration, monitoring to outsourcing.

We have the best technical pool of resources to meet any type of business challenge. Our developers work with our clients to understand their problem areas and accordingly develop solutions by applying the right mix of services.

With expertise in cutting edge technology, in-depth business insight as well as industrial experience, our IT consultation services help you make wise technological investments in sync with your business objectives.