Skip to content

Instantly share code, notes, and snippets.

View 2208Abhinav's full-sized avatar
💡

Abhinav Singh 2208Abhinav

💡
View GitHub Profile
@2208Abhinav
2208Abhinav / selector.php
Last active June 3, 2018 08:43
The distributor and collector
<?php
//this is the file which will select the portion required to be transferred to the PDF
//and will feed the common part to the PDF
require_once("../../interface/globals.php");
require_once("TCPDF/tcpdf.php");
require_once("$srcdir/report.inc");
require_once("$srcdir/patient.inc");
$titleres = getPatientData($pid, "fname,lname,providerID,DATE_FORMAT(DOB,'%m/%d/%Y') as DOB_TS"); //this section
@2208Abhinav
2208Abhinav / disable.js
Created June 3, 2018 06:47
JavaScript disabler
$('.pdf_proto').click(function() {
$('#report_form').attr('action', '../../../modules/pdf_generator/selector.php');
$('#report_form').submit();
});
<?php
/**
* The purpose of this code is to get the patient history data
* in a formatted manner and store it in a single variable $content_his.
* The content of this variable will be printed in the PDF if required.
*
*
* LICENSE: This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0
* See the Mozilla Public License for more details.
* If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.

Work Summary - GSoC 2018

Project

Title: Make a module that will handle all the PDF generation requirements of the software autonomously | Project proposal
Mentors: Tony McCormick, Nilesh Prasad
Organization: LibreHealth

Introduction

The software used a lot of exteranal libraries like HTML2PDF, MPDF, FPDF and TCPDF. My aim for the project was to make a custom PHP library based on TCPDF as backbone to create PDFs autonomously according to the data present in the database and the choices made by the user.

Work Done

<?php
// include the TCPDF class
require_once '../../globals.php';
require_once('../../../modules/pdf_generator/TCPDF/tcpdf.php');
require_once "$srcdir/options.inc.php";
require_once "$srcdir/formdata.inc.php";
require_once "$srcdir/formsoptions.inc.php";
require_once "$srcdir/patient.inc";