Certificate Generation System

Certificate Generation System

Certificate Generation System is a portable application used to Generate Certificate for single candidate providing his/her details along with image,
As well as for Batch/Number of candidates by simply providing the CSV format file (containing details of every candidate) along with candidate images

CSV- Character Separated File.

A CSV file is a text file that has a specific format which allows for the saving of textual information/data in an organized fashion.

CSV is a simple file format used to store tabular data, such as a spreadsheet or database. Files in the CSV format can be imported to and exported from programs that store data in tables, such as Microsoft Excel or OpenOffice Calc.

Setup

First clone a repository  in the directory.

cd /var/www/html
git clone https://github.com/amisha2016/Certificate
cd Certificate
sudo chmod -R 777 /var/www/html/Certificate/

git checkout odtphp
sudo ./install.sh

SH files are self-extracting archives. The SH file archive contains selected files and a shell script along with instructions on how to extract its contents. This file format is commonly used for Unix shell files, created by the Unix shar utility program. They are typically used for scripts that run on the Unix command prompt. SH files can only be used on computers that are run on the Unix operating system, although systems similar to Unix may also use this file format.

Looking for how to open sh files? Checkout http://www.openthefile.net/extension/sh

Then Go to http://localhost/Certificate/CGS/

ce1.png

Then I was getting an error of “Abort pclzip.lib.php : Missing zlib extensions”
eThen I got to know about the function gzopen().

gzopenOpen gz-file. Opens a gzip (.gz) file for reading or writing.

Detail of GZ file

GZ is a type of compression format which is very popular on Unix and Linux based computers. GZ stands for GNU ZIP.

Unlike ZIP, GZip does not support archiving. This means that it is not possible to put more than one file in a GZ file. This is circumvented by first using TAR to archive (not compress) multiple files into one, and then compressing it with GZip afterwards. This results in a file with the extension .tar.gz or .tgz.

To check whether the function gzopen is available in python or not write command:-

php -r 'var_dump(function_exists("gzopen"));'

It  shows bool(true) .It means that the zlib extension is available.

 Then, I wrote command

php -r 'var_dump(function_exists("gzopen64"));'

It shows bool(false) .

Then, I opened the file pclzip.lib.php

cd /var/www/html/Certificate/library/zip/pclzip

 vim pclzip.lib.php
Replace gzopen64 with gzopen if gzopen function exists otherwise try it with
gzopen64 only and finally cracked the problem.
ce5
ce6
To check the options one by one, I selected the first option.
ce7
 Now, the problems not end here. When I clicked the button “GENERATE” nothing was appearing on browser.
Then, I searched for the error in the file “error.log” which is placed in the directory /var/log/apache2
cd /var/log/apache2
tail error.log
I was getting a fatal error :-
PHP Fatal error:  Call to undefined function imagecreatefromjpeg() in /var/www/html/Certificate/CGS/manual.php on line 55, referer: http://localhost/Certificate/CGS/option.php?var=manual
It means that imagecreatefromjpeg() is undefined function.
After searching lot about it, I got to know that in my PHP version there is no GD library.
The GD library is a graphics drawing library that provides tools for manipulating image data.

Then, I installed gd

$ sudo apt-get install php5-gd
$ sudo service apache2 restart
Be sure to restart your web server daemon after installing the library and solved the problem.
ce8
ce9
Select “DOWNLOAD ODT” and able to see the Certificate.
ce0

Now, going back to the page as shown below for trying it for the other option i.e. “Upload CSV file”.

ce6

 

ce12

ce13

THe page viwed after this is shown below. Again Stucked 😦 .Take lot of my time to resolve it.

ce2

Then I edited the “csv.php” located at “/var/www/html/Certificate/CGS”. Replace the line 132 i.e.

$command = ‘unoconv -f pdf –output /var/www/html/Certificate/CGS/pdf/ ‘ . $source_file;

with

$command = ‘unoconv -f pdf –output /var/www/html/Certificate/CGS/pdf/’.$id.’.pdf ‘ . $source_file;

It means there was logical error i.e. ‘.$id.’ was missing in it and save the file. Now try again. Now the server will able to find the URL “../id.pdf” and after this it works smoothly.

Unoconv is Python tool that uses LibreOffice libs (pyuno). It convert between any document format supported by OpenOffice

 

The final problem which I have not described yet is that in the option “Fill candidate details manually” the option “Download pdf” is not running. Not yet get the solution but tring to resolve it will update soon. 🙂

 Bye Bye.
Have A Nice Day.
 
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s