<commit_before><!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<title>Life calendar</title>
	<link rel='stylesheet' href='bootstrap/css/bootstrap.min.css'>
	<link rel='stylesheet' href='bootstrap/css/bootstrap-theme.min.css'>
	<style media="print">
		@page 
		{
			size: auto;   /* auto is the current printer page size */
			margin: 0mm;  /* this affects the margin in the printer settings */
		}
	</style>
</head>
<body>


<div class="container">

	<div class="row">
		<div class="col-md-4 hidden-print">
			<p> </p>
			<div>
				<p>Set your birthday: <input type="date" id="b-date"></p>
			</div>
			<div class="btn-group">
				<a href="#" class="btn btn-default" id="saveImageBtn">Save as JPG</a>
				<a href="#" class="btn btn-default" id="savePdfBtn">Save as PDF</a>
				<a href="#" class="btn btn-default" id="printPageBtn">Print</a>
			</div>
		</div>
		<div class="col-md-8">
			<div id="life-calendar"></div>
		</div>
	</div>

</div>

<script src="jspdf/jspdf.min.js"></script>
<script src="../src/life-calendar.js"></script>
<script>
(function(){

	var DEFAULT_CALENDAR_FILE_NAME = 'my-life-calendar',
		DEFAULT_IMAGE_TYPE = 'image/jpeg',

		date = document.getElementById('b-date'),
		block = document.getElementById('life-calendar'),
		saveImage = document.getElementById('saveImageBtn')
		savePdf = document.getElementById('savePdfBtn'),
		printPage = document.getElementById('printPageBtn');

	LC.init(block);

	date.onchange = function (e) {
		var date = new Date(Date.parse(e.target.value));

		LC.update(date);

		return false;
	};
	
	saveImage.onclick = function (e) {
		var image = getImageFromCanvas();
		image = image.replace(DEFAULT_IMAGE_TYPE, 'image/octet-stream');

		e.target.href = image;
		e.target.download = DEFAULT_CALENDAR_FILE_NAME + '.jpg';
	};
	
	savePdf.onclick = function (e) {
		e.preventDefault();
		
		var image = getImageFromCanvas(),
			doc = new jsPDF();
		
		doc.addImage(image, 'JPEG', 10, 10);
		doc.save(DEFAULT_CALENDAR_FILE_NAME + '.pdf');
	};
	
	printPage.onclick = function (e) {
		e.preventDefault();
		
		window.print();
	};
	
	function getImageFromCanvas() {<commit_msg>Calibrate of image position in PDF<commit_after><!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<title>Life calendar</title>
	<link rel='stylesheet' href='bootstrap/css/bootstrap.min.css'>
	<link rel='stylesheet' href='bootstrap/css/bootstrap-theme.min.css'>
	<style media="print">
		@page 
		{
			size: auto;   /* auto is the current printer page size */
			margin: 0mm;  /* this affects the margin in the printer settings */
		}
	</style>
</head>
<body>


<div class="container">

	<div class="row">
		<div class="col-md-4 hidden-print">
			<p> </p>
			<div>
				<p>Set your birthday: <input type="date" id="b-date"></p>
			</div>
			<div class="btn-group">
				<a href="#" class="btn btn-default" id="saveImageBtn">Save as JPG</a>
				<a href="#" class="btn btn-default" id="savePdfBtn">Save as PDF</a>
				<a href="#" class="btn btn-default" id="printPageBtn">Print</a>
			</div>
		</div>
		<div class="col-md-8">
			<div id="life-calendar"></div>
		</div>
	</div>

</div>

<script src="jspdf/jspdf.min.js"></script>
<script src="../src/life-calendar.js"></script>
<script>
(function(){

	var DEFAULT_CALENDAR_FILE_NAME = 'my-life-calendar',
		DEFAULT_IMAGE_TYPE = 'image/jpeg',

		date = document.getElementById('b-date'),
		block = document.getElementById('life-calendar'),
		saveImage = document.getElementById('saveImageBtn')
		savePdf = document.getElementById('savePdfBtn'),
		printPage = document.getElementById('printPageBtn');

	LC.init(block);

	date.onchange = function (e) {
		var date = new Date(Date.parse(e.target.value));

		LC.update(date);

		return false;
	};
	
	saveImage.onclick = function (e) {
		var image = getImageFromCanvas();
		image = image.replace(DEFAULT_IMAGE_TYPE, 'image/octet-stream');

		e.target.href = image;
		e.target.download = DEFAULT_CALENDAR_FILE_NAME + '.jpg';
	};
	
	savePdf.onclick = function (e) {
		e.preventDefault();
		
		var image = getImageFromCanvas(),
			doc = new jsPDF();
		
		doc.addImage(image, 'JPEG', 20, 5, 170, 280);
		doc.save(DEFAULT_CALENDAR_FILE_NAME + '.pdf');
	};
	
	printPage.onclick = function (e) {
		e.preventDefault();
		
		window.print();
	};
	
	function getImageFromCanvas() {
{'fraction_non_alphanumeric': 0.18365514144589135, 'fraction_numerical': 0.005163897620116749, 'mean_word_length': 4.15625, 'pattern_counts': {'":': 0, '<': 89, '<?xml version=': 0, '>': 89, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2432918', 'n_tokens_mistral': 1737, 'n_tokens_neox': 1551, 'n_words': 327}