Primeiro commit

Signed-off-by: Rodrigo Martins <rodrigo.sousa.577@gmail.com>
This commit is contained in:
rodrigo committed 2025-01-01 21:15:15 -03:00
commit a1beb6a2e0
425 files changed
+193665

No files matched your search

+7
View File
@@ -0,0 +1,7 @@
uploads/*
processed/*
original/*
ots_cache/*
cgnat.php
*.rsc
phpinfo.php
+58
View File
@@ -0,0 +1,58 @@
<?php
session_start(); // Iniciar sessão
// Verificar se o usuário está logado
if (!isset($_SESSION['user_id'])) {
http_response_code(401); // Não autorizado
echo json_encode([]);
exit();
}
header('Content-Type: application/json; charset=utf-8');
// Conectar ao banco de dados
$mysqli = new mysqli("10.15.0.42", "root", "34641747", "valida");
// Verificar erros na conexão
if ($mysqli->connect_error) {
echo json_encode([]);
exit();
}
// Obter o termo de pesquisa
$term = isset($_GET['term']) ? trim($_GET['term']) : '';
if ($term === '') {
echo json_encode([]);
exit();
}
// Preparar a consulta para buscar nomes, CPFs ou emails que correspondam ao termo
$stmt = $mysqli->prepare("
SELECT id, name, cpf, email
FROM clients
WHERE name LIKE CONCAT('%', ?, '%')
OR cpf LIKE CONCAT('%', ?, '%')
OR email LIKE CONCAT('%', ?, '%')
LIMIT 10
");
$stmt->bind_param("sss", $term, $term, $term);
$stmt->execute();
$result = $stmt->get_result();
// Construir o array de sugestões
$suggestions = [];
while ($row = $result->fetch_assoc()) {
$suggestions[] = [
'id' => htmlspecialchars($row['id'], ENT_QUOTES, 'UTF-8'),
'label' => htmlspecialchars($row['name'] . ' - ' . $row['cpf'] . ' - ' . $row['email'], ENT_QUOTES, 'UTF-8'),
'value' => htmlspecialchars($row['name'], ENT_QUOTES, 'UTF-8') // Valor exibido no input
];
}
echo json_encode($suggestions);
// Fechar o statement e a conexão
$stmt->close();
$mysqli->close();
?>
+221
View File
@@ -0,0 +1,221 @@
<?php
// Verificar se o usuário está logado
if (!isset($_SESSION['user_id'])) {
header("Location: login.php");
exit();
}
?>
<!DOCTYPE html>
<html lang="pt-BR">
<head>
<meta charset="UTF-8">
<title>Detalhes do Cliente</title>
<link rel="stylesheet" href="style.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css" integrity="sha512-iecdLmaskl7CVkqkXNQ/ZH/XLlvWZOJyj7Yy7tcenmpD1ypASozpmT/E0iPtmFIB46ZmdtAc9eNBvH0H/ZpiBw==" crossorigin="anonymous" referrerpolicy="no-referrer" />
<script src="../script/formatacoes.js"></script>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<style>
.note-actions {
display: inline-block;
margin-left: 10px;
}
.note-actions i {
cursor: pointer;
margin-right: 5px;
}
</style>
</head>
<body>
<div class="container">
<?php
// Conectar ao banco de dados
$mysqli = new mysqli("10.15.0.42", "root", "34641747", "valida");
if ($mysqli->connect_error) {
die("Connection failed: " . $mysqli->connect_error);
}
if (isset($_GET['id'])) {
$client_id = $_GET['id'];
$result = $mysqli->query("SELECT * FROM clients WHERE id = $client_id");
if ($result->num_rows > 0) {
$client = $result->fetch_assoc();
echo "<h2>Detalhes do Cliente: " . htmlspecialchars($client['name'] ?? '') . "</h2>";
echo "<a href='index.php?page=edit_client&id=$client_id'><button>Editar Cliente</button></a>";
echo "";
echo "<div class='client-details'>";
if (!empty($client['cpf'])) {
echo "<div class='client-info'><strong>CPF:</strong> <span id='numero-cpf'>" . htmlspecialchars($client['cpf'] ?? '') . "</span></div>"; // Adicione id="numero-cpf"
}
if (!empty($client['rg'])) {
echo "<div class='client-info'><strong>RG:</strong> " . htmlspecialchars($client['rg'] ?? '') . " (" . htmlspecialchars($client['rg_emissor'] ?? '') . ")</div>";
}
if (!empty($client['sexo'])) {
echo "<div class='client-info'><strong>Sexo:</strong> " . htmlspecialchars($client['sexo'] ?? '') . "</div>";
}
if (!empty($client['estado_civil'])) {
echo "<div class='client-info'><strong>Estado Civil:</strong> " . htmlspecialchars($client['estado_civil'] ?? '') . "</div>";
}
if (!empty($client['phone'])) {
echo "<div class='client-info'><strong>Telefone:</strong> <span id='numero-telefone'>" . htmlspecialchars($client['phone'] ?? '') . ($client['whatsapp'] ? " (WhatsApp)" : "") . "</span></div>"; // Adicione id="numero-telefone"
}
if (!empty($client['email'])) {
echo "<div class='client-info'><strong>Email:</strong> " . htmlspecialchars($client['email'] ?? '') . "</div>";
}
if (!empty($client['senha_meu_inss'])) {
echo "<div class='client-info'><strong>Senha do Meu INSS:</strong> " . htmlspecialchars($client['senha_meu_inss'] ?? '') . "</div>";
}
if (!empty($client['perfil_instagram'])) {
echo "<div class='client-info'><strong>Perfil do Instagram:</strong> @" . htmlspecialchars($client['perfil_instagram'] ?? '') . "</div>";
}
if (!empty($client['tipo_logradouro']) || !empty($client['endereco']) || !empty($client['bairro']) || !empty($client['cidade']) || !empty($client['estado']) || !empty($client['cep'])) {
echo "<div class='client-info'><strong>Endereço:</strong> " . htmlspecialchars($client['tipo_logradouro'] ?? '') . " " . htmlspecialchars($client['endereco'] ?? '') . ", " . htmlspecialchars($client['bairro'] ?? '') . ", " . htmlspecialchars($client['cidade'] ?? '') . " - " . htmlspecialchars($client['estado'] ?? '') . ", " . htmlspecialchars($client['cep'] ?? '') . "</div>";
}
if (!empty($client['certidao_nascimento'])) {
echo "<div class='client-info'><strong>Certidão de Nascimento/Casamento:</strong> " . htmlspecialchars($client['certidao_nascimento'] ?? '') . "</div>";
}
if (!empty($client['pis_pasep'])) {
echo "<div class='client-info'><strong>PIS/PASEP:</strong> " . htmlspecialchars($client['pis_pasep'] ?? '') . "</div>";
}
if (!empty($client['inss_beneficio'])) {
echo "<div class='client-info'><strong>Número do Benefício INSS:</strong> " . htmlspecialchars($client['inss_beneficio'] ?? '') . "</div>";
}
if (!empty($client['filiacao_pai'])) {
echo "<div class='client-info'><strong>Filiação (Pai):</strong> " . htmlspecialchars($client['filiacao_pai'] ?? '') . "</div>";
}
if (!empty($client['filiacao_mae'])) {
echo "<div class='client-info'><strong>Filiação (Mãe):</strong> " . htmlspecialchars($client['filiacao_mae'] ?? '') . "</div>";
}
echo "</div>";
// Abas
echo "<div class='tabs'>
<button class='tab-button' onclick='showTab(\"notes\")'>Notas</button>
<button class='tab-button' onclick='showTab(\"documents\")'>Documentos de Texto</button>
<button class='tab-button' onclick='showTab(\"files\")'>Arquivos</button>
<button class='tab-button' onclick='showTab(\"processes\")'>Processos</button>
</div>";
// Conteúdo das abas
echo "<div id='notes' class='tab-content'>";
echo "<h3>Notas</h3>";
// Formulário de nova nota
echo "<form id='new-note-form' action='index.php?page=client_details&id=$client_id' method='post'>
<textarea name='note' placeholder='Digite uma nova nota'></textarea>
<button type='submit'>Adicionar Nota</button>
</form>";
// Inserir nova nota no banco de dados
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['note'])) {
$note = $_POST['note'];
$stmt = $mysqli->prepare("INSERT INTO notes (client_id, note) VALUES (?, ?)");
$stmt->bind_param("is", $client_id, $note);
$stmt->execute();
$stmt->close();
}
// Listar notas
$notes_result = $mysqli->query("SELECT * FROM notes WHERE client_id = $client_id");
if ($notes_result->num_rows > 0) {
while ($note = $notes_result->fetch_assoc()) {
echo "<div class='note' id='note-" . $note['id'] . "'>";
echo "<p>" . htmlspecialchars($note['note'] ?? '') . " <small>(" . $note['created_at'] . ")</small></p>";
echo "<div class='note-actions'>";
echo "<i class='fas fa-edit edit-note' data-note-id='" . $note['id'] . "' title='Editar nota'></i>";
echo "<i class='fas fa-trash delete-note' data-note-id='" . $note['id'] . "' title='Excluir nota'></i>";
echo "</div>";
echo "</div>";
}
} else {
echo "<p>Sem notas.</p>";
}
echo "</div>";
echo "<div id='documents' class='tab-content' style='display:none;'>
<h3>Documentos de Texto</h3>
<p>Conteúdo da aba Documentos de Texto.</p>
</div>";
echo "<div id='files' class='tab-content' style='display:none;'>
<h3>Arquivos</h3>
<p>Conteúdo da aba Arquivos.</p>
</div>";
echo "<div id='processes' class='tab-content' style='display:none;'>
<h3>Processos</h3>
<p>Conteúdo da aba Processos.</p>
</div>";
} else {
echo "<p>Cliente não encontrado.</p>";
}
} else {
echo "<p>ID do cliente não fornecido.</p>";
}
$mysqli->close();
?>
</div>
<script>
$(document).ready(function() {
var telefone = "<?php echo $client['phone']; ?>";
if (telefone) {
$("#numero-telefone").text(formatarTelefone(telefone)); // Usando .text() para substituir o conteúdo
}
var cpf = "<?php echo $client['cpf']; ?>";
if (cpf) {
$("#numero-cpf").text(formatarCPF(cpf)); // Formata o CPF
}
// Editar nota
$(document).on('click', '.edit-note', function() {
var noteId = $(this).data('note-id');
var noteContent = $(this).closest('.note').find('p').text();
var editForm = `
<form class="edit-note-form" data-note-id="${noteId}">
<textarea name="note">${noteContent}</textarea>
<button type="submit">Salvar</button>
<button type="button" class="cancel-edit">Cancelar</button>
</form>
`;
$(this).closest('.note').html(editForm);
});
// Cancelar edição de nota
$(document).on('click', '.cancel-edit', function() {
location.reload();
});
// Salvar edição de nota
$(document).on('submit', '.edit-note-form', function(e) {
e.preventDefault();
var noteId = $(this).data('note-id');
var noteContent = $(this).find('textarea[name="note"]').val();
$.post('index.php?page=edit_note', { id: noteId, note: noteContent }, function(response) {
location.reload();
});
});
// Excluir nota
$(document).on('click', '.delete-note', function() {
if (confirm('Tem certeza que deseja excluir esta nota?')) {
var noteId = $(this).data('note-id');
$.post('index.php?page=delete_note', { id: noteId }, function(response) {
location.reload();
});
}
});
});
function showTab(tabId) {
var tabs = document.getElementsByClassName('tab-content');
for (var i = 0; i < tabs.length; i++) {
tabs[i].style.display = 'none';
}
document.getElementById(tabId).style.display = 'block';
}
</script>
</body>
</html>
+40
View File
@@ -0,0 +1,40 @@
<?php
// delete_client.php
// Verificar se o usuário está logado
session_start();
if (!isset($_SESSION['user_id'])) {
header("Location: login.php");
exit();
}
// Verificar se o ID do cliente foi fornecido via GET
if (isset($_GET['id'])) {
$client_id = intval($_GET['id']);
// Conectar ao banco de dados
$mysqli = new mysqli("10.15.0.42", "root", "34641747", "valida");
if ($mysqli->connect_error) {
die("Falha na conexão: " . $mysqli->connect_error);
}
// Preparar a declaração para evitar injeção de SQL
$stmt = $mysqli->prepare("DELETE FROM clients WHERE id = ?");
$stmt->bind_param("i", $client_id);
if ($stmt->execute()) {
// Redirecionar de volta para a lista de clientes após a exclusão
header("Location: index.php?page=list_clients&msg=Cliente+excluído+com+sucesso");
exit();
} else {
echo "Erro ao excluir cliente: " . $mysqli->error;
}
$stmt->close();
$mysqli->close();
} else {
// Redirecionar se o ID não foi fornecido
header("Location: index.php?page=list_clients");
exit();
}
?>
+29
View File
@@ -0,0 +1,29 @@
<?php
// Verificar se o usuário está logado
session_start();
if (!isset($_SESSION['user_id'])) {
header("Location: login.php");
exit();
}
// Conectar ao banco de dados
$mysqli = new mysqli("10.15.0.42", "root", "34641747", "valida");
if ($mysqli->connect_error) {
die("Connection failed: " . $mysqli->connect_error);
}
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['id'])) {
$note_id = $_POST['id'];
$stmt = $mysqli->prepare("DELETE FROM notes WHERE id = ?");
$stmt->bind_param("i", $note_id);
$stmt->execute();
$stmt->close();
echo "Nota excluída com sucesso!";
} else {
echo "Dados inválidos.";
}
$mysqli->close();
?>
+218
View File
@@ -0,0 +1,218 @@
<?php
// Conectar ao banco de dados
// Verificar se o usuário está logado
if (!isset($_SESSION['user_id'])) {
header("Location: login.php");
exit();
}
$mysqli = new mysqli("10.15.0.42", "root", "34641747", "valida");
if ($mysqli->connect_error) {
die("Connection failed: " . $mysqli->connect_error);
}
// Verificar se o ID do cliente foi fornecido
if (isset($_GET['id'])) {
$client_id = $_GET['id'];
// Verificar se o formulário foi enviado
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
// Obter os dados do formulário
$name = $_POST['name'];
$cpf = $_POST['cpf'];
$rg = $_POST['rg'];
$rg_emissor = $_POST['rg_emissor'];
$sexo = $_POST['sexo'];
$estado_civil = $_POST['estado_civil'];
$phone = $_POST['phone'];
$whatsapp = isset($_POST['whatsapp']) ? 1 : 0;
$email = $_POST['email'];
$senha_meu_inss = $_POST['senha_meu_inss'];
$perfil_instagram = $_POST['perfil_instagram'];
$tipo_logradouro = $_POST['tipo_logradouro'];
$endereco = $_POST['endereco'];
$bairro = $_POST['bairro'];
$cidade = $_POST['cidade'];
$estado = $_POST['estado'];
$cep = $_POST['cep'];
$certidao_nascimento = $_POST['certidao_nascimento'];
$pis_pasep = $_POST['pis_pasep'];
$inss_beneficio = $_POST['inss_beneficio'];
$filiacao_pai = $_POST['filiacao_pai'];
$filiacao_mae = $_POST['filiacao_mae'];
// Atualizar os dados do cliente no banco de dados
$stmt = $mysqli->prepare("UPDATE clients SET name=?, cpf=?, rg=?, rg_emissor=?, sexo=?, estado_civil=?, phone=?, whatsapp=?, email=?, senha_meu_inss=?, perfil_instagram=?, tipo_logradouro=?, endereco=?, bairro=?, cidade=?, estado=?, cep=?, certidao_nascimento=?, pis_pasep=?, inss_beneficio=?, filiacao_pai=?, filiacao_mae=? WHERE id=?");
$stmt->bind_param("ssssssssssssssssssssssi", $name, $cpf, $rg, $rg_emissor, $sexo, $estado_civil, $phone, $whatsapp, $email, $senha_meu_inss, $perfil_instagram, $tipo_logradouro, $endereco, $bairro, $cidade, $estado, $cep, $certidao_nascimento, $pis_pasep, $inss_beneficio, $filiacao_pai, $filiacao_mae, $client_id);
if ($stmt->execute()) {
$stmt->close();
$mysqli->close();
header("Location: index.php?page=client_details&id=$client_id");
exit();
} else {
echo "<p>Erro ao atualizar cliente.</p>";
}
$stmt->close();
}
// Obter os dados do cliente do banco de dados
$result = $mysqli->query("SELECT * FROM clients WHERE id = $client_id");
if ($result->num_rows > 0) {
$client = $result->fetch_assoc();
} else {
echo "<p>Cliente não encontrado.</p>";
exit();
}
} else {
echo "<p>ID do cliente não fornecido.</p>";
exit();
}
$mysqli->close();
?>
<!DOCTYPE html>
<html lang="pt-BR">
<head>
<meta charset="UTF-8">
<title>Editar Cliente</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="container">
<h2>Editar Cliente: <?php echo htmlspecialchars($client['name']); ?></h2>
<form action="index.php?page=edit_client&id=<?php echo $client_id; ?>" method="post">
<div class="form-group">
<label for="name">Nome:</label>
<input type="text" id="name" name="name" value="<?php echo htmlspecialchars($client['name']); ?>" required>
</div>
<div class="form-group">
<label for="cpf">CPF:</label>
<input type="text" id="cpf" name="cpf" value="<?php echo htmlspecialchars($client['cpf']); ?>" required>
</div>
<div class="form-group">
<label for="rg">RG:</label>
<input type="text" id="rg" name="rg" value="<?php echo htmlspecialchars($client['rg']); ?>">
</div>
<div class="form-group">
<label for="rg_emissor">Órgão Emissor:</label>
<input type="text" id="rg_emissor" name="rg_emissor" value="<?php echo htmlspecialchars($client['rg_emissor']); ?>">
</div>
<div class="form-group">
<label for="sexo">Sexo:</label>
<select id="sexo" name="sexo">
<option value="Masculino" <?php echo $client['sexo'] == 'Masculino' ? 'selected' : ''; ?>>Masculino</option>
<option value="Feminino" <?php echo $client['sexo'] == 'Feminino' ? 'selected' : ''; ?>>Feminino</option>
<option value="Não definido" <?php echo $client['sexo'] == 'Não definido' ? 'selected' : ''; ?>>Não definido</option>
</select>
</div>
<div class="form-group">
<label for="estado_civil">Estado Civil:</label>
<select id="estado_civil" name="estado_civil">
<option value="Solteiro(a)" <?php echo $client['estado_civil'] == 'Solteiro(a)' ? 'selected' : ''; ?>>Solteiro(a)</option>
<option value="Casado(a)" <?php echo $client['estado_civil'] == 'Casado(a)' ? 'selected' : ''; ?>>Casado(a)</option>
<option value="Viúvo(a)" <?php echo $client['estado_civil'] == 'Viúvo(a)' ? 'selected' : ''; ?>>Viúvo(a)</option>
<option value="União estável" <?php echo $client['estado_civil'] == 'União estável' ? 'selected' : ''; ?>>União estável</option>
</select>
</div>
<div class="form-group">
<label for="phone">Telefone:</label>
<input type="text" id="phone" name="phone" value="<?php echo htmlspecialchars($client['phone']); ?>">
<label for="whatsapp">WhatsApp:</label>
<input type="checkbox" id="whatsapp" name="whatsapp" <?php echo $client['whatsapp'] ? 'checked' : ''; ?>>
</div>
<div class="form-group">
<label for="email">Email:</label>
<input type="email" id="email" name="email" value="<?php echo htmlspecialchars($client['email']); ?>">
</div>
<div class="form-group">
<label for="senha_meu_inss">Senha do Meu INSS:</label>
<input type="text" id="senha_meu_inss" name="senha_meu_inss" value="<?php echo htmlspecialchars($client['senha_meu_inss']); ?>">
</div>
<div class="form-group">
<label for="perfil_instagram">Perfil do Instagram:</label>
<input type="text" id="perfil_instagram" name="perfil_instagram" value="<?php echo htmlspecialchars($client['perfil_instagram']); ?>">
</div>
<div class="form-group">
<label for="tipo_logradouro">Tipo de Logradouro:</label>
<select id="tipo_logradouro" name="tipo_logradouro">
<option value="Rua" <?php echo $client['tipo_logradouro'] == 'Rua' ? 'selected' : ''; ?>>Rua</option>
<option value="Avenida" <?php echo $client['tipo_logradouro'] == 'Avenida' ? 'selected' : ''; ?>>Avenida</option>
<option value="Alameda" <?php echo $client['tipo_logradouro'] == 'Alameda' ? 'selected' : ''; ?>>Alameda</option>
<option value="Travessa" <?php echo $client['tipo_logradouro'] == 'Travessa' ? 'selected' : ''; ?>>Travessa</option>
<option value="Largo" <?php echo $client['tipo_logradouro'] == 'Largo' ? 'selected' : ''; ?>>Largo</option>
<!-- Adicione mais opções conforme necessário -->
</select>
</div>
<div class="form-group">
<label for="endereco">Endereço:</label>
<input type="text" id="endereco" name="endereco" value="<?php echo htmlspecialchars($client['endereco']); ?>">
</div>
<div class="form-group">
<label for="bairro">Bairro:</label>
<input type="text" id="bairro" name="bairro" value="<?php echo htmlspecialchars($client['bairro']); ?>">
</div>
<div class="form-group">
<label for="cidade">Cidade:</label>
<input type="text" id="cidade" name="cidade" value="<?php echo htmlspecialchars($client['cidade']); ?>">
</div>
<div class="form-group">
<label for="estado">Estado:</label>
<select id="estado" name="estado">
<option value="AC" <?php echo $client['estado'] == 'AC' ? 'selected' : ''; ?>>Acre</option>
<option value="AL" <?php echo $client['estado'] == 'AL' ? 'selected' : ''; ?>>Alagoas</option>
<option value="AP" <?php echo $client['estado'] == 'AP' ? 'selected' : ''; ?>>Amapá</option>
<option value="AM" <?php echo $client['estado'] == 'AM' ? 'selected' : ''; ?>>Amazonas</option>
<option value="BA" <?php echo $client['estado'] == 'BA' ? 'selected' : ''; ?>>Bahia</option>
<option value="CE" <?php echo $client['estado'] == 'CE' ? 'selected' : ''; ?>>Ceará</option>
<option value="DF" <?php echo $client['estado'] == 'DF' ? 'selected' : ''; ?>>Distrito Federal</option>
<option value="ES" <?php echo $client['estado'] == 'ES' ? 'selected' : ''; ?>>Espírito Santo</option>
<option value="GO" <?php echo $client['estado'] == 'GO' ? 'selected' : ''; ?>>Goiás</option>
<option value="MA" <?php echo $client['estado'] == 'MA' ? 'selected' : ''; ?>>Maranhão</option>
<option value="MT" <?php echo $client['estado'] == 'MT' ? 'selected' : ''; ?>>Mato Grosso</option>
<option value="MS" <?php echo $client['estado'] == 'MS' ? 'selected' : ''; ?>>Mato Grosso do Sul</option>
<option value="MG" <?php echo $client['estado'] == 'MG' ? 'selected' : ''; ?>>Minas Gerais</option>
<option value="PA" <?php echo $client['estado'] == 'PA' ? 'selected' : ''; ?>>Pará</option>
<option value="PB" <?php echo $client['estado'] == 'PB' ? 'selected' : ''; ?>>Paraíba</option>
<option value="PR" <?php echo $client['estado'] == 'PR' ? 'selected' : ''; ?>>Paraná</option>
<option value="PE" <?php echo $client['estado'] == 'PE' ? 'selected' : ''; ?>>Pernambuco</option>
<option value="PI" <?php echo $client['estado'] == 'PI' ? 'selected' : ''; ?>>Piauí</option>
<option value="RJ" <?php echo $client['estado'] == 'RJ' ? 'selected' : ''; ?>>Rio de Janeiro</option>
<option value="RN" <?php echo $client['estado'] == 'RN' ? 'selected' : ''; ?>>Rio Grande do Norte</option>
<option value="RS" <?php echo $client['estado'] == 'RS' ? 'selected' : ''; ?>>Rio Grande do Sul</option>
<option value="RO" <?php echo $client['estado'] == 'RO' ? 'selected' : ''; ?>>Rondônia</option>
<option value="RR" <?php echo $client['estado'] == 'RR' ? 'selected' : ''; ?>>Roraima</option>
<option value="SC" <?php echo $client['estado'] == 'SC' ? 'selected' : ''; ?>>Santa Catarina</option>
<option value="SP" <?php echo $client['estado'] == 'SP' ? 'selected' : ''; ?>>São Paulo</option>
<option value="SE" <?php echo $client['estado'] == 'SE' ? 'selected' : ''; ?>>Sergipe</option>
<option value="TO" <?php echo $client['estado'] == 'TO' ? 'selected' : ''; ?>>Tocantins</option>
</select>
</div>
<div class="form-group">
<label for="cep">CEP:</label>
<input type="text" id="cep" name="cep" value="<?php echo htmlspecialchars($client['cep']); ?>">
</div>
<div class="form-group">
<label for="certidao_nascimento">Certidão de Nascimento/Casamento:</label>
<input type="text" id="certidao_nascimento" name="certidao_nascimento" value="<?php echo htmlspecialchars($client['certidao_nascimento']); ?>">
</div>
<div class="form-group">
<label for="pis_pasep">PIS/PASEP:</label>
<input type="text" id="pis_pasep" name="pis_pasep" value="<?php echo htmlspecialchars($client['pis_pasep']); ?>">
</div>
<div class="form-group">
<label for="inss_beneficio">Número do Benefício INSS:</label>
<input type="text" id="inss_beneficio" name="inss_beneficio" value="<?php echo htmlspecialchars($client['inss_beneficio']); ?>">
</div>
<div class="form-group">
<label for="filiacao_pai">Filiação (Pai):</label>
<input type="text" id="filiacao_pai" name="filiacao_pai" value="<?php echo htmlspecialchars($client['filiacao_pai']); ?>">
</div>
<div class="form-group">
<label for="filiacao_mae">Filiação (Mãe):</label>
<input type="text" id="filiacao_mae" name="filiacao_mae" value="<?php echo htmlspecialchars($client['filiacao_mae']); ?>">
</div>
<button type="submit">Atualizar</button>
</form>
</div>
</body>
</html>
+30
View File
@@ -0,0 +1,30 @@
<?php
// Verificar se o usuário está logado
session_start();
if (!isset($_SESSION['user_id'])) {
header("Location: login.php");
exit();
}
// Conectar ao banco de dados
$mysqli = new mysqli("10.15.0.42", "root", "34641747", "valida");
if ($mysqli->connect_error) {
die("Connection failed: " . $mysqli->connect_error);
}
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['id']) && isset($_POST['note'])) {
$note_id = $_POST['id'];
$note = $_POST['note'];
$stmt = $mysqli->prepare("UPDATE notes SET note = ? WHERE id = ?");
$stmt->bind_param("si", $note, $note_id);
$stmt->execute();
$stmt->close();
echo "Nota atualizada com sucesso!";
} else {
echo "Dados inválidos.";
}
$mysqli->close();
?>
+331
View File
@@ -0,0 +1,331 @@
<?php
// Verificar se o usuário está logado
if (!isset($_SESSION['user_id'])) {
header("Location: login.php");
exit();
}
// Definir quantos clientes serão exibidos por página
define('RESULTS_PER_PAGE', 20);
// Obter a página atual a partir do parâmetro 'page' na URL, padrão para 1
$page = isset($_GET['page']) && is_numeric($_GET['page']) ? (int) $_GET['page'] : 1;
// Calcular o deslocamento
$offset = ($page - 1) * RESULTS_PER_PAGE;
// Obter o termo de pesquisa, se houver
$search = isset($_GET['search']) ? trim($_GET['search']) : '';
// Conectar ao banco de dados
$mysqli = new mysqli("10.15.0.42", "root", "34641747", "valida");
// Verificar erros na conexão
if ($mysqli->connect_error) {
die("Falha na conexão: " . htmlspecialchars($mysqli->connect_error, ENT_QUOTES, 'UTF-8'));
}
// Preparar a consulta com pesquisa e paginação
if ($search !== '') {
// Utilizar consultas preparadas para prevenir SQL Injection
$stmt = $mysqli->prepare("
SELECT *
FROM clients
WHERE name LIKE CONCAT('%', ?, '%')
OR cpf LIKE CONCAT('%', ?, '%')
OR email LIKE CONCAT('%', ?, '%')
LIMIT ? OFFSET ?
");
$stmt->bind_param("sssii", $search, $search, $search, $limit, $offset);
} else {
$stmt = $mysqli->prepare("SELECT * FROM clients LIMIT ? OFFSET ?");
$stmt->bind_param("ii", $limit, $offset);
}
// Definir os parâmetros de limite e offset
$limit = RESULTS_PER_PAGE;
// Executar a consulta
$stmt->execute();
$result = $stmt->get_result();
?>
<!DOCTYPE html>
<html lang="pt-BR">
<head>
<meta charset="UTF-8">
<title>Listagem de Clientes</title>
<link rel="stylesheet" href="style.css">
<!-- Inclusão do Font Awesome para ícones -->
<script src="../script/formatacoes.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"
integrity="sha512-iecdLmaskl7CVkqkXNQ/ZH/XLlvWZOJyj7Yy7tcenmpD1ypASozpmT/E0iPtmFIB46ZmdtAc9eNBvH0H/ZpiBw=="
crossorigin="anonymous" referrerpolicy="no-referrer" />
<!-- Inclusão do jQuery e jQuery UI para autocomplete -->
<link rel="stylesheet" href="https://code.jquery.com/ui/1.13.2/themes/base/jquery-ui.css">
<script src="https://code.jquery.com/jquery-3.6.0.min.js"
crossorigin="anonymous"></script>
<script src="https://code.jquery.com/ui/1.13.2/jquery-ui.min.js"
crossorigin="anonymous"></script>
<style>
/* Estilização opcional para os ícones de ação */
.action-icons a, .action-icons button {
margin-right: 10px;
color: #333;
text-decoration: none;
transition: color 0.3s;
background: none;
border: none;
cursor: pointer;
font-size: 1em;
}
.action-icons a:hover, .action-icons button:hover {
color: #007BFF; /* Cor azul ao passar o mouse */
}
.action-icons button.delete {
color: #DC3545; /* Cor vermelha para excluir */
}
.action-icons button.delete:hover {
color: #C82333;
}
.action-icons a.edit {
color: #28A745; /* Cor verde para editar */
}
.action-icons a.edit:hover {
color: #218838;
}
/* Estilo para o botão de exclusão dentro do formulário */
.action-icons button.delete {
padding: 0;
}
/* Opcional: Estilização da tabela */
table {
width: 100%;
border-collapse: collapse;
margin-top: 20px;
}
table, th, td {
border: 1px solid #ddd;
padding: 8px;
}
th {
background-color: #f4f4f4;
text-align: left;
}
tr:nth-child(even) {
background-color: #f9f9f9;
}
.search-bar-clientes {
width: 1500px;
padding: 8px;
border-radius: 4px;
}
#search {
width: 300px;
padding: 8px;
font-size: 1em;
}
#search-button {
padding: 8px 12px;
font-size: 1em;
cursor: pointer;
background-color: #007BFF;
color: #fff;
border: none;
border-radius: 4px;
transition: background-color 0.3s;
}
#search-button:hover {
background-color: #0056b3;
}
/* Estilos para a paginação */
.pagination {
margin-top: 20px;
text-align: center;
}
.pagination a, .pagination span {
display: inline-block;
margin: 0 5px;
padding: 8px 12px;
text-decoration: none;
color: #007BFF;
border: 1px solid #ddd;
border-radius: 4px;
transition: background-color 0.3s, color 0.3s;
}
.pagination a:hover {
background-color: #007BFF;
color: #fff;
}
.pagination .current-page {
background-color: #007BFF;
color: #fff;
border-color: #007BFF;
}
</style>
</head>
<body>
<div class="container">
<h2>Lista de Clientes</h2>
<div class="search-bar-clientes">
<input type="text" id="search" placeholder="Pesquisar por nome, CPF ou email" value="<?php echo htmlspecialchars($search, ENT_QUOTES, 'UTF-8'); ?>">
<button type="button" id="search-button">Pesquisar</button>
</div>
<?php
if ($result->num_rows > 0) {
echo "<table>
<tr>
<th>Nome</th>
<th>CPF</th>
<th>Telefone</th>
<th>Email</th>
<th>Ações</th>
</tr>";
// Iterar sobre cada cliente
while($row = $result->fetch_assoc()) {
// Escapar saídas para prevenir XSS
$id = htmlspecialchars($row["id"], ENT_QUOTES, 'UTF-8');
$nome = htmlspecialchars($row["name"], ENT_QUOTES, 'UTF-8');
$cpf = htmlspecialchars($row["cpf"], ENT_QUOTES, 'UTF-8');
$telefone = htmlspecialchars($row["phone"], ENT_QUOTES, 'UTF-8');
$email = htmlspecialchars($row["email"], ENT_QUOTES, 'UTF-8');
echo "<tr>
<td><a href='index.php?page=client_details&id=$id'>$nome</a></td>
<td>$cpf</td>
<td>$telefone</td>
<td>$email</td>
<td class='action-icons'>
<!-- Ícone de Editar -->
<a href='index.php?page=edit_client&id=$id' class='edit' title='Editar Cliente'><i class='fas fa-edit'></i></a>
<!-- Formulário para Excluir com método POST -->
<form action='clientes/delete_client.php' method='post' onsubmit=\"return confirm('Tem certeza que deseja excluir este cliente?');\" style='display:inline;'>
<input type='hidden' name='id' value='$id'>
<button type='submit' class='delete' title='Excluir Cliente'><i class='fas fa-trash'></i></button>
</form>
</td>
</tr>";
}
echo "</table>";
// Fechar o statement
$stmt->close();
} else {
echo "<p>Nenhum cliente encontrado.</p>";
}
// Contar o total de clientes para a paginação
if ($search !== '') {
$count_stmt = $mysqli->prepare("
SELECT COUNT(*)
FROM clients
WHERE name LIKE CONCAT('%', ?, '%')
OR cpf LIKE CONCAT('%', ?, '%')
OR email LIKE CONCAT('%', ?, '%')
");
$count_stmt->bind_param("sss", $search, $search, $search);
} else {
$count_stmt = $mysqli->prepare("SELECT COUNT(*) FROM clients");
}
$count_stmt->execute();
$count_stmt->bind_result($total_clients);
$count_stmt->fetch();
$count_stmt->close();
// Calcular o total de páginas
$total_pages = ceil($total_clients / RESULTS_PER_PAGE);
// Exibir links de paginação se houver mais de uma página
if ($total_pages > 1) {
echo "<div class='pagination'>";
// Link para a página anterior
if ($page > 1) {
$prev_page = $page - 1;
$url = 'list_clients.php?page=' . $prev_page;
if ($search !== '') {
$url .= '&search=' . urlencode($search);
}
echo "<a href='$url'>&laquo; Anterior</a>";
}
// Links para cada página (limitando a 5 páginas visíveis)
$max_display = 5; // Número máximo de páginas a exibir
$start = max(1, $page - floor($max_display / 2));
$end = min($total_pages, $start + $max_display - 1);
if ($start > 1) {
echo "<a href='list_clients.php?page=1" . ($search !== '' ? '&search=' . urlencode($search) : '') . "'>1</a>";
if ($start > 2) {
echo "<span>...</span>";
}
}
for ($i = $start; $i <= $end; $i++) {
$url = 'list_clients.php?page=' . $i;
if ($search !== '') {
$url .= '&search=' . urlencode($search);
}
if ($i == $page) {
echo "<span class='current-page'>$i</span>";
} else {
echo "<a href='$url'>$i</a>";
}
}
if ($end < $total_pages) {
if ($end < $total_pages - 1) {
echo "<span>...</span>";
}
echo "<a href='list_clients.php?page=$total_pages" . ($search !== '' ? '&search=' . urlencode($search) : '') . "'>$total_pages</a>";
}
// Link para a próxima página
if ($page < $total_pages) {
$next_page = $page + 1;
$url = 'list_clients.php?page=' . $next_page;
if ($search !== '') {
$url .= '&search=' . urlencode($search);
}
echo "<a href='$url'>Próxima &raquo;</a>";
}
echo "</div>";
}
// Fechar a conexão com o banco de dados
$mysqli->close();
?>
</div>
<script>
$(document).ready(function() {
formatarTabela('table', 2, 3); // 'table' é o seletor da sua tabela, 2 e 3 são as colunas de CPF e Telefone
});
</script>
</body>
</html>
+203
View File
@@ -0,0 +1,203 @@
<?php
// Verificar se o usuário está logado
if (!isset($_SESSION['user_id'])) {
header("Location: login.php");
exit();
}
?>
<!DOCTYPE html>
<html lang="pt-BR">
<head>
<meta charset="UTF-8">
<title>Cadastro de Clientes</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="container">
<h2>Cadastro de Clientes</h2>
<form action="index.php?page=register_client" method="post">
<div class="form-group">
<label for="name">Nome:</label>
<input type="text" id="name" name="name" required>
</div>
<div class="form-group">
<label for="cpf">CPF:</label>
<input type="text" id="cpf" name="cpf" required>
</div>
<div class="form-group">
<label for="rg">RG:</label>
<input type="text" id="rg" name="rg">
</div>
<div class="form-group">
<label for="rg_emissor">Órgão Emissor:</label>
<input type="text" id="rg_emissor" name="rg_emissor">
</div>
<div class="form-group">
<label for="sexo">Sexo:</label>
<select id="sexo" name="sexo">
<option value="Masculino">Masculino</option>
<option value="Feminino">Feminino</option>
<option value="Não definido">Não definido</option>
</select>
</div>
<div class="form-group">
<label for="estado_civil">Estado Civil:</label>
<select id="estado_civil" name="estado_civil">
<option value="Solteiro(a)">Solteiro(a)</option>
<option value="Casado(a)">Casado(a)</option>
<option value="Viúvo(a)">Viúvo(a)</option>
<option value="União estável">União estável</option>
</select>
</div>
<div class="form-group">
<label for="phone">Telefone:</label>
<input type="text" id="phone" name="phone" >
<label for="whatsapp">WhatsApp:</label>
<input type="checkbox" id="whatsapp" name="whatsapp">
</div>
<div class="form-group">
<label for="email">Email:</label>
<input type="email" id="email" name="email">
</div>
<div class="form-group">
<label for="senha_meu_inss">Senha do Meu INSS:</label>
<input type="text" id="senha_meu_inss" name="senha_meu_inss">
</div>
<div class="form-group">
<label for="perfil_instagram">Perfil do Instagram:</label>
<input type="text" id="perfil_instagram" name="perfil_instagram">
</div>
<div class="form-group">
<label for="tipo_logradouro">Tipo de Logradouro:</label>
<select id="tipo_logradouro" name="tipo_logradouro">
<option value="Rua">Rua</option>
<option value="Avenida">Avenida</option>
<option value="Alameda">Alameda</option>
<option value="Travessa">Travessa</option>
<option value="Largo">Largo</option>
<!-- Adicione mais opções conforme necessário -->
</select>
</div>
<div class="form-group">
<label for="endereco">Endereço:</label>
<input type="text" id="endereco" name="endereco">
</div>
<div class="form-group">
<label for="bairro">Bairro:</label>
<input type="text" id="bairro" name="bairro">
</div>
<div class="form-group">
<label for="cidade">Cidade:</label>
<input type="text" id="cidade" name="cidade">
</div>
<div class="form-group">
<label for="estado">Estado:</label>
<select id="estado" name="estado">
<option value="AC">Acre</option>
<option value="AL">Alagoas</option>
<option value="AP">Amapá</option>
<option value="AM">Amazonas</option>
<option value="BA">Bahia</option>
<option value="CE">Ceará</option>
<option value="DF">Distrito Federal</option>
<option value="ES">Espírito Santo</option>
<option value="GO">Goiás</option>
<option value="MA">Maranhão</option>
<option value="MT">Mato Grosso</option>
<option value="MS">Mato Grosso do Sul</option>
<option value="MG">Minas Gerais</option>
<option value="PA">Pará</option>
<option value="PB">Paraíba</option>
<option value="PR">Paraná</option>
<option value="PE">Pernambuco</option>
<option value="PI">Piauí</option>
<option value="RJ">Rio de Janeiro</option>
<option value="RN">Rio Grande do Norte</option>
<option value="RS">Rio Grande do Sul</option>
<option value="RO">Rondônia</option>
<option value="RR">Roraima</option>
<option value="SC">Santa Catarina</option>
<option value="SP">São Paulo</option>
<option value="SE">Sergipe</option>
<option value="TO">Tocantins</option>
</select>
</div>
<div class="form-group">
<label for="cep">CEP:</label>
<input type="text" id="cep" name="cep">
</div>
<div class="form-group">
<label for="certidao_nascimento">Certidão de Nascimento/Casamento:</label>
<input type="text" id="certidao_nascimento" name="certidao_nascimento">
</div>
<div class="form-group">
<label for="pis_pasep">PIS/PASEP:</label>
<input type="text" id="pis_pasep" name="pis_pasep">
</div>
<div class="form-group">
<label for="inss_beneficio">Número do Benefício INSS:</label>
<input type="text" id="inss_beneficio" name="inss_beneficio">
</div>
<div class="form-group">
<label for="filiacao_pai">Filiação (Pai):</label>
<input type="text" id="filiacao_pai" name="filiacao_pai">
</div>
<div class="form-group">
<label for="filiacao_mae">Filiação (Mãe):</label>
<input type="text" id="filiacao_mae" name="filiacao_mae">
</div>
<button type="submit">Cadastrar</button>
</form>
<?php
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
// Obter os dados do formulário
$name = $_POST['name'];
$cpf = $_POST['cpf'];
$rg = $_POST['rg'];
$rg_emissor = $_POST['rg_emissor'];
$sexo = $_POST['sexo'];
$estado_civil = $_POST['estado_civil'];
$phone = $_POST['phone'];
$whatsapp = isset($_POST['whatsapp']) ? 1 : 0;
$email = $_POST['email'];
$senha_meu_inss = $_POST['senha_meu_inss'];
$perfil_instagram = $_POST['perfil_instagram'];
$tipo_logradouro = $_POST['tipo_logradouro'];
$endereco = $_POST['endereco'];
$bairro = $_POST['bairro'];
$cidade = $_POST['cidade'];
$estado = $_POST['estado'];
$cep = $_POST['cep'];
$certidao_nascimento = $_POST['certidao_nascimento'];
$pis_pasep = $_POST['pis_pasep'];
$inss_beneficio = $_POST['inss_beneficio'];
$filiacao_pai = $_POST['filiacao_pai'];
$filiacao_mae = $_POST['filiacao_mae'];
// Conectar ao banco de dados
$mysqli = new mysqli("10.15.0.42", "root", "34641747", "valida");
if ($mysqli->connect_error) {
die("Connection failed: " . $mysqli->connect_error);
}
$stmt = $mysqli->prepare("INSERT INTO clients (name, cpf, rg, rg_emissor, tipo_logradouro, endereco, bairro, cidade, estado, cep, phone, whatsapp, email, sexo, estado_civil, senha_meu_inss, perfil_instagram, certidao_nascimento, pis_pasep, inss_beneficio, filiacao_pai, filiacao_mae) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
if ($stmt) {
$stmt->bind_param("ssssssssssssssssssssss", $name, $cpf, $rg, $rg_emissor, $tipo_logradouro, $endereco, $bairro, $cidade, $estado, $cep, $phone, $whatsapp, $email, $sexo, $estado_civil, $senha_meu_inss, $perfil_instagram, $certidao_nascimento, $pis_pasep, $inss_beneficio, $filiacao_pai, $filiacao_mae);
if ($stmt->execute()) {
header("Location: index.php?page=client_details&id=$client_id");
} else {
echo "<p>Erro ao cadastrar cliente.</p>";
}
$stmt->close();
} else {
echo "<p>Erro ao preparar a consulta.</p>";
}
$mysqli->close();
}
?>
</div>
</body>
</html>
+5
View File
@@ -0,0 +1,5 @@
{
"require": {
"tecnickcom/tcpdf": "^6.7"
}
}
Generated
+91
View File
@@ -0,0 +1,91 @@
{
"_readme": [
"This file locks the dependencies of your project to a known state",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "a607f866b3f01ae9ad4f413456987bbb",
"packages": [
{
"name": "tecnickcom/tcpdf",
"version": "6.7.7",
"source": {
"type": "git",
"url": "https://github.com/tecnickcom/TCPDF.git",
"reference": "cfbc0028cc23f057f2baf9e73bdc238153c22086"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/tecnickcom/TCPDF/zipball/cfbc0028cc23f057f2baf9e73bdc238153c22086",
"reference": "cfbc0028cc23f057f2baf9e73bdc238153c22086",
"shasum": ""
},
"require": {
"php": ">=5.5.0"
},
"type": "library",
"autoload": {
"classmap": [
"config",
"include",
"tcpdf.php",
"tcpdf_parser.php",
"tcpdf_import.php",
"tcpdf_barcodes_1d.php",
"tcpdf_barcodes_2d.php",
"include/tcpdf_colors.php",
"include/tcpdf_filters.php",
"include/tcpdf_font_data.php",
"include/tcpdf_fonts.php",
"include/tcpdf_images.php",
"include/tcpdf_static.php",
"include/barcodes/datamatrix.php",
"include/barcodes/pdf417.php",
"include/barcodes/qrcode.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"LGPL-3.0-or-later"
],
"authors": [
{
"name": "Nicola Asuni",
"email": "info@tecnick.com",
"role": "lead"
}
],
"description": "TCPDF is a PHP class for generating PDF documents and barcodes.",
"homepage": "http://www.tcpdf.org/",
"keywords": [
"PDFD32000-2008",
"TCPDF",
"barcodes",
"datamatrix",
"pdf",
"pdf417",
"qrcode"
],
"support": {
"issues": "https://github.com/tecnickcom/TCPDF/issues",
"source": "https://github.com/tecnickcom/TCPDF/tree/6.7.7"
},
"funding": [
{
"url": "https://www.paypal.com/cgi-bin/webscr?cmd=_donations&currency_code=GBP&business=paypal@tecnick.com&item_name=donation%20for%20tcpdf%20project",
"type": "custom"
}
],
"time": "2024-10-26T12:15:02+00:00"
}
],
"packages-dev": [],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": {},
"prefer-stable": false,
"prefer-lowest": false,
"platform": {},
"platform-dev": {},
"plugin-api-version": "2.6.0"
}
+19
View File
@@ -0,0 +1,19 @@
<?php
// Crie um script temporário para adicionar um usuário
$mysqli = new mysqli("10.15.0.42", "root", "34641747", "valida");
if ($mysqli->connect_error) {
die("Connection failed: " . $mysqli->connect_error);
}
$username = 'rodrigo';
$password = password_hash('34641747', PASSWORD_DEFAULT); // Hash da senha
$stmt = $mysqli->prepare("INSERT INTO users (username, password) VALUES (?, ?)");
$stmt->bind_param("ss", $username, $password);
$stmt->execute();
$stmt->close();
$mysqli->close();
echo "Usuário administrador criado com sucesso.";
?>
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 798 B

+92
View File
@@ -0,0 +1,92 @@
<?php
ob_start();
session_start();
// Verificar se o usuário está logado
if (!isset($_SESSION['user_id'])) {
header("Location: login.php");
exit();
}
?>
<!DOCTYPE html>
<html lang="pt-BR">
<head>
<meta charset="UTF-8">
<title>Sistema de Ferramentas</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="style.css">
<script src="script.js"></script>
<link rel="stylesheet" href="https://code.jquery.com/ui/1.13.2/themes/base/jquery-ui.css">
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="https://code.jquery.com/ui/1.13.2/jquery-ui.min.js"></script>
</head>
<body>
<?php
include 'menu.php';
include 'top_menu.php';
?>
<div class="content">
<?php
if (isset($_GET['page'])) {
$page = $_GET['page'];
if ($page == 'upload') {
include 'prova/upload_prova.php';
} elseif ($page == 'status') {
include 'prova/status.php';
} elseif ($page == 'list_files') {
include 'prova/list_files.php';
} elseif ($page == 'register_client') {
include 'clientes/register_client.php';
} elseif ($page == 'list_clients') {
include 'clientes/list_clients.php';
} elseif ($page == 'client_details' && isset($_GET['id'])) {
include 'clientes/client_details.php';
} elseif ($page == 'edit_client' && isset($_GET['id'])) {
include 'clientes/edit_client.php';
} elseif ($page == 'delete_client' && isset($_GET['id'])) {
include 'clientes/delete_client.php';
} elseif ($page == 'edit_note' && isset($_POST['id'])) {
include 'clientes/edit_note.php';
} elseif ($page == 'delete_note' && isset($_POST['id'])) {
include 'clientes/delete_note.php';
} else {
echo "<h2>Bem-vindo ao Sistema de Ferramentas</h2>";
}
} else {
echo "<h2>Bem-vindo ao Sistema de Ferramentas</h2>";
}
?>
</div>
<script>
$(document).ready(function(){
$("#search").autocomplete({
source: "clientes/autocomplete.php",
minLength: 2,
select: function(event, ui) {
if (ui.item.id) {
window.location.href = 'index.php?page=client_details&id=' + ui.item.id;
}
}
});
$("#search-button").click(function(){
var query = $("#search").val().trim();
if(query !== ""){
window.location.href = 'index.php?page=list_clients&search=' + encodeURIComponent(query);
} else {
window.location.href = 'index.php?page=list_clients';
}
});
$("#search").keypress(function(e){
if(e.which == 13){
$("#search-button").click();
}
});
});
</script>
</body>
</html>
+124
View File
@@ -0,0 +1,124 @@
<?php
session_start();
if (!isset($_SESSION['login_attempts'])) {
$_SESSION['login_attempts'] = 0;
}
if ($_SESSION['login_attempts'] >= 5) {
die("Muitas tentativas de login. Por favor, tente novamente mais tarde.");
}
// Após uma tentativa de login falha, incremente:
$_SESSION['login_attempts'] += 1;
// Redirecionar para a página principal se já estiver logado
if (isset($_SESSION['user_id'])) {
header("Location: index.php");
exit();
}
$message = '';
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
// Conectar ao banco de dados
$mysqli = new mysqli("10.15.0.42", "root", "34641747", "valida");
if ($mysqli->connect_error) {
die("Connection failed: " . $mysqli->connect_error);
}
$username = $mysqli->real_escape_string($_POST['username']);
$password = $_POST['password'];
// Buscar o usuário no banco de dados
$stmt = $mysqli->prepare("SELECT id, password FROM users WHERE username = ?");
$stmt->bind_param("s", $username);
$stmt->execute();
$stmt->store_result();
if ($stmt->num_rows == 1) {
$stmt->bind_result($user_id, $hashed_password);
$stmt->fetch();
if (password_verify($password, $hashed_password)) {
// Senha correta; iniciar a sessão
$_SESSION['user_id'] = $user_id;
$_SESSION['username'] = $username;
header("Location: index.php");
exit();
} else {
$message = "Senha incorreta.";
}
} else {
$message = "Usuário não encontrado.";
}
$stmt->close();
$mysqli->close();
}
?>
<!DOCTYPE html>
<html lang="pt-BR">
<head>
<meta charset="UTF-8">
<title>Login - Sistema de Ferramentas</title>
<link rel="stylesheet" href="style.css">
<style>
/* Estilos básicos para o formulário de login */
.login-container {
max-width: 400px;
margin: 100px auto;
padding: 20px;
background-color: white;
border-radius: 5px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
.login-container h2 {
text-align: center;
}
.login-container .form-group {
margin-bottom: 15px;
}
.login-container .form-group label {
display: block;
margin-bottom: 5px;
}
.login-container .form-group input {
width: 100%;
padding: 8px;
box-sizing: border-box;
}
.login-container .error {
color: red;
text-align: center;
margin-bottom: 15px;
}
.login-container button {
width: 100%;
padding: 10px;
}
</style>
</head>
<body>
<div class="login-container">
<h2>Login</h2>
<?php if ($message): ?>
<p class="error"><?php echo htmlspecialchars($message); ?></p>
<?php endif; ?>
<form action="login.php" method="post">
<div class="form-group">
<label for="username">Usuário:</label>
<input type="text" id="username" name="username" required autofocus>
</div>
<div class="form-group">
<label for="password">Senha:</label>
<input type="password" id="password" name="password" required>
</div>
<button type="submit">Entrar</button>
</form>
</div>
</body>
</html>
+1
View File
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="500" zoomAndPan="magnify" viewBox="0 0 375 374.999991" height="500" preserveAspectRatio="xMidYMid meet" version="1.0"><defs><g/></defs><g fill="#20337b" fill-opacity="1"><g transform="translate(63.908664, 213.264977)"><g><path d="M 117.9375 -64.84375 C 117.8125 -64.519531 117.6875 -64.195312 117.5625 -63.875 C 116.300781 -60.613281 114.945312 -57.40625 113.5 -54.25 C 106.007812 -38.6875 97.96875 -23.628906 89.375 -9.078125 C 86.582031 -4.390625 83.722656 0.21875 80.796875 4.75 C 77.878906 9.28125 74.941406 13.796875 71.984375 18.296875 C 71.285156 19.359375 70.578125 20.414062 69.859375 21.46875 C 69.828125 21.5625 69.789062 21.625 69.75 21.65625 C 69.59375 21.976562 69.40625 22.242188 69.1875 22.453125 C 68.976562 22.671875 68.691406 22.78125 68.328125 22.78125 C 68.171875 22.78125 68 22.738281 67.8125 22.65625 C 67.632812 22.582031 67.492188 22.484375 67.390625 22.359375 C 67.296875 22.242188 67.234375 22.066406 67.203125 21.828125 C 67.171875 21.585938 67.1875 21.394531 67.25 21.25 C 67.738281 20.21875 68.28125 19.234375 68.875 18.296875 C 70.195312 16.128906 71.53125 13.960938 72.875 11.796875 C 75.394531 7.765625 77.875 3.722656 80.3125 -0.328125 C 85.726562 -9.347656 90.894531 -18.5625 95.8125 -27.96875 C 100.738281 -37.375 105.550781 -46.878906 110.25 -56.484375 C 112.132812 -60.191406 113.6875 -64.160156 114.90625 -68.390625 C 115.15625 -69.117188 115.34375 -69.878906 115.46875 -70.671875 C 115.601562 -71.460938 115.671875 -72.273438 115.671875 -73.109375 C 115.546875 -74.921875 114.78125 -75.710938 113.375 -75.484375 C 112.113281 -75.234375 110.929688 -74.835938 109.828125 -74.296875 C 107.191406 -73.023438 104.59375 -71.617188 102.03125 -70.078125 C 88.269531 -61.734375 75.738281 -51.367188 64.4375 -38.984375 C 64.269531 -38.785156 64.09375 -38.585938 63.90625 -38.390625 C 60 -34.148438 56.125 -29.867188 52.28125 -25.546875 C 48.4375 -21.234375 44.703125 -16.789062 41.078125 -12.21875 C 40.328125 -11.269531 39.539062 -10.382812 38.71875 -9.5625 C 37.84375 -8.65625 36.796875 -8.296875 35.578125 -8.484375 C 35.054688 -8.554688 34.628906 -8.8125 34.296875 -9.25 C 33.960938 -9.695312 33.832031 -10.210938 33.90625 -10.796875 C 34.15625 -12.410156 34.515625 -13.972656 34.984375 -15.484375 C 36.429688 -20.242188 37.972656 -24.941406 39.609375 -29.578125 C 39.835938 -30.296875 40.050781 -30.988281 40.25 -31.65625 C 40.675781 -33.394531 41.285156 -35 42.078125 -36.46875 C 42.078125 -36.5 42.0625 -36.515625 42.03125 -36.515625 C 41.832031 -36.617188 41.632812 -36.703125 41.4375 -36.765625 C 41.238281 -36.828125 41.039062 -36.765625 40.84375 -36.578125 C 40.125 -35.785156 39.4375 -34.957031 38.78125 -34.09375 C 33.332031 -26.71875 27.9375 -19.273438 22.59375 -11.765625 C 17.257812 -4.265625 12.046875 3.363281 6.953125 11.125 C 6.523438 11.875 6.046875 12.484375 5.515625 12.953125 C 4.992188 13.429688 4.289062 13.59375 3.40625 13.4375 C 3.019531 13.332031 2.71875 13.085938 2.5 12.703125 C 2.28125 12.328125 2.234375 11.960938 2.359375 11.609375 C 2.828125 10.546875 3.335938 9.539062 3.890625 8.59375 C 5.472656 5.875 7.035156 3.15625 8.578125 0.4375 C 11.671875 -4.957031 14.738281 -10.378906 17.78125 -15.828125 C 22.507812 -24.171875 26.726562 -32.957031 30.4375 -42.1875 C 31.894531 -45.726562 33.078125 -49.453125 33.984375 -53.359375 C 34.492188 -55.441406 34.710938 -57.613281 34.640625 -59.875 C 34.398438 -63.488281 33.195312 -66.070312 31.03125 -67.625 C 28.863281 -69.1875 26.015625 -69.925781 22.484375 -69.84375 C 18.960938 -69.769531 15.050781 -69.050781 10.75 -67.6875 C 6.445312 -66.320312 2.039062 -64.519531 -2.46875 -62.28125 C -6.988281 -60.039062 -11.34375 -57.566406 -15.53125 -54.859375 C -19.71875 -52.160156 -23.445312 -49.421875 -26.71875 -46.640625 C -29.988281 -43.867188 -32.539062 -41.265625 -34.375 -38.828125 C -36.289062 -36.140625 -37.921875 -33.179688 -39.265625 -29.953125 C -39.941406 -28.421875 -40.332031 -26.75 -40.4375 -24.9375 C -40.476562 -24.582031 -40.660156 -24.3125 -40.984375 -24.125 C -41.304688 -23.945312 -41.660156 -23.894531 -42.046875 -23.96875 C -42.679688 -24.164062 -43.078125 -24.660156 -43.234375 -25.453125 C -43.335938 -26.484375 -43.257812 -27.429688 -43 -28.296875 C -42.40625 -30.460938 -41.613281 -32.515625 -40.625 -34.453125 C -38.820312 -37.835938 -36.070312 -41.289062 -32.375 -44.8125 C -28.6875 -48.34375 -24.390625 -51.722656 -19.484375 -54.953125 C -14.578125 -58.191406 -9.453125 -61.078125 -4.109375 -63.609375 C 1.222656 -66.148438 6.441406 -68.125 11.546875 -69.53125 C 16.660156 -70.9375 21.265625 -71.566406 25.359375 -71.421875 C 29.453125 -71.273438 32.679688 -70.148438 35.046875 -68.046875 C 37.410156 -65.941406 38.554688 -62.625 38.484375 -58.09375 C 38.359375 -55.175781 37.898438 -52.398438 37.109375 -49.765625 C 35.960938 -45.890625 34.640625 -42.144531 33.140625 -38.53125 C 31.648438 -34.925781 30.0625 -31.398438 28.375 -27.953125 C 27.851562 -26.867188 27.738281 -2Line truncated

After

Width:  |  Height:  |  Size: 15 KiB

+7
View File
@@ -0,0 +1,7 @@
<?php
session_start();
session_unset();
session_destroy();
header("Location: login.php");
exit();
?>
+29
View File
@@ -0,0 +1,29 @@
<?php
// Verificar se o usuário está logado
if (!isset($_SESSION['user_id'])) {
header("Location: login.php");
exit();
}
?>
<div class="sidebar">
<h2>Ferramentas</h2>
<ul>
<li>
<a href="javascript:void(0);" onclick="toggleSubmenu('submenu1')">Autenticador de Provas Digitais</a>
<ul id="submenu1" class="submenu">
<li><a href="index.php?page=upload">Upload de Arquivos</a></li>
<li><a href="index.php?page=status">Ver Status</a></li>
<li><a href="index.php?page=list_files">Lista de Arquivos Processados</a></li>
</ul>
</li>
<li>
<a href="javascript:void(0);" onclick="toggleSubmenu('submenu2')">Clientes</a>
<ul id="submenu2" class="submenu">
<li><a href="index.php?page=register_client">Cadastro de Clientes</a></li>
<li><a href="index.php?page=list_clients">Listagem de Clientes</a></li>
</ul>
</li>
<!-- Adicione mais ferramentas aqui -->
</ul>
</div>
+78439
View File
File diff suppressed because it is too large. Load diff
+144
View File
@@ -0,0 +1,144 @@
<?php
// Verificar se o usuário está logado
if (!isset($_SESSION['user_id'])) {
header("Location: login.php");
exit();
}
$processed_dir = './processed/';
date_default_timezone_set('America/Araguaina');
if (is_dir($processed_dir)) {
$files = scandir($processed_dir);
$files = array_diff($files, array('.', '..'));
usort($files, function($a, $b) use ($processed_dir) {
return filemtime($processed_dir . $b) - filemtime($processed_dir . $a);
});
} else {
$files = [];
}
// Paginação
$files_per_page = 10;
$total_files = count($files);
$total_pages = ceil($total_files / $files_per_page);
$current_page = isset($_GET['page_num']) ? (int)$_GET['page_num'] : 1;
$current_page = max(1, min($total_pages, $current_page));
$start_index = ($current_page - 1) * $files_per_page;
$paginated_files = array_slice($files, $start_index, $files_per_page);
?>
<!DOCTYPE html>
<html lang="pt-BR">
<head>
<meta charset="UTF-8">
<title>Lista de Arquivos Processados</title>
<link href="https://cdnjs.cloudflare.com/ajax/libs/lightbox2/2.11.3/css/lightbox.min.css" rel="stylesheet" />
<style>
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px; text-align: left; border-bottom: 1px solid #ddd; }
th { background-color: #f4f4f4; }
a.download-link { color: #007BFF; text-decoration: none; }
a.download-link:hover { text-decoration: underline; }
.pagination { margin-top: 20px; text-align: center; }
.pagination a { margin: 0 5px; text-decoration: none; color: #007BFF; }
.pagination a:hover { text-decoration: underline; }
.lightbox-container {
display: none;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.8);
justify-content: center;
align-items: center;
z-index: 1000;
}
.lightbox-content {
width: 80%;
height: 80%;
background-color: #fff;
padding: 20px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
position: relative;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.lightbox-content iframe {
width: 100%;
height: 100%;
}
.lightbox-close {
position: absolute;
top: 10px;
right: 10px;
background-color: #333;
color: #fff;
border: none;
padding: 5px 10px;
cursor: pointer;
}
</style>
</head>
<body>
<div class="container">
<h2>Lista de Arquivos Processados</h2>
<table>
<thead>
<tr>
<th>Nome do Arquivo</th>
<th>Data de Modificação</th>
</tr>
</thead>
<tbody>
<?php foreach ($paginated_files as $file): ?>
<tr>
<td>
<a class="download-link" href="#" data-file="<?php echo 'processed/' . urlencode($file); ?>" data-title="<?php echo htmlspecialchars($file); ?>">
<?php echo htmlspecialchars($file); ?>
</a>
</td>
<td><?php echo date("d/m/Y H:i:s", filemtime($processed_dir . $file)); ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<div class="pagination">
<?php if ($current_page > 1): ?>
<a href="index.php?page=list_files&page_num=<?php echo $current_page - 1; ?>">&laquo; Anterior</a>
<?php endif; ?>
<?php for ($i = 1; $i <= $total_pages; $i++): ?>
<a href="index.php?page=list_files&page_num=<?php echo $i; ?>" <?php if ($i == $current_page) echo 'style="font-weight: bold;"'; ?>><?php echo $i; ?></a>
<?php endfor; ?>
<?php if ($current_page < $total_pages): ?>
<a href="index.php?page=list_files&page_num=<?php echo $current_page + 1; ?>">Próximo &raquo;</a>
<?php endif; ?>
</div>
</div>
<div id="lightbox" class="lightbox-container">
<div class="lightbox-content">
<button class="lightbox-close" onclick="closeLightbox()">Fechar</button>
<iframe id="lightbox-iframe" src="" frameborder="0"></iframe>
</div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script>
$(document).ready(function() {
$('.download-link').on('click', function(e) {
e.preventDefault();
var fileUrl = $(this).data('file');
$('#lightbox-iframe').attr('src', fileUrl);
$('#lightbox').css('display', 'flex'); // Usar flex para centralizar
});
});
function closeLightbox() {
$('#lightbox').hide();
$('#lightbox-iframe').attr('src', '');
}
</script>
</body>
</html>
+508
View File
@@ -0,0 +1,508 @@
<?php
// process_queue.php
ini_set('memory_limit', '512M');
date_default_timezone_set('America/Araguaina');
// Aumentar o tempo máximo de execução do script para 300 segundos (5 minutos)
set_time_limit(300);
// Verifique se a extensão `pcntl` está disponível
if (!function_exists('pcntl_fork')) {
die("A extensão pcntl não está disponível. Por favor, habilite-a para continuar.\n");
}
// Definir o número máximo de processos filhos
define('MAX_CHILDREN', 3);
$childProcesses = [];
// Função para registrar logs
function log_message($message, $level = 'INFO') {
$timestamp = date("Y-m-d H:i:s P"); // Inclui o fuso horário
// Apenas logar mensagens de nível INFO, ERROR e WARN
if (in_array($level, ['INFO', 'ERROR', 'WARN'])) {
file_put_contents('/var/log/process_queue.log', "[$timestamp] [$level] $message\n", FILE_APPEND);
}
}
log_message("Script iniciado.", 'INFO');
function process_file($row) {
// Cada processo filho deve estabelecer sua própria conexão com o banco de dados
$mysqli = new mysqli("10.15.0.42", "root", "34641747", "valida");
if ($mysqli->connect_error) {
log_message("Connection failed: " . $mysqli->connect_error, 'ERROR');
exit(1); // Sair com erro
}
// Assegurar que as mensagens de log incluam o ID do processo
$process_id = getmypid();
log_message("Processo $process_id: Processando arquivo ID " . $row['id'] . ": " . $row['file_path'], 'INFO');
try {
$file_path = $row['file_path'];
$queue_id = $row['id'];
$user_agent = $row['user_agent'];
$ip_address = $row['ip_address'];
$host_name = $row['host_name'];
$access_time = $row['access_time'] . ' ' . date("P"); // Adiciona fuso horário
$language = $row['language'];
$referer = $row['referer'];
$protocol = $row['protocol'];
$connection = $row['connection'];
$viewport_width = $row['viewport_width'];
$viewport_height = $row['viewport_height'];
$original_location = $row['original_location']; // Novo campo para localização original
// Recuperar a porta do cliente
$result_port = $mysqli->query("SELECT port FROM client_ports WHERE queue_id = $queue_id");
$client_port = $result_port->fetch_assoc()['port'] ?? 'N/A';
$result_port->free();
// Atualizar status para 'processing'
$stmt_update = $mysqli->prepare("UPDATE queue SET status = 'processing' WHERE id = ?");
$stmt_update->bind_param("i", $queue_id);
$stmt_update->execute();
$stmt_update->close();
log_message("Processo $process_id: Atualizou status para 'processing' para o arquivo ID $queue_id.", 'INFO');
// Gerar checksums
$checksums = generate_checksums($file_path);
// Capturar data e hora
$file_datetime = get_file_datetime($file_path);
// Registrar timestamp usando OpenTimestamps
$timestamp_result = register_timestamp_opentimestamps($file_path);
$signature_time = date("d/m/Y H:i:s P"); // Inclui fuso horário
if ($timestamp_result['success']) {
$ots_base64 = $timestamp_result['ots_base64'];
// Coletar dados do dispositivo
$device_data = [
'User Agent' => $user_agent,
'IP Address' => $ip_address . ':' . $client_port,
'Host Name' => $host_name,
'Access Time' => $access_time,
'Language' => $language,
'Referer' => $referer,
'Protocol' => $protocol,
'Connection' => $connection,
'Viewport Width' => $viewport_width,
'Viewport Height' => $viewport_height,
'Original Location' => $original_location // Adicionado
];
// Gerar PDF
$pdf_path = generate_pdf($file_path, [
'name' => basename($file_path),
'creation_time' => $file_datetime['creation_time'] . ' ' . date("P", filectime($file_path)),
'modification_time' => $file_datetime['modification_time'] . ' ' . date("P", filemtime($file_path)),
'upload_time' => $access_time,
'signature_time' => $signature_time
], $checksums, $device_data, $ots_base64);
// Atualizar status para 'completed'
$stmt_complete = $mysqli->prepare("UPDATE queue SET status = 'completed' WHERE id = ?");
$stmt_complete->bind_param("i", $queue_id);
$stmt_complete->execute();
$stmt_complete->close();
log_message("Processo $process_id: Processamento concluído para arquivo ID $queue_id: $file_path", 'INFO');
} else {
// Atualizar status para 'error'
$stmt_error = $mysqli->prepare("UPDATE queue SET status = 'error' WHERE id = ?");
$stmt_error->bind_param("i", $queue_id);
$stmt_error->execute();
$stmt_error->close();
log_message("Processo $process_id: Erro ao processar arquivo ID $queue_id: " . $timestamp_result['message'], 'ERROR');
}
} catch (Exception $e) {
// Atualizar status para 'error'
$stmt_exception = $mysqli->prepare("UPDATE queue SET status = 'error' WHERE id = ?");
$stmt_exception->bind_param("i", $queue_id);
$stmt_exception->execute();
$stmt_exception->close();
log_message("Processo $process_id: Exceção ao processar arquivo ID $queue_id: " . $e->getMessage(), 'ERROR');
}
$mysqli->close();
log_message("Processo $process_id: Fechou conexão com o banco de dados para o arquivo ID $queue_id.", 'INFO');
}
// Funções auxiliares (generate_checksums, get_file_datetime, register_timestamp_opentimestamps, generate_pdf)
// Mantenha estas funções como estão no seu código original, sem alterações. Certifique-se de que as funções não dependam de conexões globais de banco de dados.
require_once __DIR__ . '../../vendor/autoload.php';
// Função para gerar checksums
function generate_checksums($file_path) {
log_message("Gerando checksums para $file_path", 'INFO');
$start_time = microtime(true);
// Carregar o conteúdo do arquivo uma única vez
$file_content = file_get_contents($file_path);
$checksums = [
'sha256' => hash('sha256', $file_content),
'sha512' => hash('sha512', $file_content),
'md5' => hash('md5', $file_content)
];
$end_time = microtime(true);
log_message("Checksums gerados em " . round($end_time - $start_time, 4) . " segundos", 'INFO');
return $checksums;
}
// Função para capturar data e hora do arquivo
function get_file_datetime($file_path) {
log_message("Obtendo data e hora do arquivo para $file_path", 'INFO');
$start_time = microtime(true);
$creation_time = date("d/m/Y H:i:s P", filectime($file_path));
$modification_time = date("d/m/Y H:i:s P", filemtime($file_path));
$end_time = microtime(true);
log_message("Data e hora obtidas em " . round($end_time - $start_time, 4) . " segundos", 'INFO');
return [
'creation_time' => $creation_time,
'modification_time' => $modification_time
];
}
// Função para registrar timestamp usando OpenTimestamps
function register_timestamp_opentimestamps($file_path) {
log_message("Registrando timestamp para $file_path", 'INFO');
$start_time = microtime(true);
// Definir diretório de cache para OTS
$ots_cache_dir = '/var/www/html/ots_cache';
if (!is_dir($ots_cache_dir)) {
log_message("Diretório de cache OTS não existe. Criando em $ots_cache_dir", 'INFO');
if (!mkdir($ots_cache_dir, 0755, true)) {
log_message("Erro ao criar diretório de cache OTS: $ots_cache_dir", 'ERROR');
return ['success' => false, 'message' => "Erro ao criar diretório de cache OTS: $ots_cache_dir"];
}
chmod($ots_cache_dir, 0755); // Ajustar permissões
}
// Definir a variável de ambiente antes de executar o comando
$command_stamp = "OTS_CACHE_DIRECTORY=" . escapeshellarg($ots_cache_dir) . " ots stamp " . escapeshellarg($file_path) . " 2>&1";
log_message("Comando para executar: $command_stamp", 'INFO');
// Executar o comando
exec($command_stamp, $output_stamp, $return_var_stamp);
// Verificar o resultado da execução
if ($return_var_stamp !== 0) {
log_message("Erro ao registrar timestamp: " . implode("\n", $output_stamp), 'ERROR');
return ['success' => false, 'message' => 'Erro ao registrar timestamp: ' . implode("\n", $output_stamp)];
}
// Definir o caminho do arquivo .ots gerado
$ots_file = "{$file_path}.ots";
// Verificar se o arquivo .ots foi criado
if (!file_exists($ots_file)) {
log_message("Arquivo de timestamp não encontrado: $ots_file", 'ERROR');
return ['success' => false, 'message' => "Arquivo de timestamp não encontrado: $ots_file"];
}
// Codificar o arquivo .ots em base64
$ots_base64 = base64_encode(file_get_contents($ots_file));
$end_time = microtime(true);
log_message("Timestamp registrado e codificado em " . round($end_time - $start_time, 4) . " segundos", 'INFO');
return ['success' => true, 'ots_base64' => $ots_base64];
}
// Função para gerar PDF
function generate_pdf($uploaded_file_path, $document_info, $checksums, $device_data, $ots_base64) {
log_message("Gerando PDF para $uploaded_file_path", 'INFO');
$start_time = microtime(true);
// Criar uma nova instância do TCPDF
$pdf = new TCPDF();
// Configurações iniciais do PDF
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor('Seu Nome ou Empresa');
$pdf->SetTitle('Prova de Autenticidade de Documento');
$pdf->SetSubject('Timestamping e Checksums');
// Remover as margens padrão
$pdf->SetMargins(10, 10, 10);
$pdf->SetHeaderMargin(0);
$pdf->SetFooterMargin(0);
// Desativar cabeçalhos e rodapés automáticos
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);
// Configurar a fonte padrão uma vez
$pdf->SetFont('helvetica', '', 10);
// Verificar o tipo de arquivo para incorporar no PDF
$file_info = pathinfo($uploaded_file_path);
$extension = strtolower($file_info['extension']);
// Configurar o diretório temporário para o ImageMagick
$temp_dir = '/tmp/imagick';
if (!is_dir($temp_dir)) {
mkdir($temp_dir, 0777, true);
}
chmod($temp_dir, 0777); // Garantir permissões totais
// Configurar o diretório temporário para as imagens
$tmp_dir = '/tmp/image';
if (!is_dir($tmp_dir)) {
mkdir($tmp_dir, 0777, true);
}
chmod($tmp_dir, 0777); // Garantir permissões totais
// Criar uma única instância de Imagick
$imagick = new Imagick();
// Configurar o ambiente para otimização
putenv('MAGICK_TMPDIR=' . $temp_dir); // Defina um diretório temporário adequado
$imagick->setResourceLimit(Imagick::RESOURCETYPE_MEMORY, 512); // Ajuste conforme necessário
$imagick->setResourceLimit(Imagick::RESOURCETYPE_MAP, 512);
$imagick->setResourceLimit(Imagick::RESOURCETYPE_THREAD, 2);
try {
if (in_array($extension, ['jpg', 'jpeg', 'png', 'gif'])) {
log_message("Processando imagem $uploaded_file_path", 'INFO');
// Reduzir a resolução para 1200x900, mantendo a proporção
log_message("Reduzindo resolução da imagem para melhor qualidade e menor tamanho", 'INFO');
$imagick->readImage($uploaded_file_path);
$imagick->resizeImage(1200, 900, Imagick::FILTER_LANCZOS, 1, true);
// Configurar a compressão usando PNG para melhor qualidade sem perder transparência
if ($extension === 'png') {
$imagick->setImageFormat('png');
$imagick->stripImage(); // Remove metadados
$image_blob = $imagick->getImageBlob();
} else {
// Para JPEG e outros, usar alta qualidade com compressão balanceada
log_message("Configurando compressão da imagem para JPEG", 'INFO');
$imagick->setImageCompression(Imagick::COMPRESSION_JPEG);
$imagick->setImageCompressionQuality(85); // Maior qualidade
$imagick->stripImage(); // Remove metadados para reduzir o tamanho
$image_blob = $imagick->getImageBlob();
}
// Salvar a imagem temporariamente
$tmp_img = tempnam($tmp_dir, 'img_') . '.' . $extension;
log_message("Salvando imagem temporária em $tmp_img", 'INFO');
file_put_contents($tmp_img, $image_blob);
chmod($tmp_img, 0666); // Ajustar permissões do arquivo temporário
// Adicionar a imagem ao PDF
log_message("Adicionando imagem ao PDF", 'INFO');
$pdf->AddPage();
$pdf->Image('@' . $image_blob, 15, 40, 180, 160, '', '', 'C', false, 100, '', false, false, 1, false, false, false);
log_message("Imagem adicionada ao PDF", 'INFO');
// Remover a imagem temporária
if (file_exists($tmp_img)) {
log_message("Removendo imagem temporária $tmp_img", 'INFO');
unlink($tmp_img);
} else {
log_message("Imagem temporária $tmp_img não encontrada para remoção", 'WARN');
}
} elseif (in_array($extension, ['pdf'])) {
log_message("Processando PDF $uploaded_file_path", 'INFO');
// Verificar se a extensão Imagick está carregada
if (extension_loaded('imagick')) {
log_message("Imagick está carregado", 'INFO');
// Inicializar Imagick
try {
log_message("Inicializando Imagick para $uploaded_file_path", 'INFO');
$imagick->setResolution(150, 150); // Ajuste a resolução conforme necessário
$imagick->readImage($uploaded_file_path); // Ler todas as páginas do PDF
log_message("PDF lido com sucesso", 'INFO');
// Processar cada página do PDF
$page_count = $imagick->getNumberImages(); // Número total de páginas do PDF
for ($i = 0; $i < $page_count; $i++) {
$imagick->setIteratorIndex($i); // Define a página atual
$imagick->setImageFormat("jpeg"); // Configura o formato como JPEG
// Definir o fundo como branco
$imagick->setImageBackgroundColor('white');
$imagick = $imagick->mergeImageLayers(Imagick::LAYERMETHOD_FLATTEN);
// Reduz a resolução para 1600x1200, mantendo a proporção
$imagick->resizeImage(1600, 1200, Imagick::FILTER_LANCZOS, 1, true);
// Configura as opções de compressão
$imagick->setImageCompression(Imagick::COMPRESSION_JPEG);
$imagick->setImageCompressionQuality(85);
$imagick->stripImage(); // Remove metadados desnecessários
// Obter os dados da imagem
$image_data = $imagick->getImageBlob();
$tmp_img = tempnam($tmp_dir, 'pdf_page_') . '.jpg';
file_put_contents($tmp_img, $image_data); // Salvar página como JPEG temporária
chmod($tmp_img, 0666);
// Adicionar a página como imagem ao novo PDF
$pdf->AddPage();
$pdf->Image($tmp_img, 15, 40, 180, 160, '', '', 'C', false, 100, '', false, false, 1, false, false, false);
// Remover a imagem temporária
unlink($tmp_img);
}
// Limpar recursos do Imagick
$imagick->clear();
$imagick->destroy();
} catch (Exception $e) {
log_message("Erro ao inicializar ou processar imagem com Imagick: " . $e->getMessage(), 'ERROR');
}
} else {
log_message("Imagick não está carregado", 'WARN');
// Se Imagick não estiver disponível, apenas adicionar uma mensagem
$pdf->SetFont('helvetica', '', 12);
$pdf->Write(0, 'Visualização de PDF não suportada.');
}
} else {
log_message("Tipo de arquivo não suportado: $extension", 'WARN');
// Outros tipos de arquivo podem ser adicionados conforme necessidade
$pdf->SetFont('helvetica', '', 12);
$pdf->Write(0, 'Visualização deste tipo de arquivo não está disponível.');
}
} catch (Exception $e) {
log_message("Erro ao processar imagem: " . $e->getMessage(), 'ERROR');
}
// Adicionar uma nova página para as informações
$pdf->AddPage();
// Conteúdo das informações
$html = '<h2>Informações do Documento</h2>';
$html .= '<p><strong>Nome do Arquivo:</strong> ' . htmlspecialchars($document_info['name']) . '</p>';
$html .= '<p><strong>Data de Modificação:</strong> ' . htmlspecialchars($document_info['modification_time']) . '</p>';
$html .= '<p><strong>Data de Envio ao Servidor:</strong> ' . htmlspecialchars($document_info['upload_time']) . '</p>';
$html .= '<p><strong>Data e Hora da Assinatura:</strong> ' . htmlspecialchars($document_info['signature_time']) . ' (UTC-3)</p>';
$html .= '<h3>Checksums</h3>';
$html .= '<ul>';
$html .= '<li><strong>SHA-256:</strong> ' . htmlspecialchars($checksums['sha256']) . '</li>';
$html .= '<li><strong>SHA-512:</strong> ' . htmlspecialchars($checksums['sha512']) . '</li>';
$html .= '<li><strong>MD5:</strong> ' . htmlspecialchars($checksums['md5']) . '</li>';
$html .= '</ul>';
$html .= '<h3>Dados do Dispositivo</h3>';
$html .= '<ul>';
foreach ($device_data as $key => $value) {
$html .= '<li><strong>' . htmlspecialchars((string)$key) . ':</strong> ' . htmlspecialchars((string)$value) . '</li>';
}
$html .= '</ul>';
$orig_link= 'https://validar.martinsevieira.adv.br/uploads/';
$html .= '<h3>Arquivos Originais</h3>';
$html .= '<ul>';
$html .= '<li><a href="' . $orig_link . $document_info['name'] . '">Arquivo Original</a></li>';
$html .= '<li><a href="' . $orig_link . $document_info['name'] . '.ots">Arquivo OTS</a></li>';
$html .= '</ul>';
$html .= '<h3>Arquivo de Timestamp (OTS) em Base64</h3>';
$html .= '<pre>' . htmlspecialchars($ots_base64) . '</pre>';
$pdf->writeHTML($html, true, false, true, false, '');
// Salvar o PDF no servidor
$processed_dir = '/var/www/html/processed/';
if (!is_dir($processed_dir)) {
mkdir($processed_dir, 0777, true);
}
log_message("Salvando PDF no servidor", 'INFO');
$pdf_output_path = $processed_dir . uniqid('prova_') . '.pdf';
$pdf->Output($pdf_output_path, 'F');
$end_time = microtime(true);
log_message("PDF gerado em " . round($end_time - $start_time, 4) . " segundos", 'INFO');
// Limpar recursos do Imagick
$imagick->clear();
$imagick->destroy();
return $pdf_output_path;
}
// Recuperar todos os arquivos pendentes
$mysqli = new mysqli("10.15.0.42", "root", "34641747", "valida");
if ($mysqli->connect_error) {
log_message("Connection failed: " . $mysqli->connect_error, 'ERROR');
die("Connection failed: " . $mysqli->connect_error);
}
log_message("Conexão com o banco de dados estabelecida.", 'INFO');
// Recuperar todos os arquivos pendentes
$result = $mysqli->query("SELECT q.*, cp.port, q.original_location FROM queue q LEFT JOIN client_ports cp ON q.id = cp.queue_id WHERE q.status = 'pending'");
if ($result->num_rows > 0) {
log_message("Encontrados " . $result->num_rows . " arquivos pendentes para processar.", 'INFO');
while ($row = $result->fetch_assoc()) {
// Verificar se o número de processos filhos atingiu o máximo permitido
while (count($childProcesses) >= MAX_CHILDREN) {
// Esperar por qualquer processo filho terminar
$endedPid = pcntl_wait($status);
if ($endedPid > 0) {
unset($childProcesses[$endedPid]);
log_message("Processo filho $endedPid finalizado.", 'INFO');
}
}
// Fork do processo
$pid = pcntl_fork();
if ($pid == -1) {
// Erro ao fork
log_message("Erro ao criar processo filho.", 'ERROR');
} elseif ($pid) {
// Processo pai
$childProcesses[$pid] = true;
log_message("Criado processo filho $pid para o arquivo ID " . $row['id'] . ".", 'INFO');
} else {
// Processo filho
// Fecha a conexão do processo pai antes de iniciar no filho
$mysqli->close();
// Processa o arquivo
process_file($row);
// Finaliza o processo filho
exit(0);
}
}
// Após forçar todos os filhos a serem criados, esperar que terminem
while (count($childProcesses) > 0) {
$endedPid = pcntl_wait($status);
if ($endedPid > 0) {
unset($childProcesses[$endedPid]);
log_message("Processo filho $endedPid finalizado.", 'INFO');
}
}
log_message("Todas as tarefas foram submetidas para processamento.", 'INFO');
} else {
log_message("Nenhum arquivo pendente para processar.", 'INFO');
}
$mysqli->close();
log_message("Processamento da fila finalizado.", 'INFO');
?>
+507
View File
@@ -0,0 +1,507 @@
<?php
// process_queue.php
ini_set('memory_limit', '512M');
date_default_timezone_set('America/Araguaina');
// Aumentar o tempo máximo de execução do script para 300 segundos (5 minutos)
set_time_limit(300);
// Verifique se a extensão `pcntl` está disponível
if (!function_exists('pcntl_fork')) {
die("A extensão pcntl não está disponível. Por favor, habilite-a para continuar.\n");
}
// Definir o número máximo de processos filhos
define('MAX_CHILDREN', 3);
$childProcesses = [];
// Função para registrar logs
function log_message($message, $level = 'INFO') {
$timestamp = date("Y-m-d H:i:s P"); // Inclui o fuso horário
// Apenas logar mensagens de nível INFO, ERROR e WARN
if (in_array($level, ['INFO', 'ERROR', 'WARN'])) {
file_put_contents('/var/log/process_queue.log', "[$timestamp] [$level] $message\n", FILE_APPEND);
}
}
log_message("Script iniciado.", 'INFO');
function process_file($row) {
// Cada processo filho deve estabelecer sua própria conexão com o banco de dados
$mysqli = new mysqli("10.15.0.42", "root", "34641747", "valida");
if ($mysqli->connect_error) {
log_message("Connection failed: " . $mysqli->connect_error, 'ERROR');
exit(1); // Sair com erro
}
// Assegurar que as mensagens de log incluam o ID do processo
$process_id = getmypid();
log_message("Processo $process_id: Processando arquivo ID " . $row['id'] . ": " . $row['file_path'], 'INFO');
try {
$file_path = $row['file_path'];
$queue_id = $row['id'];
$user_agent = $row['user_agent'];
$ip_address = $row['ip_address'];
$host_name = $row['host_name'];
$access_time = $row['access_time'] . ' ' . date("P"); // Adiciona fuso horário
$language = $row['language'];
$referer = $row['referer'];
$protocol = $row['protocol'];
$connection = $row['connection'];
$viewport_width = $row['viewport_width'];
$viewport_height = $row['viewport_height'];
$original_location = $row['original_location']; // Novo campo para localização original
// Recuperar a porta do cliente
$result_port = $mysqli->query("SELECT port FROM client_ports WHERE queue_id = $queue_id");
$client_port = $result_port->fetch_assoc()['port'] ?? 'N/A';
$result_port->free();
// Atualizar status para 'processing'
$stmt_update = $mysqli->prepare("UPDATE queue SET status = 'processing' WHERE id = ?");
$stmt_update->bind_param("i", $queue_id);
$stmt_update->execute();
$stmt_update->close();
log_message("Processo $process_id: Atualizou status para 'processing' para o arquivo ID $queue_id.", 'INFO');
// Gerar checksums
$checksums = generate_checksums($file_path);
// Capturar data e hora
$file_datetime = get_file_datetime($file_path);
// Registrar timestamp usando OpenTimestamps
$timestamp_result = register_timestamp_opentimestamps($file_path);
$signature_time = date("d/m/Y H:i:s P"); // Inclui fuso horário
if ($timestamp_result['success']) {
$ots_base64 = $timestamp_result['ots_base64'];
// Coletar dados do dispositivo
$device_data = [
'User Agent' => $user_agent,
'IP Address' => $ip_address . ':' . $client_port,
'Host Name' => $host_name,
'Access Time' => $access_time,
'Language' => $language,
'Referer' => $referer,
'Protocol' => $protocol,
'Connection' => $connection,
'Viewport Width' => $viewport_width,
'Viewport Height' => $viewport_height,
'Original Location' => $original_location // Adicionado
];
// Gerar PDF
$pdf_path = generate_pdf($file_path, [
'name' => basename($file_path),
'creation_time' => $file_datetime['creation_time'] . ' ' . date("P", filectime($file_path)),
'modification_time' => $file_datetime['modification_time'] . ' ' . date("P", filemtime($file_path)),
'upload_time' => $access_time,
'signature_time' => $signature_time
], $checksums, $device_data, $ots_base64);
// Atualizar status para 'completed'
$stmt_complete = $mysqli->prepare("UPDATE queue SET status = 'completed' WHERE id = ?");
$stmt_complete->bind_param("i", $queue_id);
$stmt_complete->execute();
$stmt_complete->close();
log_message("Processo $process_id: Processamento concluído para arquivo ID $queue_id: $file_path", 'INFO');
} else {
// Atualizar status para 'error'
$stmt_error = $mysqli->prepare("UPDATE queue SET status = 'error' WHERE id = ?");
$stmt_error->bind_param("i", $queue_id);
$stmt_error->execute();
$stmt_error->close();
log_message("Processo $process_id: Erro ao processar arquivo ID $queue_id: " . $timestamp_result['message'], 'ERROR');
}
} catch (Exception $e) {
// Atualizar status para 'error'
$stmt_exception = $mysqli->prepare("UPDATE queue SET status = 'error' WHERE id = ?");
$stmt_exception->bind_param("i", $queue_id);
$stmt_exception->execute();
$stmt_exception->close();
log_message("Processo $process_id: Exceção ao processar arquivo ID $queue_id: " . $e->getMessage(), 'ERROR');
}
$mysqli->close();
log_message("Processo $process_id: Fechou conexão com o banco de dados para o arquivo ID $queue_id.", 'INFO');
}
// Funções auxiliares (generate_checksums, get_file_datetime, register_timestamp_opentimestamps, generate_pdf)
// Mantenha estas funções como estão no seu código original, sem alterações. Certifique-se de que as funções não dependam de conexões globais de banco de dados.
require_once __DIR__ . '../../vendor/autoload.php';
// Função para gerar checksums
function generate_checksums($file_path) {
log_message("Gerando checksums para $file_path", 'INFO');
$start_time = microtime(true);
// Carregar o conteúdo do arquivo uma única vez
$file_content = file_get_contents($file_path);
$checksums = [
'sha256' => hash('sha256', $file_content),
'sha512' => hash('sha512', $file_content),
'md5' => hash('md5', $file_content)
];
$end_time = microtime(true);
log_message("Checksums gerados em " . round($end_time - $start_time, 4) . " segundos", 'INFO');
return $checksums;
}
// Função para capturar data e hora do arquivo
function get_file_datetime($file_path) {
log_message("Obtendo data e hora do arquivo para $file_path", 'INFO');
$start_time = microtime(true);
$creation_time = date("d/m/Y H:i:s P", filectime($file_path));
$modification_time = date("d/m/Y H:i:s P", filemtime($file_path));
$end_time = microtime(true);
log_message("Data e hora obtidas em " . round($end_time - $start_time, 4) . " segundos", 'INFO');
return [
'creation_time' => $creation_time,
'modification_time' => $modification_time
];
}
// Função para registrar timestamp usando OpenTimestamps
function register_timestamp_opentimestamps($file_path) {
log_message("Registrando timestamp para $file_path", 'INFO');
$start_time = microtime(true);
// Definir diretório de cache para OTS
$ots_cache_dir = '/var/www/html/ots_cache';
if (!is_dir($ots_cache_dir)) {
log_message("Diretório de cache OTS não existe. Criando em $ots_cache_dir", 'INFO');
if (!mkdir($ots_cache_dir, 0755, true)) {
log_message("Erro ao criar diretório de cache OTS: $ots_cache_dir", 'ERROR');
return ['success' => false, 'message' => "Erro ao criar diretório de cache OTS: $ots_cache_dir"];
}
chmod($ots_cache_dir, 0755); // Ajustar permissões
}
// Definir a variável de ambiente antes de executar o comando
$command_stamp = "OTS_CACHE_DIRECTORY=" . escapeshellarg($ots_cache_dir) . " ots stamp " . escapeshellarg($file_path) . " 2>&1";
log_message("Comando para executar: $command_stamp", 'INFO');
// Executar o comando
exec($command_stamp, $output_stamp, $return_var_stamp);
// Verificar o resultado da execução
if ($return_var_stamp !== 0) {
log_message("Erro ao registrar timestamp: " . implode("\n", $output_stamp), 'ERROR');
return ['success' => false, 'message' => 'Erro ao registrar timestamp: ' . implode("\n", $output_stamp)];
}
// Definir o caminho do arquivo .ots gerado
$ots_file = "{$file_path}.ots";
// Verificar se o arquivo .ots foi criado
if (!file_exists($ots_file)) {
log_message("Arquivo de timestamp não encontrado: $ots_file", 'ERROR');
return ['success' => false, 'message' => "Arquivo de timestamp não encontrado: $ots_file"];
}
// Codificar o arquivo .ots em base64
$ots_base64 = base64_encode(file_get_contents($ots_file));
$end_time = microtime(true);
log_message("Timestamp registrado e codificado em " . round($end_time - $start_time, 4) . " segundos", 'INFO');
return ['success' => true, 'ots_base64' => $ots_base64];
}
// Função para gerar PDF
function generate_pdf($uploaded_file_path, $document_info, $checksums, $device_data, $ots_base64) {
log_message("Gerando PDF para $uploaded_file_path", 'INFO');
$start_time = microtime(true);
// Criar uma nova instância do TCPDF
$pdf = new TCPDF();
// Configurações iniciais do PDF
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor('Seu Nome ou Empresa');
$pdf->SetTitle('Prova de Autenticidade de Documento');
$pdf->SetSubject('Timestamping e Checksums');
// Remover as margens padrão
$pdf->SetMargins(10, 10, 10);
$pdf->SetHeaderMargin(0);
$pdf->SetFooterMargin(0);
// Desativar cabeçalhos e rodapés automáticos
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);
// Configurar a fonte padrão uma vez
$pdf->SetFont('helvetica', '', 10);
// Adicionar uma página para o documento
$pdf->AddPage();
// Verificar o tipo de arquivo para incorporar no PDF
$file_info = pathinfo($uploaded_file_path);
$extension = strtolower($file_info['extension']);
// Configurar o diretório temporário para o ImageMagick
$temp_dir = '/tmp/imagick';
if (!is_dir($temp_dir)) {
mkdir($temp_dir, 0777, true);
}
chmod($temp_dir, 0777); // Garantir permissões totais
// Configurar o diretório temporário para as imagens
$tmp_dir = '/tmp/image';
if (!is_dir($tmp_dir)) {
mkdir($tmp_dir, 0777, true);
}
chmod($tmp_dir, 0777); // Garantir permissões totais
// Criar uma única instância de Imagick
$imagick = new Imagick();
// Configurar o ambiente para otimização
putenv('MAGICK_TMPDIR=' . $temp_dir); // Defina um diretório temporário adequado
$imagick->setResourceLimit(Imagick::RESOURCETYPE_MEMORY, 512); // Ajuste conforme necessário
$imagick->setResourceLimit(Imagick::RESOURCETYPE_MAP, 512);
$imagick->setResourceLimit(Imagick::RESOURCETYPE_THREAD, 2);
try {
if (in_array($extension, ['jpg', 'jpeg', 'png', 'gif'])) {
log_message("Processando imagem $uploaded_file_path", 'INFO');
// Reduzir a resolução para 1200x900, mantendo a proporção
log_message("Reduzindo resolução da imagem para melhor qualidade e menor tamanho", 'INFO');
$imagick->readImage($uploaded_file_path);
$imagick->resizeImage(1200, 900, Imagick::FILTER_LANCZOS, 1, true);
// Configurar a compressão usando PNG para melhor qualidade sem perder transparência
if ($extension === 'png') {
$imagick->setImageFormat('png');
$imagick->stripImage(); // Remove metadados
$image_blob = $imagick->getImageBlob();
} else {
// Para JPEG e outros, usar alta qualidade com compressão balanceada
log_message("Configurando compressão da imagem para JPEG", 'INFO');
$imagick->setImageCompression(Imagick::COMPRESSION_JPEG);
$imagick->setImageCompressionQuality(85); // Maior qualidade
$imagick->stripImage(); // Remove metadados para reduzir o tamanho
$image_blob = $imagick->getImageBlob();
}
// Salvar a imagem temporariamente
$tmp_img = tempnam($tmp_dir, 'img_') . '.' . $extension;
log_message("Salvando imagem temporária em $tmp_img", 'INFO');
file_put_contents($tmp_img, $image_blob);
chmod($tmp_img, 0666); // Ajustar permissões do arquivo temporário
// Adicionar a imagem ao PDF
log_message("Adicionando imagem ao PDF", 'INFO');
$pdf->Image('@' . $image_blob, 15, 40, 180, 160, '', '', 'C', false, 100, '', false, false, 1, false, false, false);
log_message("Imagem adicionada ao PDF", 'INFO');
// Remover a imagem temporária
if (file_exists($tmp_img)) {
log_message("Removendo imagem temporária $tmp_img", 'INFO');
unlink($tmp_img);
} else {
log_message("Imagem temporária $tmp_img não encontrada para remoção", 'WARN');
}
} elseif (in_array($extension, ['pdf'])) {
log_message("Processando PDF $uploaded_file_path", 'INFO');
// Verificar se a extensão Imagick está carregada
if (extension_loaded('imagick')) {
log_message("Imagick está carregado", 'INFO');
// Inicializar Imagick
try {
log_message("Inicializando Imagick para $uploaded_file_path", 'INFO');
$imagick = new Imagick();
$imagick->setResolution(150, 150); // Ajuste a resolução conforme necessário
$imagick->readImage($uploaded_file_path); // Ler todas as páginas do PDF
log_message("PDF lido com sucesso", 'INFO');
// Processar cada página do PDF
$page_count = $imagick->getNumberImages(); // Número total de páginas do PDF
for ($i = 0; $i < $page_count; $i++) {
$imagick->setIteratorIndex($i); // Define a página atual
$imagick->setImageFormat("jpeg"); // Configura o formato como JPEG
// Reduz a resolução para 1600x1200, mantendo a proporção
$imagick->resizeImage(1600, 1200, Imagick::FILTER_LANCZOS, 1, true);
// Configura as opções de compressão
$imagick->setImageCompression(Imagick::COMPRESSION_JPEG);
$imagick->setImageCompressionQuality(85);
$imagick->stripImage(); // Remove metadados desnecessários
// Obter os dados da imagem
$image_data = $imagick->getImageBlob();
$tmp_img = tempnam($tmp_dir, 'pdf_page_') . '.jpg';
file_put_contents($tmp_img, $image_data); // Salvar página como JPEG temporária
chmod($tmp_img, 0666);
// Adicionar a página como imagem ao novo PDF
$pdf->AddPage();
$pdf->Image($tmp_img, 15, 40, 180, 160, '', '', 'C', false, 100, '', false, false, 1, false, false, false);
// Remover a imagem temporária
unlink($tmp_img);
}
// Limpar recursos do Imagick
$imagick->clear();
$imagick->destroy();
} catch (Exception $e) {
log_message("Erro ao inicializar ou processar imagem com Imagick: " . $e->getMessage(), 'ERROR');
}
} else {
log_message("Imagick não está carregado", 'WARN');
// Se Imagick não estiver disponível, apenas adicionar uma mensagem
$pdf->SetFont('helvetica', '', 12);
$pdf->Write(0, 'Visualização de PDF não suportada.');
}
} else {
log_message("Tipo de arquivo não suportado: $extension", 'WARN');
// Outros tipos de arquivo podem ser adicionados conforme necessidade
$pdf->SetFont('helvetica', '', 12);
$pdf->Write(0, 'Visualização deste tipo de arquivo não está disponível.');
}
} catch (Exception $e) {
log_message("Erro ao processar imagem: " . $e->getMessage(), 'ERROR');
}
// Adicionar uma nova página para as informações
$pdf->AddPage();
// Conteúdo das informações
$html = '<h2>Informações do Documento</h2>';
$html .= '<p><strong>Nome do Arquivo:</strong> ' . htmlspecialchars($document_info['name']) . '</p>';
$html .= '<p><strong>Data de Modificação:</strong> ' . htmlspecialchars($document_info['modification_time']) . '</p>';
$html .= '<p><strong>Data de Envio ao Servidor:</strong> ' . htmlspecialchars($document_info['upload_time']) . '</p>';
$html .= '<p><strong>Data e Hora da Assinatura:</strong> ' . htmlspecialchars($document_info['signature_time']) . ' (UTC-3)</p>';
$html .= '<h3>Checksums</h3>';
$html .= '<ul>';
$html .= '<li><strong>SHA-256:</strong> ' . htmlspecialchars($checksums['sha256']) . '</li>';
$html .= '<li><strong>SHA-512:</strong> ' . htmlspecialchars($checksums['sha512']) . '</li>';
$html .= '<li><strong>MD5:</strong> ' . htmlspecialchars($checksums['md5']) . '</li>';
$html .= '</ul>';
$html .= '<h3>Dados do Dispositivo</h3>';
$html .= '<ul>';
foreach ($device_data as $key => $value) {
$html .= '<li><strong>' . htmlspecialchars((string)$key) . ':</strong> ' . htmlspecialchars((string)$value) . '</li>';
}
$html .= '</ul>';
$orig_link= 'https://validar.martinsevieira.adv.br/uploads/';
$html .= '<h3>Arquivos Originais</h3>';
$html .= '<ul>';
$html .= '<li><a href="' . $orig_link . $document_info['name'] . '">Arquivo Original</a></li>';
$html .= '<li><a href="' . $orig_link . $document_info['name'] . '.ots">Arquivo OTS</a></li>';
$html .= '</ul>';
$html .= '<h3>Arquivo de Timestamp (OTS) em Base64</h3>';
$html .= '<pre>' . htmlspecialchars($ots_base64) . '</pre>';
$pdf->writeHTML($html, true, false, true, false, '');
// Salvar o PDF no servidor
$processed_dir = '/var/www/html/processed/';
if (!is_dir($processed_dir)) {
mkdir($processed_dir, 0777, true);
}
log_message("Salvando PDF no servidor", 'INFO');
$pdf_output_path = $processed_dir . uniqid('prova_') . '.pdf';
$pdf->Output($pdf_output_path, 'F');
$end_time = microtime(true);
log_message("PDF gerado em " . round($end_time - $start_time, 4) . " segundos", 'INFO');
// Limpar recursos do Imagick
$imagick->clear();
$imagick->destroy();
return $pdf_output_path;
}
// Recuperar todos os arquivos pendentes
$mysqli = new mysqli("10.15.0.42", "root", "34641747", "valida");
if ($mysqli->connect_error) {
log_message("Connection failed: " . $mysqli->connect_error, 'ERROR');
die("Connection failed: " . $mysqli->connect_error);
}
log_message("Conexão com o banco de dados estabelecida.", 'INFO');
// Recuperar todos os arquivos pendentes
$result = $mysqli->query("SELECT q.*, cp.port, q.original_location FROM queue q LEFT JOIN client_ports cp ON q.id = cp.queue_id WHERE q.status = 'pending'");
if ($result->num_rows > 0) {
log_message("Encontrados " . $result->num_rows . " arquivos pendentes para processar.", 'INFO');
while ($row = $result->fetch_assoc()) {
// Verificar se o número de processos filhos atingiu o máximo permitido
while (count($childProcesses) >= MAX_CHILDREN) {
// Esperar por qualquer processo filho terminar
$endedPid = pcntl_wait($status);
if ($endedPid > 0) {
unset($childProcesses[$endedPid]);
log_message("Processo filho $endedPid finalizado.", 'INFO');
}
}
// Fork do processo
$pid = pcntl_fork();
if ($pid == -1) {
// Erro ao fork
log_message("Erro ao criar processo filho.", 'ERROR');
} elseif ($pid) {
// Processo pai
$childProcesses[$pid] = true;
log_message("Criado processo filho $pid para o arquivo ID " . $row['id'] . ".", 'INFO');
} else {
// Processo filho
// Fecha a conexão do processo pai antes de iniciar no filho
$mysqli->close();
// Processa o arquivo
process_file($row);
// Finaliza o processo filho
exit(0);
}
}
// Após forçar todos os filhos a serem criados, esperar que terminem
while (count($childProcesses) > 0) {
$endedPid = pcntl_wait($status);
if ($endedPid > 0) {
unset($childProcesses[$endedPid]);
log_message("Processo filho $endedPid finalizado.", 'INFO');
}
}
log_message("Todas as tarefas foram submetidas para processamento.", 'INFO');
} else {
log_message("Nenhum arquivo pendente para processar.", 'INFO');
}
$mysqli->close();
log_message("Processamento da fila finalizado.", 'INFO');
?>
+81
View File
@@ -0,0 +1,81 @@
<?php
// Verificar se o usuário está logado
if (!isset($_SESSION['user_id'])) {
header("Location: login.php");
exit();
}
?>
<!DOCTYPE html>
<html lang="pt-BR">
<head>
<meta charset="UTF-8">
<title>Status do Processamento</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
.status { margin-top: 20px; }
.status p { margin: 5px 0; }
.completed { color: green; }
.pending { color: orange; }
.processing { color: blue; }
.error { color: red; }
.pagination { margin-top: 20px; text-align: center; }
.pagination a { margin: 0 5px; text-decoration: none; color: #007BFF; }
.pagination a:hover { text-decoration: underline; }
</style>
<script>
function checkStatus(page = 1) {
fetch(`./prova/status_check.php?page_num=${page}`)
.then(response => response.json())
.then(data => {
let statusContainer = document.getElementById('statusContainer');
statusContainer.innerHTML = '';
data.status.forEach(item => {
let p = document.createElement('p');
p.className = item.status;
p.textContent = `Arquivo: ${item.file_path} - Status: ${item.status}`;
statusContainer.appendChild(p);
});
// Paginação
let paginationContainer = document.getElementById('paginationContainer');
paginationContainer.innerHTML = '';
if (data.current_page > 1) {
let prevLink = document.createElement('a');
prevLink.href = `javascript:checkStatus(${data.current_page - 1})`;
prevLink.textContent = '« Anterior';
paginationContainer.appendChild(prevLink);
}
for (let i = 1; i <= data.total_pages; i++) {
let pageLink = document.createElement('a');
pageLink.href = `javascript:checkStatus(${i})`;
if (i === data.current_page) {
pageLink.style.fontWeight = 'bold';
}
pageLink.textContent = i;
paginationContainer.appendChild(pageLink);
}
if (data.current_page < data.total_pages) {
let nextLink = document.createElement('a');
nextLink.href = `javascript:checkStatus(${data.current_page + 1})`;
nextLink.textContent = 'Próximo »';
paginationContainer.appendChild(nextLink);
}
});
}
setInterval(() => checkStatus(), 15000); // Atualizar a cada 15 segundos
window.onload = () => checkStatus();
</script>
</head>
<body>
<div class="container">
<h2>Status do Processamento</h2>
<div id="statusContainer" class="status">
<!-- Status dos arquivos será exibido aqui -->
</div>
<div id="paginationContainer" class="pagination">
<!-- Paginação será exibida aqui -->
</div>
</div>
</body>
</html>
+34
View File
@@ -0,0 +1,34 @@
<?php
// status_check.php
// Conectar ao banco de dados
$mysqli = new mysqli("10.15.0.42", "root", "34641747", "valida");
if ($mysqli->connect_error) {
die("Connection failed: " . $mysqli->connect_error);
}
// Paginação
$files_per_page = 10;
$page = isset($_GET['page_num']) ? (int)$_GET['page_num'] : 1;
$page = max(1, $page);
$offset = ($page - 1) * $files_per_page;
// Recuperar status dos arquivos
$result = $mysqli->query("SELECT file_path, status FROM queue ORDER BY created_at DESC LIMIT $files_per_page OFFSET $offset");
$status = [];
while ($row = $result->fetch_assoc()) {
$status[] = $row;
}
// Contar o total de arquivos para a paginação
$total_result = $mysqli->query("SELECT COUNT(*) AS total FROM queue");
$total_files = $total_result->fetch_assoc()['total'];
$total_pages = ceil($total_files / $files_per_page);
$mysqli->close();
header('Content-Type: application/json');
echo json_encode(['status' => $status, 'current_page' => $page, 'total_pages' => $total_pages]);
?>
+126
View File
@@ -0,0 +1,126 @@
<?php
// Configurações iniciais
date_default_timezone_set('America/Araguaina');
// Conectar ao banco de dados
$mysqli = new mysqli("10.15.0.42", "root", "34641747", "valida");
if ($mysqli->connect_error) {
die("Connection failed: " . $mysqli->connect_error);
}
// Diretório de upload
$upload_dir = '/var/www/html/uploads/';
if (!is_dir($upload_dir)) {
mkdir($upload_dir, 0777, true);
}
// Tipos de arquivos permitidos
$allowed_types = ['image/jpeg', 'image/png', 'image/gif', 'application/pdf'];
$max_file_size = 10 * 1024 * 1024; // 10MB
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
if (isset($_FILES['files'])) {
$files = $_FILES['files'];
$modification_times = isset($_POST['modification_times']) ? explode(',', $_POST['modification_times']) : [];
// Capturar informações adicionais
$user_agent = isset($_POST['user_agent']) ? $_POST['user_agent'] : 'Desconhecido';
$language = isset($_POST['language']) ? $_POST['language'] : 'Desconhecido';
$viewport_width = isset($_POST['viewport_width']) ? intval($_POST['viewport_width']) : 0;
$viewport_height = isset($_POST['viewport_height']) ? intval($_POST['viewport_height']) : 0;
$ip_address = $_SERVER['REMOTE_ADDR'];
$host_name = gethostbyaddr($ip_address);
$access_time = date("Y-m-d H:i:s"); // Formato padrão MySQL
$referer = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : 'Desconhecido';
$request_method = $_SERVER['REQUEST_METHOD'];
$server_software = isset($_SERVER['SERVER_SOFTWARE']) ? $_SERVER['SERVER_SOFTWARE'] : 'Desconhecido';
$protocol = isset($_SERVER['SERVER_PROTOCOL']) ? $_SERVER['SERVER_PROTOCOL'] : 'Desconhecido';
$connection = isset($_SERVER['HTTP_CONNECTION']) ? $_SERVER['HTTP_CONNECTION'] : 'Desconhecido';
$client_port = isset($_SERVER['REMOTE_PORT']) ? intval($_SERVER['REMOTE_PORT']) : 0;
for ($i = 0; $i < count($files['name']); $i++) {
$file_name = basename($files['name'][$i]);
$file_tmp = $files['tmp_name'][$i];
$file_size = $files['size'][$i];
$file_type = $files['type'][$i];
$file_error = $files['error'][$i];
$file_path = $upload_dir . $file_name;
// Validações
if ($file_error !== UPLOAD_ERR_OK) {
continue;
}
if ($file_size > $max_file_size) {
continue;
}
if (!in_array($file_type, $allowed_types)) {
continue;
}
// Movendo o arquivo
if (move_uploaded_file($file_tmp, $file_path)) {
// Ajustar a data de modificação usando touch()
if (isset($modification_times[$i])) {
$mod_time = intval($modification_times[$i] / 1000); // Convertendo de milissegundos para segundos
touch($file_path, $mod_time);
}
// Gerar hash do arquivo para integridade
$file_hash = hash_file('sha256', $file_path);
// Preparar inserção na tabela queue
$stmt = $mysqli->prepare("INSERT INTO queue (file_path, user_agent, ip_address, host_name, access_time, language, referer, request_method, server_software, protocol, connection, viewport_width, viewport_height, file_hash) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
if (!$stmt) {
unlink($file_path);
continue;
}
$stmt->bind_param(
"ssssssssssssss",
$file_path,
$user_agent,
$ip_address,
$host_name,
$access_time,
$language,
$referer,
$request_method,
$server_software,
$protocol,
$connection,
$viewport_width,
$viewport_height,
$file_hash
);
if ($stmt->execute()) {
$queue_id = $stmt->insert_id;
} else {
unlink($file_path);
$stmt->close();
continue;
}
$stmt->close();
// Adicionar entrada na tabela client_ports
$stmt_port = $mysqli->prepare("INSERT INTO client_ports (queue_id, port) VALUES (?, ?)");
if (!$stmt_port) {
continue;
}
$stmt_port->bind_param("ii", $queue_id, $client_port);
if ($stmt_port->execute()) {
} else {
}
$stmt_port->close();
} else {
}
}
}
}
$mysqli->close();
header("Location: /index.php?page=status");
exit();
?>
+80
View File
@@ -0,0 +1,80 @@
<!DOCTYPE html>
<html lang="pt-BR">
<head>
<meta charset="UTF-8">
<title>Upload de Arquivos</title>
<script>
function addViewportDimensions() {
var form = document.getElementById('uploadForm');
var vw = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
var vh = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
var inputWidth = document.createElement('input');
inputWidth.type = 'hidden';
inputWidth.name = 'viewport_width';
inputWidth.value = vw;
form.appendChild(inputWidth);
var inputHeight = document.createElement('input');
inputHeight.type = 'hidden';
inputHeight.name = 'viewport_height';
inputHeight.value = vh;
form.appendChild(inputHeight);
var userAgent = navigator.userAgent;
var inputUserAgent = document.createElement('input');
inputUserAgent.type = 'hidden';
inputUserAgent.name = 'user_agent';
inputUserAgent.value = userAgent;
form.appendChild(inputUserAgent);
var language = navigator.language || navigator.userLanguage;
var inputLanguage = document.createElement('input');
inputLanguage.type = 'hidden';
inputLanguage.name = 'language';
inputLanguage.value = language;
form.appendChild(inputLanguage);
var files = document.getElementById('files').files;
var modificationTimes = [];
for (let i = 0; i < files.length; i++) {
const file = files[i];
const lastModified = file.lastModified ? file.lastModified : '';
modificationTimes.push(lastModified);
}
var inputModification = document.createElement('input');
inputModification.type = 'hidden';
inputModification.name = 'modification_times';
inputModification.value = modificationTimes.join(',');
form.appendChild(inputModification);
}
window.onload = function() {
var form = document.getElementById('uploadForm');
form.onsubmit = function(event) {
addViewportDimensions();
}
var fileInput = document.getElementById('files');
fileInput.addEventListener('change', function() {
var existingInputs = document.querySelectorAll('input[name="modification_times"]');
existingInputs.forEach(function(input) {
input.remove();
});
});
}
</script>
</head>
<body>
<div class="container">
<h2>Upload de Arquivos</h2>
<form id="uploadForm" action="./prova/upload.php" method="post" enctype="multipart/form-data">
<label for="files">Selecione os arquivos para autenticar:</label><br><br>
<input type="file" name="files[]" id="files" multiple required><br><br>
<button type="submit">Autenticar</button>
</form>
</div>
</body>
</html>
+1
View File
@@ -0,0 +1 @@
1.0
+12
View File
@@ -0,0 +1,12 @@
function toggleSubmenu(submenuId) {
var submenu = document.getElementById(submenuId);
if (submenu) {
if (submenu.style.display === 'none' || submenu.style.display === '') {
submenu.style.display = 'block';
} else {
submenu.style.display = 'none';
}
} else {
console.error('Submenu with ID ' + submenuId + ' not found.');
}
}
+35
View File
@@ -0,0 +1,35 @@
// formatacoes.js
function formatarCPF(cpf) {
cpf = cpf.replace(/[^\d]/g, "");
return cpf.replace(/(\d{3})(\d{3})(\d{3})(\d{2})/, "$1.$2.$3-$4");
}
function formatarTelefone(telefone) {
telefone = telefone.replace(/[^\d]/g, "");
return telefone.replace(/(\d{2})(\d{5})(\d{4})/, "($1) $2-$3");
}
// Função para aplicar a formatação em uma tabela
function formatarTabela(tabelaSeletor, cpfColuna, telefoneColuna) {
$(tabelaSeletor + ' tr').each(function() {
var cpf = $(this).find('td:nth-child(' + cpfColuna + ')').text();
var telefone = $(this).find('td:nth-child(' + telefoneColuna + ')').text();
if (cpf) {
$(this).find('td:nth-child(' + cpfColuna + ')').text(formatarCPF(cpf));
}
if (telefone) {
$(this).find('td:nth-child(' + telefoneColuna + ')').text(formatarTelefone(telefone));
}
});
}
// Função para aplicar a formatação em um elemento específico (client_details.php)
function formatarElemento(elementoSeletor, valor) {
if (valor) {
$(elementoSeletor).text(formatarTelefone(valor));
}
}
+211
View File
@@ -0,0 +1,211 @@
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
background-color: #f2f2f2;
}
.sidebar {
width: 250px;
background-color: #333;
position: fixed;
height: 100%;
padding-top: 20px;
color: white;
box-shadow: 2px 0 5px rgba(0,0,0,0.1);
}
.sidebar h2 {
text-align: center;
color: white;
margin-bottom: 20px;
}
.sidebar ul {
list-style-type: none;
padding: 0;
}
.sidebar ul li {
padding: 10px;
text-align: left;
margin-bottom: 10px;
background-color: #444;
border-radius: 5px;
}
.sidebar ul li a {
color: white;
text-decoration: none;
display: block;
padding: 10px;
transition: background-color 0.3s;
}
.sidebar ul li a:hover {
background-color: #575757;
}
.submenu {
display: none;
list-style-type: none;
padding-left: 20px;
}
.submenu li {
background-color: #555;
margin-bottom: 5px;
}
.submenu li a {
padding: 10px;
background-color: #555;
border-radius: 5px;
}
.submenu li a:hover {
background-color: #666;
}
.content {
margin-left: 250px;
padding: 20px;
}
.container {
max-width: 1200px;
margin: auto;
background-color: white;
padding: 20px;
border-radius: 5px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
button {
background-color: #4CAF50;
color: white;
border: none;
padding: 10px 20px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
margin: 4px 2px;
cursor: pointer;
border-radius: 5px;
transition: background-color 0.3s;
}
button:hover {
background-color: #45a049;
}
table {
width: 100%;
border-collapse: collapse;
margin-top: 20px;
}
table, th, td {
border: 1px solid #ddd;
padding: 8px;
}
th {
background-color: #f4f4f4;
text-align: left;
}
tr:nth-child(even) {
background-color: #f9f9f9;
}
.form-group {
margin-bottom: 15px;
}
.form-group label {
display: block;
margin-bottom: 5px;
}
.form-group input,
.form-group select,
.form-group textarea {
width: calc(100% - 22px);
padding: 10px;
border: 1px solid #ccc;
border-radius: 5px;
box-sizing: border-box;
}
.tabs {
margin-top: 20px;
}
.tab-button {
background-color: #ddd;
border: none;
padding: 10px 20px;
cursor: pointer;
display: inline-block;
margin-right: 5px;
border-radius: 5px;
transition: background-color 0.3s;
}
.tab-button:hover {
background-color: #ccc;
}
.tab-content {
display: none;
margin-top: 20px;
}
textarea {
width: calc(100% - 22px);
padding: 10px;
border: 1px solid #ccc;
border-radius: 5px;
box-sizing: border-box;
margin-bottom: 10px;
}
.client-details {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 20px;
}
.client-info {
background-color: #f9f9f9;
padding: 10px;
border-radius: 5px;
box-shadow: 0 0 5px rgba(0, 0, 0, 0.1);
}
.search-bar {
margin-bottom: 20px;
}
#search {
width: 300px;
padding: 8px;
font-size: 1em;
}
#search-button {
padding: 8px 12px;
font-size: 1em;
cursor: pointer;
background-color: #007BFF;
color: #fff;
border: none;
border-radius: 4px;
transition: background-color 0.3s;
}
#search-button:hover {
background-color: #0056b3;
}
+8
View File
@@ -0,0 +1,8 @@
function toggleSubmenu() {
var submenu = document.getElementById('submenu');
if (submenu.style.display === 'none' || submenu.style.display === '') {
submenu.style.display = 'block';
} else {
submenu.style.display = 'none';
}
}
+180
View File
@@ -0,0 +1,180 @@
.top-menu {
background: linear-gradient(to right, #2196F3, #1976D2);
padding: 10px;
display: flex;
justify-content: space-between;
align-items: center;
position: relative;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.logo {
margin-right: 20px;
width: 60px;
height: auto;
}
.logo img {
width: 50px;
height: 30px;
object-fit: cover;
}
.nav ul {
list-style: none;
margin: 0;
padding: 0;
display: flex;
}
.nav li {
margin-right: 20px;
}
.nav a {
color: #fff;
text-decoration: none;
padding: 10px;
transition: background-color 0.3s;
}
.nav a:hover {
background-color: rgba(255, 255, 255, 0.2);
border-radius: 5px;
}
.user-menu {
display: flex;
align-items: center;
position: relative;
}
.user-info {
display: flex;
align-items: center;
position: relative;
cursor: pointer;
}
.user-info span {
margin-left: 10px;
color: #fff;
}
.user-picture {
width: 40px;
height: 40px;
border-radius: 50%;
}
.user-info ul {
display: none;
position: absolute;
top: 100%;
right: 0;
background: #fff;
padding: 10px;
border: 1px solid #ddd;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
transition: opacity 0.3s ease-in-out;
z-index: 1000;
border-radius: 5px;
width: 200px;
}
.user-info ul.active {
display: block;
}
.user-info ul li {
list-style: none;
margin-bottom: 10px;
}
.user-info ul li a {
color: #333;
text-decoration: none;
display: flex;
align-items: center;
padding: 10px;
transition: background-color 0.3s;
border-radius: 5px;
}
.user-info ul li a:hover {
background-color: rgba(0, 0, 0, 0.05);
}
.user-info ul li a i {
margin-right: 10px;
}
.new-button, .search-button {
background: #2196F3;
color: #fff;
border: none;
padding: 10px 20px;
border-radius: 5px;
cursor: pointer;
position: relative;
margin-left: 10px;
}
.new-menu-container, .search-bar-container {
position: relative;
}
.new-menu, .search-bar {
display: none;
position: absolute;
top: 100%;
left: 0;
background: #fff;
padding: 10px;
border: 1px solid #ddd;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
transition: opacity 0.3s ease-in-out;
width: 200px;
z-index: 1000;
border-radius: 5px;
}
.new-menu.active, .search-bar.active {
display: block;
}
.new-menu li, .search-bar ul li {
list-style: none;
margin-bottom: 10px;
}
.search-bar input {
width: calc(100% - 22px);
padding: 10px;
border: 1px solid #ddd;
border-radius: 5px;
margin-bottom: 10px;
}
.search-bar button {
width: 100%;
padding: 10px;
background: #2196F3;
color: #fff;
border: none;
border-radius: 5px;
cursor: pointer;
}
.search-bar button:hover {
background: #1976D2;
}
@keyframes fadeIn {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
+37
View File
@@ -0,0 +1,37 @@
document.querySelectorAll('.new-button, .search-button').forEach(button => {
button.addEventListener('click', event => {
event.preventDefault();
event.stopPropagation();
const menu = event.target.nextElementSibling;
document.querySelectorAll('.new-menu, .search-bar').forEach(otherMenu => {
if (otherMenu !== menu) {
otherMenu.classList.remove('active');
}
});
menu.classList.toggle('active');
});
});
document.addEventListener('click', event => {
document.querySelectorAll('.new-menu, .search-bar').forEach(menu => {
if (!menu.contains(event.target) && !menu.previousElementSibling.contains(event.target)) {
menu.classList.remove('active');
}
});
});
document.querySelectorAll('.user-info').forEach(userInfo => {
userInfo.addEventListener('click', event => {
event.preventDefault();
event.stopPropagation();
userInfo.querySelector('ul').classList.toggle('active');
});
});
document.addEventListener('click', event => {
document.querySelectorAll('.user-info ul').forEach(menu => {
if (!menu.contains(event.target) && !menu.previousElementSibling.contains(event.target)) {
menu.classList.remove('active');
}
});
});
+66
View File
@@ -0,0 +1,66 @@
<div class="top-menu">
<div class="logo">
<img src="include/logo-nova.png" alt="Logo" href="https://validar.martinsevieira.adv.br">
</div>
<div class="nav">
<ul>
<li><a href="#">Novidades</a></li>
</ul>
</div>
<div class="user-menu">
<div class="user-info">
<img src="include/user-picture.png" alt="Foto do Usuário" class="user-picture">
<span><?php echo $_SESSION['username']; ?></span>
<ul class="dropdown">
<li><a href="index.php?page=user_profile">Perfil</a></li>
<li><a href="logout.php" id="logout-link">Logout</a></li> <!-- Link de logout -->
</ul>
</div>
<button class="new-button">Novo</button>
<ul class="new-menu">
<li><a href="index.php?page=register_client">Novo Cliente</a></li>
<li><a href="index.php?page=upload_prova">Upload de Prova Digital</a></li>
</ul>
<button class="search-button">Pesquisar</button>
<div class="search-bar">
<input type="text" id="top-search" placeholder="Pesquisar...">
<button id="top-search-button">Pesquisar</button>
<ul>
<li><a href="#">Buscar Clientes</a></li>
</ul>
</div>
</div>
</div>
<link rel="stylesheet" href="style_menu.css">
<script src="top_menu.js"></script>
<script>
$(document).ready(function() {
$('#top-search-button').click(function() {
var query = $('#top-search').val().trim();
if (query !== "") {
$.get("clientes/autocomplete.php", { term: query }, function(data) {
if (data.length > 0) {
window.location.href = 'index.php?page=client_details&id=' + data[0].id;
} else {
alert('Cliente não encontrado.');
}
});
} else {
alert('Por favor, insira um termo de pesquisa.');
}
});
$('#top-search').keypress(function(e) {
if (e.which == 13) {
$('#top-search-button').click();
}
});
// Adicionar evento de clique para o link de logout
$('#logout-link').click(function(e) {
e.preventDefault(); // Prevenir o comportamento padrão do link
window.location.href = 'logout.php'; // Redirecionar para logout.php
});
});
</script>
+80
View File
@@ -0,0 +1,80 @@
<!DOCTYPE html>
<html lang="pt-BR">
<head>
<meta charset="UTF-8">
<title>Upload de Arquivos</title>
<script>
function addViewportDimensions() {
var form = document.getElementById('uploadForm');
var vw = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
var vh = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
var inputWidth = document.createElement('input');
inputWidth.type = 'hidden';
inputWidth.name = 'viewport_width';
inputWidth.value = vw;
form.appendChild(inputWidth);
var inputHeight = document.createElement('input');
inputHeight.type = 'hidden';
inputHeight.name = 'viewport_height';
inputHeight.value = vh;
form.appendChild(inputHeight);
var userAgent = navigator.userAgent;
var inputUserAgent = document.createElement('input');
inputUserAgent.type = 'hidden';
inputUserAgent.name = 'user_agent';
inputUserAgent.value = userAgent;
form.appendChild(inputUserAgent);
var language = navigator.language || navigator.userLanguage;
var inputLanguage = document.createElement('input');
inputLanguage.type = 'hidden';
inputLanguage.name = 'language';
inputLanguage.value = language;
form.appendChild(inputLanguage);
var files = document.getElementById('files').files;
var modificationTimes = [];
for (let i = 0; i < files.length; i++) {
const file = files[i];
const lastModified = file.lastModified ? file.lastModified : '';
modificationTimes.push(lastModified);
}
var inputModification = document.createElement('input');
inputModification.type = 'hidden';
inputModification.name = 'modification_times';
inputModification.value = modificationTimes.join(',');
form.appendChild(inputModification);
}
window.onload = function() {
var form = document.getElementById('uploadForm');
form.onsubmit = function(event) {
addViewportDimensions();
}
var fileInput = document.getElementById('files');
fileInput.addEventListener('change', function() {
var existingInputs = document.querySelectorAll('input[name="modification_times"]');
existingInputs.forEach(function(input) {
input.remove();
});
});
}
</script>
</head>
<body>
<div class="container">
<h2>Upload de Arquivos</h2>
<form id="uploadForm" action="upload.php" method="post" enctype="multipart/form-data">
<label for="files">Selecione os arquivos para autenticar:</label><br><br>
<input type="file" name="files[]" id="files" multiple required><br><br>
<button type="submit">Autenticar</button>
</form>
</div>
</body>
</html>
+25
View File
@@ -0,0 +1,25 @@
<?php
// autoload.php @generated by Composer
if (PHP_VERSION_ID < 50600) {
if (!headers_sent()) {
header('HTTP/1.1 500 Internal Server Error');
}
$err = 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL;
if (!ini_get('display_errors')) {
if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
fwrite(STDERR, $err);
} elseif (!headers_sent()) {
echo $err;
}
}
trigger_error(
$err,
E_USER_ERROR
);
}
require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInit1ba944b1b2880695113851e981334169::getLoader();
+579
View File
@@ -0,0 +1,579 @@
<?php
/*
* This file is part of Composer.
*
* (c) Nils Adermann <naderman@naderman.de>
* Jordi Boggiano <j.boggiano@seld.be>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Composer\Autoload;
/**
* ClassLoader implements a PSR-0, PSR-4 and classmap class loader.
*
* $loader = new \Composer\Autoload\ClassLoader();
*
* // register classes with namespaces
* $loader->add('Symfony\Component', __DIR__.'/component');
* $loader->add('Symfony', __DIR__.'/framework');
*
* // activate the autoloader
* $loader->register();
*
* // to enable searching the include path (eg. for PEAR packages)
* $loader->setUseIncludePath(true);
*
* In this example, if you try to use a class in the Symfony\Component
* namespace or one of its children (Symfony\Component\Console for instance),
* the autoloader will first look for the class under the component/
* directory, and it will then fallback to the framework/ directory if not
* found before giving up.
*
* This class is loosely based on the Symfony UniversalClassLoader.
*
* @author Fabien Potencier <fabien@symfony.com>
* @author Jordi Boggiano <j.boggiano@seld.be>
* @see https://www.php-fig.org/psr/psr-0/
* @see https://www.php-fig.org/psr/psr-4/
*/
class ClassLoader
{
/** @var \Closure(string):void */
private static $includeFile;
/** @var string|null */
private $vendorDir;
// PSR-4
/**
* @var array<string, array<string, int>>
*/
private $prefixLengthsPsr4 = array();
/**
* @var array<string, list<string>>
*/
private $prefixDirsPsr4 = array();
/**
* @var list<string>
*/
private $fallbackDirsPsr4 = array();
// PSR-0
/**
* List of PSR-0 prefixes
*
* Structured as array('F (first letter)' => array('Foo\Bar (full prefix)' => array('path', 'path2')))
*
* @var array<string, array<string, list<string>>>
*/
private $prefixesPsr0 = array();
/**
* @var list<string>
*/
private $fallbackDirsPsr0 = array();
/** @var bool */
private $useIncludePath = false;
/**
* @var array<string, string>
*/
private $classMap = array();
/** @var bool */
private $classMapAuthoritative = false;
/**
* @var array<string, bool>
*/
private $missingClasses = array();
/** @var string|null */
private $apcuPrefix;
/**
* @var array<string, self>
*/
private static $registeredLoaders = array();
/**
* @param string|null $vendorDir
*/
public function __construct($vendorDir = null)
{
$this->vendorDir = $vendorDir;
self::initializeIncludeClosure();
}
/**
* @return array<string, list<string>>
*/
public function getPrefixes()
{
if (!empty($this->prefixesPsr0)) {
return call_user_func_array('array_merge', array_values($this->prefixesPsr0));
}
return array();
}
/**
* @return array<string, list<string>>
*/
public function getPrefixesPsr4()
{
return $this->prefixDirsPsr4;
}
/**
* @return list<string>
*/
public function getFallbackDirs()
{
return $this->fallbackDirsPsr0;
}
/**
* @return list<string>
*/
public function getFallbackDirsPsr4()
{
return $this->fallbackDirsPsr4;
}
/**
* @return array<string, string> Array of classname => path
*/
public function getClassMap()
{
return $this->classMap;
}
/**
* @param array<string, string> $classMap Class to filename map
*
* @return void
*/
public function addClassMap(array $classMap)
{
if ($this->classMap) {
$this->classMap = array_merge($this->classMap, $classMap);
} else {
$this->classMap = $classMap;
}
}
/**
* Registers a set of PSR-0 directories for a given prefix, either
* appending or prepending to the ones previously set for this prefix.
*
* @param string $prefix The prefix
* @param list<string>|string $paths The PSR-0 root directories
* @param bool $prepend Whether to prepend the directories
*
* @return void
*/
public function add($prefix, $paths, $prepend = false)
{
$paths = (array) $paths;
if (!$prefix) {
if ($prepend) {
$this->fallbackDirsPsr0 = array_merge(
$paths,
$this->fallbackDirsPsr0
);
} else {
$this->fallbackDirsPsr0 = array_merge(
$this->fallbackDirsPsr0,
$paths
);
}
return;
}
$first = $prefix[0];
if (!isset($this->prefixesPsr0[$first][$prefix])) {
$this->prefixesPsr0[$first][$prefix] = $paths;
return;
}
if ($prepend) {
$this->prefixesPsr0[$first][$prefix] = array_merge(
$paths,
$this->prefixesPsr0[$first][$prefix]
);
} else {
$this->prefixesPsr0[$first][$prefix] = array_merge(
$this->prefixesPsr0[$first][$prefix],
$paths
);
}
}
/**
* Registers a set of PSR-4 directories for a given namespace, either
* appending or prepending to the ones previously set for this namespace.
*
* @param string $prefix The prefix/namespace, with trailing '\\'
* @param list<string>|string $paths The PSR-4 base directories
* @param bool $prepend Whether to prepend the directories
*
* @throws \InvalidArgumentException
*
* @return void
*/
public function addPsr4($prefix, $paths, $prepend = false)
{
$paths = (array) $paths;
if (!$prefix) {
// Register directories for the root namespace.
if ($prepend) {
$this->fallbackDirsPsr4 = array_merge(
$paths,
$this->fallbackDirsPsr4
);
} else {
$this->fallbackDirsPsr4 = array_merge(
$this->fallbackDirsPsr4,
$paths
);
}
} elseif (!isset($this->prefixDirsPsr4[$prefix])) {
// Register directories for a new namespace.
$length = strlen($prefix);
if ('\\' !== $prefix[$length - 1]) {
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
}
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
$this->prefixDirsPsr4[$prefix] = $paths;
} elseif ($prepend) {
// Prepend directories for an already registered namespace.
$this->prefixDirsPsr4[$prefix] = array_merge(
$paths,
$this->prefixDirsPsr4[$prefix]
);
} else {
// Append directories for an already registered namespace.
$this->prefixDirsPsr4[$prefix] = array_merge(
$this->prefixDirsPsr4[$prefix],
$paths
);
}
}
/**
* Registers a set of PSR-0 directories for a given prefix,
* replacing any others previously set for this prefix.
*
* @param string $prefix The prefix
* @param list<string>|string $paths The PSR-0 base directories
*
* @return void
*/
public function set($prefix, $paths)
{
if (!$prefix) {
$this->fallbackDirsPsr0 = (array) $paths;
} else {
$this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
}
}
/**
* Registers a set of PSR-4 directories for a given namespace,
* replacing any others previously set for this namespace.
*
* @param string $prefix The prefix/namespace, with trailing '\\'
* @param list<string>|string $paths The PSR-4 base directories
*
* @throws \InvalidArgumentException
*
* @return void
*/
public function setPsr4($prefix, $paths)
{
if (!$prefix) {
$this->fallbackDirsPsr4 = (array) $paths;
} else {
$length = strlen($prefix);
if ('\\' !== $prefix[$length - 1]) {
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
}
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
$this->prefixDirsPsr4[$prefix] = (array) $paths;
}
}
/**
* Turns on searching the include path for class files.
*
* @param bool $useIncludePath
*
* @return void
*/
public function setUseIncludePath($useIncludePath)
{
$this->useIncludePath = $useIncludePath;
}
/**
* Can be used to check if the autoloader uses the include path to check
* for classes.
*
* @return bool
*/
public function getUseIncludePath()
{
return $this->useIncludePath;
}
/**
* Turns off searching the prefix and fallback directories for classes
* that have not been registered with the class map.
*
* @param bool $classMapAuthoritative
*
* @return void
*/
public function setClassMapAuthoritative($classMapAuthoritative)
{
$this->classMapAuthoritative = $classMapAuthoritative;
}
/**
* Should class lookup fail if not found in the current class map?
*
* @return bool
*/
public function isClassMapAuthoritative()
{
return $this->classMapAuthoritative;
}
/**
* APCu prefix to use to cache found/not-found classes, if the extension is enabled.
*
* @param string|null $apcuPrefix
*
* @return void
*/
public function setApcuPrefix($apcuPrefix)
{
$this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null;
}
/**
* The APCu prefix in use, or null if APCu caching is not enabled.
*
* @return string|null
*/
public function getApcuPrefix()
{
return $this->apcuPrefix;
}
/**
* Registers this instance as an autoloader.
*
* @param bool $prepend Whether to prepend the autoloader or not
*
* @return void
*/
public function register($prepend = false)
{
spl_autoload_register(array($this, 'loadClass'), true, $prepend);
if (null === $this->vendorDir) {
return;
}
if ($prepend) {
self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders;
} else {
unset(self::$registeredLoaders[$this->vendorDir]);
self::$registeredLoaders[$this->vendorDir] = $this;
}
}
/**
* Unregisters this instance as an autoloader.
*
* @return void
*/
public function unregister()
{
spl_autoload_unregister(array($this, 'loadClass'));
if (null !== $this->vendorDir) {
unset(self::$registeredLoaders[$this->vendorDir]);
}
}
/**
* Loads the given class or interface.
*
* @param string $class The name of the class
* @return true|null True if loaded, null otherwise
*/
public function loadClass($class)
{
if ($file = $this->findFile($class)) {
$includeFile = self::$includeFile;
$includeFile($file);
return true;
}
return null;
}
/**
* Finds the path to the file where the class is defined.
*
* @param string $class The name of the class
*
* @return string|false The path if found, false otherwise
*/
public function findFile($class)
{
// class map lookup
if (isset($this->classMap[$class])) {
return $this->classMap[$class];
}
if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
return false;
}
if (null !== $this->apcuPrefix) {
$file = apcu_fetch($this->apcuPrefix.$class, $hit);
if ($hit) {
return $file;
}
}
$file = $this->findFileWithExtension($class, '.php');
// Search for Hack files if we are running on HHVM
if (false === $file && defined('HHVM_VERSION')) {
$file = $this->findFileWithExtension($class, '.hh');
}
if (null !== $this->apcuPrefix) {
apcu_add($this->apcuPrefix.$class, $file);
}
if (false === $file) {
// Remember that this class does not exist.
$this->missingClasses[$class] = true;
}
return $file;
}
/**
* Returns the currently registered loaders keyed by their corresponding vendor directories.
*
* @return array<string, self>
*/
public static function getRegisteredLoaders()
{
return self::$registeredLoaders;
}
/**
* @param string $class
* @param string $ext
* @return string|false
*/
private function findFileWithExtension($class, $ext)
{
// PSR-4 lookup
$logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
$first = $class[0];
if (isset($this->prefixLengthsPsr4[$first])) {
$subPath = $class;
while (false !== $lastPos = strrpos($subPath, '\\')) {
$subPath = substr($subPath, 0, $lastPos);
$search = $subPath . '\\';
if (isset($this->prefixDirsPsr4[$search])) {
$pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
foreach ($this->prefixDirsPsr4[$search] as $dir) {
if (file_exists($file = $dir . $pathEnd)) {
return $file;
}
}
}
}
}
// PSR-4 fallback dirs
foreach ($this->fallbackDirsPsr4 as $dir) {
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
return $file;
}
}
// PSR-0 lookup
if (false !== $pos = strrpos($class, '\\')) {
// namespaced class name
$logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
. strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
} else {
// PEAR-like class name
$logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
}
if (isset($this->prefixesPsr0[$first])) {
foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
if (0 === strpos($class, $prefix)) {
foreach ($dirs as $dir) {
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
return $file;
}
}
}
}
}
// PSR-0 fallback dirs
foreach ($this->fallbackDirsPsr0 as $dir) {
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
return $file;
}
}
// PSR-0 include paths.
if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
return $file;
}
return false;
}
/**
* @return void
*/
private static function initializeIncludeClosure()
{
if (self::$includeFile !== null) {
return;
}
/**
* Scope isolated include.
*
* Prevents access to $this/self from included files.
*
* @param string $file
* @return void
*/
self::$includeFile = \Closure::bind(static function($file) {
include $file;
}, null, null);
}
}
+359
View File
@@ -0,0 +1,359 @@
<?php
/*
* This file is part of Composer.
*
* (c) Nils Adermann <naderman@naderman.de>
* Jordi Boggiano <j.boggiano@seld.be>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Composer;
use Composer\Autoload\ClassLoader;
use Composer\Semver\VersionParser;
/**
* This class is copied in every Composer installed project and available to all
*
* See also https://getcomposer.org/doc/07-runtime.md#installed-versions
*
* To require its presence, you can require `composer-runtime-api ^2.0`
*
* @final
*/
class InstalledVersions
{
/**
* @var mixed[]|null
* @psalm-var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}|array{}|null
*/
private static $installed;
/**
* @var bool|null
*/
private static $canGetVendors;
/**
* @var array[]
* @psalm-var array<string, array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
*/
private static $installedByVendor = array();
/**
* Returns a list of all package names which are present, either by being installed, replaced or provided
*
* @return string[]
* @psalm-return list<string>
*/
public static function getInstalledPackages()
{
$packages = array();
foreach (self::getInstalled() as $installed) {
$packages[] = array_keys($installed['versions']);
}
if (1 === \count($packages)) {
return $packages[0];
}
return array_keys(array_flip(\call_user_func_array('array_merge', $packages)));
}
/**
* Returns a list of all package names with a specific type e.g. 'library'
*
* @param string $type
* @return string[]
* @psalm-return list<string>
*/
public static function getInstalledPackagesByType($type)
{
$packagesByType = array();
foreach (self::getInstalled() as $installed) {
foreach ($installed['versions'] as $name => $package) {
if (isset($package['type']) && $package['type'] === $type) {
$packagesByType[] = $name;
}
}
}
return $packagesByType;
}
/**
* Checks whether the given package is installed
*
* This also returns true if the package name is provided or replaced by another package
*
* @param string $packageName
* @param bool $includeDevRequirements
* @return bool
*/
public static function isInstalled($packageName, $includeDevRequirements = true)
{
foreach (self::getInstalled() as $installed) {
if (isset($installed['versions'][$packageName])) {
return $includeDevRequirements || !isset($installed['versions'][$packageName]['dev_requirement']) || $installed['versions'][$packageName]['dev_requirement'] === false;
}
}
return false;
}
/**
* Checks whether the given package satisfies a version constraint
*
* e.g. If you want to know whether version 2.3+ of package foo/bar is installed, you would call:
*
* Composer\InstalledVersions::satisfies(new VersionParser, 'foo/bar', '^2.3')
*
* @param VersionParser $parser Install composer/semver to have access to this class and functionality
* @param string $packageName
* @param string|null $constraint A version constraint to check for, if you pass one you have to make sure composer/semver is required by your package
* @return bool
*/
public static function satisfies(VersionParser $parser, $packageName, $constraint)
{
$constraint = $parser->parseConstraints((string) $constraint);
$provided = $parser->parseConstraints(self::getVersionRanges($packageName));
return $provided->matches($constraint);
}
/**
* Returns a version constraint representing all the range(s) which are installed for a given package
*
* It is easier to use this via isInstalled() with the $constraint argument if you need to check
* whether a given version of a package is installed, and not just whether it exists
*
* @param string $packageName
* @return string Version constraint usable with composer/semver
*/
public static function getVersionRanges($packageName)
{
foreach (self::getInstalled() as $installed) {
if (!isset($installed['versions'][$packageName])) {
continue;
}
$ranges = array();
if (isset($installed['versions'][$packageName]['pretty_version'])) {
$ranges[] = $installed['versions'][$packageName]['pretty_version'];
}
if (array_key_exists('aliases', $installed['versions'][$packageName])) {
$ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']);
}
if (array_key_exists('replaced', $installed['versions'][$packageName])) {
$ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']);
}
if (array_key_exists('provided', $installed['versions'][$packageName])) {
$ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']);
}
return implode(' || ', $ranges);
}
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
}
/**
* @param string $packageName
* @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present
*/
public static function getVersion($packageName)
{
foreach (self::getInstalled() as $installed) {
if (!isset($installed['versions'][$packageName])) {
continue;
}
if (!isset($installed['versions'][$packageName]['version'])) {
return null;
}
return $installed['versions'][$packageName]['version'];
}
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
}
/**
* @param string $packageName
* @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present
*/
public static function getPrettyVersion($packageName)
{
foreach (self::getInstalled() as $installed) {
if (!isset($installed['versions'][$packageName])) {
continue;
}
if (!isset($installed['versions'][$packageName]['pretty_version'])) {
return null;
}
return $installed['versions'][$packageName]['pretty_version'];
}
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
}
/**
* @param string $packageName
* @return string|null If the package is being replaced or provided but is not really installed, null will be returned as reference
*/
public static function getReference($packageName)
{
foreach (self::getInstalled() as $installed) {
if (!isset($installed['versions'][$packageName])) {
continue;
}
if (!isset($installed['versions'][$packageName]['reference'])) {
return null;
}
return $installed['versions'][$packageName]['reference'];
}
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
}
/**
* @param string $packageName
* @return string|null If the package is being replaced or provided but is not really installed, null will be returned as install path. Packages of type metapackages also have a null install path.
*/
public static function getInstallPath($packageName)
{
foreach (self::getInstalled() as $installed) {
if (!isset($installed['versions'][$packageName])) {
continue;
}
return isset($installed['versions'][$packageName]['install_path']) ? $installed['versions'][$packageName]['install_path'] : null;
}
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
}
/**
* @return array
* @psalm-return array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}
*/
public static function getRootPackage()
{
$installed = self::getInstalled();
return $installed[0]['root'];
}
/**
* Returns the raw installed.php data for custom implementations
*
* @deprecated Use getAllRawData() instead which returns all datasets for all autoloaders present in the process. getRawData only returns the first dataset loaded, which may not be what you expect.
* @return array[]
* @psalm-return array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}
*/
public static function getRawData()
{
@trigger_error('getRawData only returns the first dataset loaded, which may not be what you expect. Use getAllRawData() instead which returns all datasets for all autoloaders present in the process.', E_USER_DEPRECATED);
if (null === self::$installed) {
// only require the installed.php file if this file is loaded from its dumped location,
// and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
if (substr(__DIR__, -8, 1) !== 'C') {
self::$installed = include __DIR__ . '/installed.php';
} else {
self::$installed = array();
}
}
return self::$installed;
}
/**
* Returns the raw data of all installed.php which are currently loaded for custom implementations
*
* @return array[]
* @psalm-return list<array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
*/
public static function getAllRawData()
{
return self::getInstalled();
}
/**
* Lets you reload the static array from another file
*
* This is only useful for complex integrations in which a project needs to use
* this class but then also needs to execute another project's autoloader in process,
* and wants to ensure both projects have access to their version of installed.php.
*
* A typical case would be PHPUnit, where it would need to make sure it reads all
* the data it needs from this class, then call reload() with
* `require $CWD/vendor/composer/installed.php` (or similar) as input to make sure
* the project in which it runs can then also use this class safely, without
* interference between PHPUnit's dependencies and the project's dependencies.
*
* @param array[] $data A vendor/composer/installed.php data set
* @return void
*
* @psalm-param array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $data
*/
public static function reload($data)
{
self::$installed = $data;
self::$installedByVendor = array();
}
/**
* @return array[]
* @psalm-return list<array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
*/
private static function getInstalled()
{
if (null === self::$canGetVendors) {
self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders');
}
$installed = array();
if (self::$canGetVendors) {
foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
if (isset(self::$installedByVendor[$vendorDir])) {
$installed[] = self::$installedByVendor[$vendorDir];
} elseif (is_file($vendorDir.'/composer/installed.php')) {
/** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
$required = require $vendorDir.'/composer/installed.php';
$installed[] = self::$installedByVendor[$vendorDir] = $required;
if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) {
self::$installed = $installed[count($installed) - 1];
}
}
}
}
if (null === self::$installed) {
// only require the installed.php file if this file is loaded from its dumped location,
// and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
if (substr(__DIR__, -8, 1) !== 'C') {
/** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
$required = require __DIR__ . '/installed.php';
self::$installed = $required;
} else {
self::$installed = array();
}
}
if (self::$installed !== array()) {
$installed[] = self::$installed;
}
return $installed;
}
}
+21
View File
@@ -0,0 +1,21 @@
Copyright (c) Nils Adermann, Jordi Boggiano
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
+24
View File
@@ -0,0 +1,24 @@
<?php
// autoload_classmap.php @generated by Composer
$vendorDir = dirname(__DIR__);
$baseDir = dirname($vendorDir);
return array(
'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php',
'Datamatrix' => $vendorDir . '/tecnickcom/tcpdf/include/barcodes/datamatrix.php',
'PDF417' => $vendorDir . '/tecnickcom/tcpdf/include/barcodes/pdf417.php',
'QRcode' => $vendorDir . '/tecnickcom/tcpdf/include/barcodes/qrcode.php',
'TCPDF' => $vendorDir . '/tecnickcom/tcpdf/tcpdf.php',
'TCPDF2DBarcode' => $vendorDir . '/tecnickcom/tcpdf/tcpdf_barcodes_2d.php',
'TCPDFBarcode' => $vendorDir . '/tecnickcom/tcpdf/tcpdf_barcodes_1d.php',
'TCPDF_COLORS' => $vendorDir . '/tecnickcom/tcpdf/include/tcpdf_colors.php',
'TCPDF_FILTERS' => $vendorDir . '/tecnickcom/tcpdf/include/tcpdf_filters.php',
'TCPDF_FONTS' => $vendorDir . '/tecnickcom/tcpdf/include/tcpdf_fonts.php',
'TCPDF_FONT_DATA' => $vendorDir . '/tecnickcom/tcpdf/include/tcpdf_font_data.php',
'TCPDF_IMAGES' => $vendorDir . '/tecnickcom/tcpdf/include/tcpdf_images.php',
'TCPDF_IMPORT' => $vendorDir . '/tecnickcom/tcpdf/tcpdf_import.php',
'TCPDF_PARSER' => $vendorDir . '/tecnickcom/tcpdf/tcpdf_parser.php',
'TCPDF_STATIC' => $vendorDir . '/tecnickcom/tcpdf/include/tcpdf_static.php',
);
+9
View File
@@ -0,0 +1,9 @@
<?php
// autoload_namespaces.php @generated by Composer
$vendorDir = dirname(__DIR__);
$baseDir = dirname($vendorDir);
return array(
);
+9
View File
@@ -0,0 +1,9 @@
<?php
// autoload_psr4.php @generated by Composer
$vendorDir = dirname(__DIR__);
$baseDir = dirname($vendorDir);
return array(
);
+38
View File
@@ -0,0 +1,38 @@
<?php
// autoload_real.php @generated by Composer
class ComposerAutoloaderInit1ba944b1b2880695113851e981334169
{
private static $loader;
public static function loadClassLoader($class)
{
if ('Composer\Autoload\ClassLoader' === $class) {
require __DIR__ . '/ClassLoader.php';
}
}
/**
* @return \Composer\Autoload\ClassLoader
*/
public static function getLoader()
{
if (null !== self::$loader) {
return self::$loader;
}
require __DIR__ . '/platform_check.php';
spl_autoload_register(array('ComposerAutoloaderInit1ba944b1b2880695113851e981334169', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
spl_autoload_unregister(array('ComposerAutoloaderInit1ba944b1b2880695113851e981334169', 'loadClassLoader'));
require __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInit1ba944b1b2880695113851e981334169::getInitializer($loader));
$loader->register(true);
return $loader;
}
}
+34
View File
@@ -0,0 +1,34 @@
<?php
// autoload_static.php @generated by Composer
namespace Composer\Autoload;
class ComposerStaticInit1ba944b1b2880695113851e981334169
{
public static $classMap = array (
'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
'Datamatrix' => __DIR__ . '/..' . '/tecnickcom/tcpdf/include/barcodes/datamatrix.php',
'PDF417' => __DIR__ . '/..' . '/tecnickcom/tcpdf/include/barcodes/pdf417.php',
'QRcode' => __DIR__ . '/..' . '/tecnickcom/tcpdf/include/barcodes/qrcode.php',
'TCPDF' => __DIR__ . '/..' . '/tecnickcom/tcpdf/tcpdf.php',
'TCPDF2DBarcode' => __DIR__ . '/..' . '/tecnickcom/tcpdf/tcpdf_barcodes_2d.php',
'TCPDFBarcode' => __DIR__ . '/..' . '/tecnickcom/tcpdf/tcpdf_barcodes_1d.php',
'TCPDF_COLORS' => __DIR__ . '/..' . '/tecnickcom/tcpdf/include/tcpdf_colors.php',
'TCPDF_FILTERS' => __DIR__ . '/..' . '/tecnickcom/tcpdf/include/tcpdf_filters.php',
'TCPDF_FONTS' => __DIR__ . '/..' . '/tecnickcom/tcpdf/include/tcpdf_fonts.php',
'TCPDF_FONT_DATA' => __DIR__ . '/..' . '/tecnickcom/tcpdf/include/tcpdf_font_data.php',
'TCPDF_IMAGES' => __DIR__ . '/..' . '/tecnickcom/tcpdf/include/tcpdf_images.php',
'TCPDF_IMPORT' => __DIR__ . '/..' . '/tecnickcom/tcpdf/tcpdf_import.php',
'TCPDF_PARSER' => __DIR__ . '/..' . '/tecnickcom/tcpdf/tcpdf_parser.php',
'TCPDF_STATIC' => __DIR__ . '/..' . '/tecnickcom/tcpdf/include/tcpdf_static.php',
);
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->classMap = ComposerStaticInit1ba944b1b2880695113851e981334169::$classMap;
}, null, ClassLoader::class);
}
}
+81
View File
@@ -0,0 +1,81 @@
{
"packages": [
{
"name": "tecnickcom/tcpdf",
"version": "6.7.7",
"version_normalized": "6.7.7.0",
"source": {
"type": "git",
"url": "https://github.com/tecnickcom/TCPDF.git",
"reference": "cfbc0028cc23f057f2baf9e73bdc238153c22086"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/tecnickcom/TCPDF/zipball/cfbc0028cc23f057f2baf9e73bdc238153c22086",
"reference": "cfbc0028cc23f057f2baf9e73bdc238153c22086",
"shasum": ""
},
"require": {
"php": ">=5.5.0"
},
"time": "2024-10-26T12:15:02+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
"classmap": [
"config",
"include",
"tcpdf.php",
"tcpdf_parser.php",
"tcpdf_import.php",
"tcpdf_barcodes_1d.php",
"tcpdf_barcodes_2d.php",
"include/tcpdf_colors.php",
"include/tcpdf_filters.php",
"include/tcpdf_font_data.php",
"include/tcpdf_fonts.php",
"include/tcpdf_images.php",
"include/tcpdf_static.php",
"include/barcodes/datamatrix.php",
"include/barcodes/pdf417.php",
"include/barcodes/qrcode.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"LGPL-3.0-or-later"
],
"authors": [
{
"name": "Nicola Asuni",
"email": "info@tecnick.com",
"role": "lead"
}
],
"description": "TCPDF is a PHP class for generating PDF documents and barcodes.",
"homepage": "http://www.tcpdf.org/",
"keywords": [
"PDFD32000-2008",
"TCPDF",
"barcodes",
"datamatrix",
"pdf",
"pdf417",
"qrcode"
],
"support": {
"issues": "https://github.com/tecnickcom/TCPDF/issues",
"source": "https://github.com/tecnickcom/TCPDF/tree/6.7.7"
},
"funding": [
{
"url": "https://www.paypal.com/cgi-bin/webscr?cmd=_donations&currency_code=GBP&business=paypal@tecnick.com&item_name=donation%20for%20tcpdf%20project",
"type": "custom"
}
],
"install-path": "../tecnickcom/tcpdf"
}
],
"dev": true,
"dev-package-names": []
}
+32
View File
@@ -0,0 +1,32 @@
<?php return array(
'root' => array(
'name' => '__root__',
'pretty_version' => '1.0.0+no-version-set',
'version' => '1.0.0.0',
'reference' => null,
'type' => 'library',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
'dev' => true,
),
'versions' => array(
'__root__' => array(
'pretty_version' => '1.0.0+no-version-set',
'version' => '1.0.0.0',
'reference' => null,
'type' => 'library',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
'dev_requirement' => false,
),
'tecnickcom/tcpdf' => array(
'pretty_version' => '6.7.7',
'version' => '6.7.7.0',
'reference' => 'cfbc0028cc23f057f2baf9e73bdc238153c22086',
'type' => 'library',
'install_path' => __DIR__ . '/../tecnickcom/tcpdf',
'aliases' => array(),
'dev_requirement' => false,
),
),
);
+26
View File
@@ -0,0 +1,26 @@
<?php
// platform_check.php @generated by Composer
$issues = array();
if (!(PHP_VERSION_ID >= 50500)) {
$issues[] = 'Your Composer dependencies require a PHP version ">= 5.5.0". You are running ' . PHP_VERSION . '.';
}
if ($issues) {
if (!headers_sent()) {
header('HTTP/1.1 500 Internal Server Error');
}
if (!ini_get('display_errors')) {
if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
fwrite(STDERR, 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . implode(PHP_EOL, $issues) . PHP_EOL.PHP_EOL);
} elseif (!headers_sent()) {
echo 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . str_replace('You are running '.PHP_VERSION.'.', '', implode(PHP_EOL, $issues)) . PHP_EOL.PHP_EOL;
}
}
trigger_error(
'Composer detected issues in your platform: ' . implode(' ', $issues),
E_USER_ERROR
);
}
File diff suppressed because it is too large. Load diff
+860
View File
@@ -0,0 +1,860 @@
**********************************************************************
* TCPDF LICENSE
**********************************************************************
TCPDF is free software: you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
2002-2024 Nicola Asuni - Tecnick.com LTD
**********************************************************************
**********************************************************************
GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
This version of the GNU Lesser General Public License incorporates
the terms and conditions of version 3 of the GNU General Public
License, supplemented by the additional permissions listed below.
0. Additional Definitions.
As used herein, "this License" refers to version 3 of the GNU Lesser
General Public License, and the "GNU GPL" refers to version 3 of the GNU
General Public License.
"The Library" refers to a covered work governed by this License,
other than an Application or a Combined Work as defined below.
An "Application" is any work that makes use of an interface provided
by the Library, but which is not otherwise based on the Library.
Defining a subclass of a class defined by the Library is deemed a mode
of using an interface provided by the Library.
A "Combined Work" is a work produced by combining or linking an
Application with the Library. The particular version of the Library
with which the Combined Work was made is also called the "Linked
Version".
The "Minimal Corresponding Source" for a Combined Work means the
Corresponding Source for the Combined Work, excluding any source code
for portions of the Combined Work that, considered in isolation, are
based on the Application, and not on the Linked Version.
The "Corresponding Application Code" for a Combined Work means the
object code and/or source code for the Application, including any data
and utility programs needed for reproducing the Combined Work from the
Application, but excluding the System Libraries of the Combined Work.
1. Exception to Section 3 of the GNU GPL.
You may convey a covered work under sections 3 and 4 of this License
without being bound by section 3 of the GNU GPL.
2. Conveying Modified Versions.
If you modify a copy of the Library, and, in your modifications, a
facility refers to a function or data to be supplied by an Application
that uses the facility (other than as an argument passed when the
facility is invoked), then you may convey a copy of the modified
version:
a) under this License, provided that you make a good faith effort to
ensure that, in the event an Application does not supply the
function or data, the facility still operates, and performs
whatever part of its purpose remains meaningful, or
b) under the GNU GPL, with none of the additional permissions of
this License applicable to that copy.
3. Object Code Incorporating Material from Library Header Files.
The object code form of an Application may incorporate material from
a header file that is part of the Library. You may convey such object
code under terms of your choice, provided that, if the incorporated
material is not limited to numerical parameters, data structure
layouts and accessors, or small macros, inline functions and templates
(ten or fewer lines in length), you do both of the following:
a) Give prominent notice with each copy of the object code that the
Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the object code with a copy of the GNU GPL and this license
document.
4. Combined Works.
You may convey a Combined Work under terms of your choice that,
taken together, effectively do not restrict modification of the
portions of the Library contained in the Combined Work and reverse
engineering for debugging such modifications, if you also do each of
the following:
a) Give prominent notice with each copy of the Combined Work that
the Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the Combined Work with a copy of the GNU GPL and this license
document.
c) For a Combined Work that displays copyright notices during
execution, include the copyright notice for the Library among
these notices, as well as a reference directing the user to the
copies of the GNU GPL and this license document.
d) Do one of the following:
0) Convey the Minimal Corresponding Source under the terms of this
License, and the Corresponding Application Code in a form
suitable for, and under terms that permit, the user to
recombine or relink the Application with a modified version of
the Linked Version to produce a modified Combined Work, in the
manner specified by section 6 of the GNU GPL for conveying
Corresponding Source.
1) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (a) uses at run time
a copy of the Library already present on the user's computer
system, and (b) will operate properly with a modified version
of the Library that is interface-compatible with the Linked
Version.
e) Provide Installation Information, but only if you would otherwise
be required to provide such information under section 6 of the
GNU GPL, and only to the extent that such information is
necessary to install and execute a modified version of the
Combined Work produced by recombining or relinking the
Application with a modified version of the Linked Version. (If
you use option 4d0, the Installation Information must accompany
the Minimal Corresponding Source and Corresponding Application
Code. If you use option 4d1, you must provide the Installation
Information in the manner specified by section 6 of the GNU GPL
for conveying Corresponding Source.)
5. Combined Libraries.
You may place library facilities that are a work based on the
Library side by side in a single library together with other library
facilities that are not Applications and are not covered by this
License, and convey such a combined library under terms of your
choice, if you do both of the following:
a) Accompany the combined library with a copy of the same work based
on the Library, uncombined with any other library facilities,
conveyed under the terms of this License.
b) Give prominent notice with the combined library that part of it
is a work based on the Library, and explaining where to find the
accompanying uncombined form of the same work.
6. Revised Versions of the GNU Lesser General Public License.
The Free Software Foundation may publish revised and/or new versions
of the GNU Lesser General Public License from time to time. Such new
versions will be similar in spirit to the present version, but may
differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the
Library as you received it specifies that a certain numbered version
of the GNU Lesser General Public License "or any later version"
applies to it, you have the option of following the terms and
conditions either of that published version or of any later version
published by the Free Software Foundation. If the Library as you
received it does not specify a version number of the GNU Lesser
General Public License, you may choose any version of the GNU Lesser
General Public License ever published by the Free Software Foundation.
If the Library as you received it specifies that a proxy can decide
whether future versions of the GNU Lesser General Public License shall
apply, that proxy's public statement of acceptance of any version is
permanent authorization for you to choose that version for the
Library.
**********************************************************************
**********************************************************************
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
**********************************************************************
**********************************************************************
+83
View File
@@ -0,0 +1,83 @@
# TCPDF
*PHP PDF Library*
[![Donate via PayPal](https://img.shields.io/badge/donate-paypal-87ceeb.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&currency_code=GBP&business=paypal@tecnick.com&item_name=donation%20for%20TCPDF%20project)
*Please consider supporting this project by making a donation via [PayPal](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&currency_code=GBP&business=paypal@tecnick.com&item_name=donation%20for%20TCPDF%20project)*
* **category** Library
* **author** Nicola Asuni <info@tecnick.com>
* **copyright** 2002-2024 Nicola Asuni - Tecnick.com LTD
* **license** http://www.gnu.org/copyleft/lesser.html GNU-LGPL v3 (see LICENSE.TXT)
* **link** http://www.tcpdf.org
* **source** https://github.com/tecnickcom/TCPDF
## NOTE
A new version of this library is under development at https://github.com/tecnickcom/tc-lib-pdf and as a consequence this library is in support only mode.
## Description
PHP library for generating PDF documents on-the-fly.
### Main Features:
* no external libraries are required for the basic functions;
* all standard page formats, custom page formats, custom margins and units of measure;
* UTF-8 Unicode and Right-To-Left languages;
* TrueTypeUnicode, OpenTypeUnicode v1, TrueType, OpenType v1, Type1 and CID-0 fonts;
* font subsetting;
* methods to publish some XHTML + CSS code, Javascript and Forms;
* images, graphic (geometric figures) and transformation methods;
* supports JPEG, PNG and SVG images natively, all images supported by GD (GD, GD2, GD2PART, GIF, JPEG, PNG, BMP, XBM, XPM) and all images supported via ImagMagick (http://www.imagemagick.org/script/formats.php)
* 1D and 2D barcodes: CODE 39, ANSI MH10.8M-1983, USD-3, 3 of 9, CODE 93, USS-93, Standard 2 of 5, Interleaved 2 of 5, CODE 128 A/B/C, 2 and 5 Digits UPC-Based Extension, EAN 8, EAN 13, UPC-A, UPC-E, MSI, POSTNET, PLANET, RMS4CC (Royal Mail 4-state Customer Code), CBC (Customer Bar Code), KIX (Klant index - Customer index), Intelligent Mail Barcode, Onecode, USPS-B-3200, CODABAR, CODE 11, PHARMACODE, PHARMACODE TWO-TRACKS, Datamatrix, QR-Code, PDF417;
* JPEG and PNG ICC profiles, Grayscale, RGB, CMYK, Spot Colors and Transparencies;
* automatic page header and footer management;
* document encryption up to 256 bit and digital signature certifications;
* transactions to UNDO commands;
* PDF annotations, including links, text and file attachments;
* text rendering modes (fill, stroke and clipping);
* multiple columns mode;
* no-write page regions;
* bookmarks, named destinations and table of content;
* text hyphenation;
* text stretching and spacing (tracking);
* automatic page break, line break and text alignments including justification;
* automatic page numbering and page groups;
* move and delete pages;
* page compression (requires php-zlib extension);
* XOBject Templates;
* Layers and object visibility.
* PDF/A-1b support.
### Third party fonts:
This library may include third party font files released with different licenses.
All the PHP files on the fonts directory are subject to the general TCPDF license (GNU-LGPLv3),
they do not contain any binary data but just a description of the general properties of a particular font.
These files can be also generated on the fly using the font utilities and TCPDF methods.
All the original binary TTF font files have been renamed for compatibility with TCPDF and compressed using the gzcompress PHP function that uses the ZLIB data format (.z files).
The binary files (.z) that begins with the prefix "free" have been extracted from the GNU FreeFont collection (GNU-GPLv3).
The binary files (.z) that begins with the prefix "pdfa" have been derived from the GNU FreeFont, so they are subject to the same license.
For the details of Copyright, License and other information, please check the files inside the directory fonts/freefont-20120503
Link : http://www.gnu.org/software/freefont/
The binary files (.z) that begins with the prefix "dejavu" have been extracted from the DejaVu fonts 2.33 (Bitstream) collection.
For the details of Copyright, License and other information, please check the files inside the directory fonts/dejavu-fonts-ttf-2.33
Link : http://dejavu-fonts.org
The binary files (.z) that begins with the prefix "ae" have been extracted from the Arabeyes.org collection (GNU-GPLv2).
Link : http://projects.arabeyes.org/
### ICC profile:
TCPDF includes the sRGB.icc profile from the icc-profiles-free Debian package:
https://packages.debian.org/source/stable/icc-profiles-free
## Developer(s) Contact
* Nicola Asuni <info@tecnick.com>
+1
View File
@@ -0,0 +1 @@
6.7.7
+52
View File
@@ -0,0 +1,52 @@
{
"name": "tecnickcom/tcpdf",
"type": "library",
"description": "TCPDF is a PHP class for generating PDF documents and barcodes.",
"keywords": [
"PDF",
"tcpdf",
"PDFD32000-2008",
"qrcode",
"datamatrix",
"pdf417",
"barcodes"
],
"homepage": "http://www.tcpdf.org/",
"version": "6.7.7",
"license": "LGPL-3.0-or-later",
"authors": [
{
"name": "Nicola Asuni",
"email": "info@tecnick.com",
"role": "lead"
}
],
"require": {
"php": ">=5.5.0"
},
"autoload": {
"classmap": [
"config",
"include",
"tcpdf.php",
"tcpdf_parser.php",
"tcpdf_import.php",
"tcpdf_barcodes_1d.php",
"tcpdf_barcodes_2d.php",
"include/tcpdf_colors.php",
"include/tcpdf_filters.php",
"include/tcpdf_font_data.php",
"include/tcpdf_fonts.php",
"include/tcpdf_images.php",
"include/tcpdf_static.php",
"include/barcodes/datamatrix.php",
"include/barcodes/pdf417.php",
"include/barcodes/qrcode.php"
]
},
"archive": {
"exclude": [
"/examples"
]
}
}
+235
View File
@@ -0,0 +1,235 @@
<?php
//============================================================+
// File name : tcpdf_config.php
// Begin : 2004-06-11
// Last Update : 2014-12-11
//
// Description : Configuration file for TCPDF.
// Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - info@tecnick.com
// License : GNU-LGPL v3 (http://www.gnu.org/copyleft/lesser.html)
// -------------------------------------------------------------------
// Copyright (C) 2004-2014 Nicola Asuni - Tecnick.com LTD
//
// This file is part of TCPDF software library.
//
// TCPDF is free software: you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// TCPDF is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with TCPDF. If not, see <http://www.gnu.org/licenses/>.
//
// See LICENSE.TXT file for more information.
//============================================================+
/**
* Configuration file for TCPDF.
* @author Nicola Asuni
* @package com.tecnick.tcpdf
* @version 4.9.005
* @since 2004-10-27
*/
// IMPORTANT:
// If you define the constant K_TCPDF_EXTERNAL_CONFIG, all the following settings will be ignored.
// If you use the tcpdf_autoconfig.php, then you can overwrite some values here.
/**
* Installation path (/var/www/tcpdf/).
* By default it is automatically calculated but you can also set it as a fixed string to improve performances.
*/
//define ('K_PATH_MAIN', '');
/**
* URL path to tcpdf installation folder (http://localhost/tcpdf/).
* By default it is automatically set but you can also set it as a fixed string to improve performances.
*/
//define ('K_PATH_URL', '');
/**
* Path for PDF fonts.
* By default it is automatically set but you can also set it as a fixed string to improve performances.
*/
//define ('K_PATH_FONTS', K_PATH_MAIN.'fonts/');
/**
* Default images directory.
* By default it is automatically set but you can also set it as a fixed string to improve performances.
*/
//define ('K_PATH_IMAGES', '');
/**
* Deafult image logo used be the default Header() method.
* Please set here your own logo or an empty string to disable it.
*/
//define ('PDF_HEADER_LOGO', '');
/**
* Header logo image width in user units.
*/
//define ('PDF_HEADER_LOGO_WIDTH', 0);
/**
* Cache directory for temporary files (full path).
*/
//define ('K_PATH_CACHE', '/tmp/');
/**
* Generic name for a blank image.
*/
define ('K_BLANK_IMAGE', '_blank.png');
/**
* Page format.
*/
define ('PDF_PAGE_FORMAT', 'A4');
/**
* Page orientation (P=portrait, L=landscape).
*/
define ('PDF_PAGE_ORIENTATION', 'P');
/**
* Document creator.
*/
define ('PDF_CREATOR', 'TCPDF');
/**
* Document author.
*/
define ('PDF_AUTHOR', 'TCPDF');
/**
* Header title.
*/
define ('PDF_HEADER_TITLE', 'TCPDF Example');
/**
* Header description string.
*/
define ('PDF_HEADER_STRING', "by Nicola Asuni - Tecnick.com\nwww.tcpdf.org");
/**
* Document unit of measure [pt=point, mm=millimeter, cm=centimeter, in=inch].
*/
define ('PDF_UNIT', 'mm');
/**
* Header margin.
*/
define ('PDF_MARGIN_HEADER', 5);
/**
* Footer margin.
*/
define ('PDF_MARGIN_FOOTER', 10);
/**
* Top margin.
*/
define ('PDF_MARGIN_TOP', 27);
/**
* Bottom margin.
*/
define ('PDF_MARGIN_BOTTOM', 25);
/**
* Left margin.
*/
define ('PDF_MARGIN_LEFT', 15);
/**
* Right margin.
*/
define ('PDF_MARGIN_RIGHT', 15);
/**
* Default main font name.
*/
define ('PDF_FONT_NAME_MAIN', 'helvetica');
/**
* Default main font size.
*/
define ('PDF_FONT_SIZE_MAIN', 10);
/**
* Default data font name.
*/
define ('PDF_FONT_NAME_DATA', 'helvetica');
/**
* Default data font size.
*/
define ('PDF_FONT_SIZE_DATA', 8);
/**
* Default monospaced font name.
*/
define ('PDF_FONT_MONOSPACED', 'courier');
/**
* Ratio used to adjust the conversion of pixels to user units.
*/
define ('PDF_IMAGE_SCALE_RATIO', 1.25);
/**
* Magnification factor for titles.
*/
define('HEAD_MAGNIFICATION', 1.1);
/**
* Height of cell respect font height.
*/
define('K_CELL_HEIGHT_RATIO', 1.25);
/**
* Title magnification respect main font size.
*/
define('K_TITLE_MAGNIFICATION', 1.3);
/**
* Reduction factor for small font.
*/
define('K_SMALL_RATIO', 2/3);
/**
* Set to true to enable the special procedure used to avoid the overlappind of symbols on Thai language.
*/
define('K_THAI_TOPCHARS', true);
/**
* If true allows to call TCPDF methods using HTML syntax
* IMPORTANT: For security reason, disable this feature if you are printing user HTML content.
*/
define('K_TCPDF_CALLS_IN_HTML', false);
/**
* List of TCPDF methods that are allowed to be called using HTML syntax.
* Note: each method name must end with surrounded with | (pipe) character.
* The constant K_TCPDF_CALLS_IN_HTML must be set to true.
* IMPORTANT: For security reason, disable this feature if you are allowing user HTML content.
*/
define('K_ALLOWED_TCPDF_TAGS', '');
/**
* If true and PHP version is greater than 5, then the Error() method throw new exception instead of terminating the execution.
*/
define('K_TCPDF_THROW_EXCEPTION_ERROR', false);
/**
* Default timezone for datetime functions
*/
define('K_TIMEZONE', 'UTC');
//============================================================+
// END OF FILE
//============================================================+
@@ -0,0 +1,57 @@
<?php
//============================================================+
// File name : example_1d_html.php
// Version : 1.0.000
// Begin : 2011-07-21
// Last Update : 2013-03-19
// Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - info@tecnick.com
// License : GNU-LGPL v3 (http://www.gnu.org/copyleft/lesser.html)
// -------------------------------------------------------------------
// Copyright (C) 2009-2013 Nicola Asuni - Tecnick.com LTD
//
// This file is part of TCPDF software library.
//
// TCPDF is free software: you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// TCPDF is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with TCPDF. If not, see <http://www.gnu.org/licenses/>.
//
// See LICENSE.TXT file for more information.
// -------------------------------------------------------------------
//
// Description : Example for tcpdf_barcodes_1d.php class
//
//============================================================+
/**
* @file
* Example for tcpdf_barcodes_1d.php class
* @package com.tecnick.tcpdf
* @author Nicola Asuni
* @version 1.0.000
* @group barcode
* @group 1d
* @group html
* @group comparable
*/
// include 1D barcode class (search for installation path)
require_once(dirname(__FILE__).'/tcpdf_barcodes_1d_include.php');
// set the barcode content and type
$barcodeobj = new TCPDFBarcode('http://www.tcpdf.org', 'C128');
// output the barcode as HTML object
echo $barcodeobj->getBarcodeHTML(2, 30, 'black');
//============================================================+
// END OF FILE
//============================================================+
@@ -0,0 +1,56 @@
<?php
//============================================================+
// File name : example_1d_png.php
// Version : 1.0.000
// Begin : 2011-07-21
// Last Update : 2013-03-19
// Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - info@tecnick.com
// License : GNU-LGPL v3 (http://www.gnu.org/copyleft/lesser.html)
// -------------------------------------------------------------------
// Copyright (C) 2009-2013 Nicola Asuni - Tecnick.com LTD
//
// This file is part of TCPDF software library.
//
// TCPDF is free software: you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// TCPDF is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with TCPDF. If not, see <http://www.gnu.org/licenses/>.
//
// See LICENSE.TXT file for more information.
// -------------------------------------------------------------------
//
// Description : Example for tcpdf_barcodes_1d.php class
//
//============================================================+
/**
* @file
* Example for tcpdf_barcodes_1d.php class
* @package com.tecnick.tcpdf
* @author Nicola Asuni
* @version 1.0.000
* @group barcode
* @group 1d
* @group png
*/
// include 1D barcode class (search for installation path)
require_once(dirname(__FILE__).'/tcpdf_barcodes_1d_include.php');
// set the barcode content and type
$barcodeobj = new TCPDFBarcode('http://www.tcpdf.org', 'C128');
// output the barcode as PNG image
$barcodeobj->getBarcodePNG(2, 30, array(0,0,0));
//============================================================+
// END OF FILE
//============================================================+
@@ -0,0 +1,57 @@
<?php
//============================================================+
// File name : example_1d_svg.php
// Version : 1.0.000
// Begin : 2011-07-21
// Last Update : 2013-03-19
// Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - info@tecnick.com
// License : GNU-LGPL v3 (http://www.gnu.org/copyleft/lesser.html)
// -------------------------------------------------------------------
// Copyright (C) 2009-2013 Nicola Asuni - Tecnick.com LTD
//
// This file is part of TCPDF software library.
//
// TCPDF is free software: you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// TCPDF is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with TCPDF. If not, see <http://www.gnu.org/licenses/>.
//
// See LICENSE.TXT file for more information.
// -------------------------------------------------------------------
//
// Description : Example for tcpdf_barcodes_1d.php class
//
//============================================================+
/**
* @file
* Example for tcpdf_barcodes_1d.php class
* @package com.tecnick.tcpdf
* @author Nicola Asuni
* @version 1.0.000
* @group barcode
* @group 1d
* @group svg
* @group comparable
*/
// include 1D barcode class (search for installation path)
require_once(dirname(__FILE__).'/tcpdf_barcodes_1d_include.php');
// set the barcode content and type
$barcodeobj = new TCPDFBarcode('http://www.tcpdf.org', 'C128');
// output the barcode as SVG image
$barcodeobj->getBarcodeSVG(2, 30, 'black');
//============================================================+
// END OF FILE
//============================================================+
@@ -0,0 +1,57 @@
<?php
//============================================================+
// File name : example_1d_svgi.php
// Version : 1.0.000
// Begin : 2011-07-21
// Last Update : 2013-03-19
// Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - info@tecnick.com
// License : GNU-LGPL v3 (http://www.gnu.org/copyleft/lesser.html)
// -------------------------------------------------------------------
// Copyright (C) 2009-2013 Nicola Asuni - Tecnick.com LTD
//
// This file is part of TCPDF software library.
//
// TCPDF is free software: you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// TCPDF is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with TCPDF. If not, see <http://www.gnu.org/licenses/>.
//
// See LICENSE.TXT file for more information.
// -------------------------------------------------------------------
//
// Description : Example for tcpdf_barcodes_1d.php class
//
//============================================================+
/**
* @file
* Example for tcpdf_barcodes_1d.php class
* @package com.tecnick.tcpdf
* @author Nicola Asuni
* @version 1.0.000
* @group barcode
* @group 1d
* @group svg
* @group comparable
*/
// include 1D barcode class (search for installation path)
require_once(dirname(__FILE__).'/tcpdf_barcodes_1d_include.php');
// set the barcode content and type
$barcodeobj = new TCPDFBarcode('http://www.tcpdf.org', 'C128');
// output the barcode as SVG inline code
echo $barcodeobj->getBarcodeSVGcode(2, 40, 'black');
//============================================================+
// END OF FILE
//============================================================+
@@ -0,0 +1,57 @@
<?php
//============================================================+
// File name : example_2d_html.php
// Version : 1.0.000
// Begin : 2011-07-21
// Last Update : 2013-03-19
// Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - info@tecnick.com
// License : GNU-LGPL v3 (http://www.gnu.org/copyleft/lesser.html)
// -------------------------------------------------------------------
// Copyright (C) 2009-2013 Nicola Asuni - Tecnick.com LTD
//
// This file is part of TCPDF software library.
//
// TCPDF is free software: you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// TCPDF is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with TCPDF. If not, see <http://www.gnu.org/licenses/>.
//
// See LICENSE.TXT file for more information.
// -------------------------------------------------------------------
//
// Description : Example for tcpdf_barcodes_2d.php class
//
//============================================================+
/**
* @file
* Example for tcpdf_barcodes_2d.php class
* @package com.tecnick.tcpdf
* @author Nicola Asuni
* @version 1.0.009
* @group barcode
* @group datamatrix
* @group html
* @group comparable
*/
// include 2D barcode class (search for installation path)
require_once(dirname(__FILE__).'/tcpdf_barcodes_2d_include.php');
// set the barcode content and type
$barcodeobj = new TCPDF2DBarcode('http://www.tcpdf.org', 'DATAMATRIX');
// output the barcode as HTML object
echo $barcodeobj->getBarcodeHTML(6, 6, 'black');
//============================================================+
// END OF FILE
//============================================================+
@@ -0,0 +1,56 @@
<?php
//============================================================+
// File name : example_2d_png.php
// Version : 1.0.000
// Begin : 2011-07-21
// Last Update : 2013-03-19
// Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - info@tecnick.com
// License : GNU-LGPL v3 (http://www.gnu.org/copyleft/lesser.html)
// -------------------------------------------------------------------
// Copyright (C) 2009-2013 Nicola Asuni - Tecnick.com LTD
//
// This file is part of TCPDF software library.
//
// TCPDF is free software: you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// TCPDF is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with TCPDF. If not, see <http://www.gnu.org/licenses/>.
//
// See LICENSE.TXT file for more information.
// -------------------------------------------------------------------
//
// Description : Example for tcpdf_barcodes_2d.php class
//
//============================================================+
/**
* @file
* Example for tcpdf_barcodes_2d.php class
* @package com.tecnick.tcpdf
* @author Nicola Asuni
* @version 1.0.009
* @group barcode
* @group datamatrix
* @group png
*/
// include 2D barcode class (search for installation path)
require_once(dirname(__FILE__).'/tcpdf_barcodes_2d_include.php');
// set the barcode content and type
$barcodeobj = new TCPDF2DBarcode('http://www.tcpdf.org', 'DATAMATRIX');
// output the barcode as PNG image
$barcodeobj->getBarcodePNG(6, 6, array(0,0,0));
//============================================================+
// END OF FILE
//============================================================+
@@ -0,0 +1,57 @@
<?php
//============================================================+
// File name : example_2d_svg.php
// Version : 1.0.000
// Begin : 2011-07-21
// Last Update : 2013-03-19
// Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - info@tecnick.com
// License : GNU-LGPL v3 (http://www.gnu.org/copyleft/lesser.html)
// -------------------------------------------------------------------
// Copyright (C) 2009-2013 Nicola Asuni - Tecnick.com LTD
//
// This file is part of TCPDF software library.
//
// TCPDF is free software: you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// TCPDF is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with TCPDF. If not, see <http://www.gnu.org/licenses/>.
//
// See LICENSE.TXT file for more information.
// -------------------------------------------------------------------
//
// Description : Example for tcpdf_barcodes_2d.php class
//
//============================================================+
/**
* @file
* Example for tcpdf_barcodes_2d.php class
* @package com.tecnick.tcpdf
* @author Nicola Asuni
* @version 1.0.009
* @group barcode
* @group datamatrix
* @group svg
* @group comparable
*/
// include 2D barcode class (search for installation path)
require_once(dirname(__FILE__).'/tcpdf_barcodes_2d_include.php');
// set the barcode content and type
$barcodeobj = new TCPDF2DBarcode('http://www.tcpdf.org', 'DATAMATRIX');
// output the barcode as SVG image
$barcodeobj->getBarcodeSVG(6, 6, 'black');
//============================================================+
// END OF FILE
//============================================================+
@@ -0,0 +1,57 @@
<?php
//============================================================+
// File name : example_2d_svgi.php
// Version : 1.0.000
// Begin : 2011-07-21
// Last Update : 2013-03-19
// Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - info@tecnick.com
// License : GNU-LGPL v3 (http://www.gnu.org/copyleft/lesser.html)
// -------------------------------------------------------------------
// Copyright (C) 2009-2013 Nicola Asuni - Tecnick.com LTD
//
// This file is part of TCPDF software library.
//
// TCPDF is free software: you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// TCPDF is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with TCPDF. If not, see <http://www.gnu.org/licenses/>.
//
// See LICENSE.TXT file for more information.
// -------------------------------------------------------------------
//
// Description : Example for tcpdf_barcodes_2d.php class
//
//============================================================+
/**
* @file
* Example for tcpdf_barcodes_2d.php class
* @package com.tecnick.tcpdf
* @author Nicola Asuni
* @version 1.0.009
* @group barcode
* @group datamatrix
* @group svg
* @group comparable
*/
// include 2D barcode class (search for installation path)
require_once(dirname(__FILE__).'/tcpdf_barcodes_2d_include.php');
// set the barcode content and type
$barcodeobj = new TCPDF2DBarcode('http://www.tcpdf.org', 'DATAMATRIX');
// output the barcode as SVG inline code
echo $barcodeobj->getBarcodeSVGcode(6, 6, 'black');
//============================================================+
// END OF FILE
//============================================================+
@@ -0,0 +1,57 @@
<?php
//============================================================+
// File name : example_2d_html.php
// Version : 1.0.000
// Begin : 2011-07-21
// Last Update : 2013-03-19
// Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - info@tecnick.com
// License : GNU-LGPL v3 (http://www.gnu.org/copyleft/lesser.html)
// -------------------------------------------------------------------
// Copyright (C) 2009-2013 Nicola Asuni - Tecnick.com LTD
//
// This file is part of TCPDF software library.
//
// TCPDF is free software: you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// TCPDF is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with TCPDF. If not, see <http://www.gnu.org/licenses/>.
//
// See LICENSE.TXT file for more information.
// -------------------------------------------------------------------
//
// Description : Example for tcpdf_barcodes_2d.php class
//
//============================================================+
/**
* @file
* Example for tcpdf_barcodes_2d.php class
* @package com.tecnick.tcpdf
* @author Nicola Asuni
* @version 1.0.009
* @group barcode
* @group pdf417
* @group html
* @group comparable
*/
// include 2D barcode class (search for installation path)
require_once(dirname(__FILE__).'/tcpdf_barcodes_2d_include.php');
// set the barcode content and type
$barcodeobj = new TCPDF2DBarcode('http://www.tcpdf.org', 'PDF417');
// output the barcode as HTML object
echo $barcodeobj->getBarcodeHTML(4, 4, 'black');
//============================================================+
// END OF FILE
//============================================================+
@@ -0,0 +1,56 @@
<?php
//============================================================+
// File name : example_2d_png.php
// Version : 1.0.000
// Begin : 2011-07-21
// Last Update : 2013-03-19
// Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - info@tecnick.com
// License : GNU-LGPL v3 (http://www.gnu.org/copyleft/lesser.html)
// -------------------------------------------------------------------
// Copyright (C) 2009-2013 Nicola Asuni - Tecnick.com LTD
//
// This file is part of TCPDF software library.
//
// TCPDF is free software: you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// TCPDF is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with TCPDF. If not, see <http://www.gnu.org/licenses/>.
//
// See LICENSE.TXT file for more information.
// -------------------------------------------------------------------
//
// Description : Example for tcpdf_barcodes_2d.php class
//
//============================================================+
/**
* @file
* Example for tcpdf_barcodes_2d.php class
* @package com.tecnick.tcpdf
* @author Nicola Asuni
* @version 1.0.009
* @group barcode
* @group pdf417
* @group png
*/
// include 2D barcode class (search for installation path)
require_once(dirname(__FILE__).'/tcpdf_barcodes_2d_include.php');
// set the barcode content and type
$barcodeobj = new TCPDF2DBarcode('http://www.tcpdf.org', 'PDF417');
// output the barcode as PNG image
$barcodeobj->getBarcodePNG(4, 4, array(0,0,0));
//============================================================+
// END OF FILE
//============================================================+
@@ -0,0 +1,57 @@
<?php
//============================================================+
// File name : example_2d_svg.php
// Version : 1.0.000
// Begin : 2011-07-21
// Last Update : 2013-03-19
// Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - info@tecnick.com
// License : GNU-LGPL v3 (http://www.gnu.org/copyleft/lesser.html)
// -------------------------------------------------------------------
// Copyright (C) 2009-2013 Nicola Asuni - Tecnick.com LTD
//
// This file is part of TCPDF software library.
//
// TCPDF is free software: you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// TCPDF is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with TCPDF. If not, see <http://www.gnu.org/licenses/>.
//
// See LICENSE.TXT file for more information.
// -------------------------------------------------------------------
//
// Description : Example for tcpdf_barcodes_2d.php class
//
//============================================================+
/**
* @file
* Example for tcpdf_barcodes_2d.php class
* @package com.tecnick.tcpdf
* @author Nicola Asuni
* @version 1.0.009
* @group barcode
* @group pdf417
* @group svg
* @group comparable
*/
// include 2D barcode class (search for installation path)
require_once(dirname(__FILE__).'/tcpdf_barcodes_2d_include.php');
// set the barcode content and type
$barcodeobj = new TCPDF2DBarcode('http://www.tcpdf.org', 'PDF417');
// output the barcode as SVG image
$barcodeobj->getBarcodeSVG(4, 4, 'black');
//============================================================+
// END OF FILE
//============================================================+
@@ -0,0 +1,57 @@
<?php
//============================================================+
// File name : example_2d_svgi.php
// Version : 1.0.000
// Begin : 2011-07-21
// Last Update : 2013-03-19
// Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - info@tecnick.com
// License : GNU-LGPL v3 (http://www.gnu.org/copyleft/lesser.html)
// -------------------------------------------------------------------
// Copyright (C) 2009-2013 Nicola Asuni - Tecnick.com LTD
//
// This file is part of TCPDF software library.
//
// TCPDF is free software: you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// TCPDF is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with TCPDF. If not, see <http://www.gnu.org/licenses/>.
//
// See LICENSE.TXT file for more information.
// -------------------------------------------------------------------
//
// Description : Example for tcpdf_barcodes_2d.php class
//
//============================================================+
/**
* @file
* Example for tcpdf_barcodes_2d.php class
* @package com.tecnick.tcpdf
* @author Nicola Asuni
* @version 1.0.009
* @group barcode
* @group pdf417
* @group svg
* @group comparable
*/
// include 2D barcode class (search for installation path)
require_once(dirname(__FILE__).'/tcpdf_barcodes_2d_include.php');
// set the barcode content and type
$barcodeobj = new TCPDF2DBarcode('http://www.tcpdf.org', 'PDF417');
// output the barcode as SVG inline code
echo $barcodeobj->getBarcodeSVGcode(4, 4, 'black');
//============================================================+
// END OF FILE
//============================================================+
@@ -0,0 +1,56 @@
<?php
//============================================================+
// File name : example_2d_html.php
// Version : 1.0.000
// Begin : 2011-07-21
// Last Update : 2013-03-19
// Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - info@tecnick.com
// License : GNU-LGPL v3 (http://www.gnu.org/copyleft/lesser.html)
// -------------------------------------------------------------------
// Copyright (C) 2009-2013 Nicola Asuni - Tecnick.com LTD
//
// This file is part of TCPDF software library.
//
// TCPDF is free software: you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// TCPDF is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with TCPDF. If not, see <http://www.gnu.org/licenses/>.
//
// See LICENSE.TXT file for more information.
// -------------------------------------------------------------------
//
// Description : Example for tcpdf_barcodes_2d.php class
//
//============================================================+
/**
* @file
* Example for tcpdf_barcodes_2d.php class
* @package com.tecnick.tcpdf
* @author Nicola Asuni
* @version 1.0.009
* @group barcode
* @group qrcode
* @group html
*/
// include 2D barcode class (search for installation path)
require_once(dirname(__FILE__).'/tcpdf_barcodes_2d_include.php');
// set the barcode content and type
$barcodeobj = new TCPDF2DBarcode('http://www.tcpdf.org', 'QRCODE,H');
// output the barcode as HTML object
echo $barcodeobj->getBarcodeHTML(6, 6, 'black');
//============================================================+
// END OF FILE
//============================================================+
@@ -0,0 +1,56 @@
<?php
//============================================================+
// File name : example_2d_png.php
// Version : 1.0.000
// Begin : 2011-07-21
// Last Update : 2013-03-19
// Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - info@tecnick.com
// License : GNU-LGPL v3 (http://www.gnu.org/copyleft/lesser.html)
// -------------------------------------------------------------------
// Copyright (C) 2009-2013 Nicola Asuni - Tecnick.com LTD
//
// This file is part of TCPDF software library.
//
// TCPDF is free software: you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// TCPDF is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with TCPDF. If not, see <http://www.gnu.org/licenses/>.
//
// See LICENSE.TXT file for more information.
// -------------------------------------------------------------------
//
// Description : Example for tcpdf_barcodes_2d.php class
//
//============================================================+
/**
* @file
* Example for tcpdf_barcodes_2d.php class
* @package com.tecnick.tcpdf
* @author Nicola Asuni
* @version 1.0.009
* @group barcode
* @group qrcode
* @group png
*/
// include 2D barcode class (search for installation path)
require_once(dirname(__FILE__).'/tcpdf_barcodes_2d_include.php');
// set the barcode content and type
$barcodeobj = new TCPDF2DBarcode('http://www.tcpdf.org', 'QRCODE,H');
// output the barcode as PNG image
$barcodeobj->getBarcodePNG(6, 6, array(0,0,0));
//============================================================+
// END OF FILE
//============================================================+
@@ -0,0 +1,56 @@
<?php
//============================================================+
// File name : example_2d_svg.php
// Version : 1.0.000
// Begin : 2011-07-21
// Last Update : 2013-03-19
// Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - info@tecnick.com
// License : GNU-LGPL v3 (http://www.gnu.org/copyleft/lesser.html)
// -------------------------------------------------------------------
// Copyright (C) 2009-2013 Nicola Asuni - Tecnick.com LTD
//
// This file is part of TCPDF software library.
//
// TCPDF is free software: you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// TCPDF is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with TCPDF. If not, see <http://www.gnu.org/licenses/>.
//
// See LICENSE.TXT file for more information.
// -------------------------------------------------------------------
//
// Description : Example for tcpdf_barcodes_2d.php class
//
//============================================================+
/**
* @file
* Example for tcpdf_barcodes_2d.php class
* @package com.tecnick.tcpdf
* @author Nicola Asuni
* @version 1.0.009
* @group barcode
* @group qrcode
* @group svg
*/
// include 2D barcode class (search for installation path)
require_once(dirname(__FILE__).'/tcpdf_barcodes_2d_include.php');
// set the barcode content and type
$barcodeobj = new TCPDF2DBarcode('http://www.tcpdf.org', 'QRCODE,H');
// output the barcode as SVG image
$barcodeobj->getBarcodeSVG(6, 6, 'black');
//============================================================+
// END OF FILE
//============================================================+
@@ -0,0 +1,56 @@
<?php
//============================================================+
// File name : example_2d_svgi.php
// Version : 1.0.000
// Begin : 2011-07-21
// Last Update : 2013-03-19
// Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - info@tecnick.com
// License : GNU-LGPL v3 (http://www.gnu.org/copyleft/lesser.html)
// -------------------------------------------------------------------
// Copyright (C) 2009-2013 Nicola Asuni - Tecnick.com LTD
//
// This file is part of TCPDF software library.
//
// TCPDF is free software: you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// TCPDF is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with TCPDF. If not, see <http://www.gnu.org/licenses/>.
//
// See LICENSE.TXT file for more information.
// -------------------------------------------------------------------
//
// Description : Example for tcpdf_barcodes_2d.php class
//
//============================================================+
/**
* @file
* Example for tcpdf_barcodes_2d.php class
* @package com.tecnick.tcpdf
* @author Nicola Asuni
* @version 1.0.009
* @group barcode
* @group qrcode
* @group svg
*/
// include 2D barcode class (search for installation path)
require_once(dirname(__FILE__).'/tcpdf_barcodes_2d_include.php');
// set the barcode content and type
$barcodeobj = new TCPDF2DBarcode('http://www.tcpdf.org', 'QRCODE,H');
// output the barcode as SVG inline code
echo $barcodeobj->getBarcodeSVGcode(6, 6, 'black');
//============================================================+
// END OF FILE
//============================================================+
@@ -0,0 +1,46 @@
<?php
//============================================================+
// File name : tcpdf_barcodes_1d_include.php
// Begin : 2013-05-19
// Last Update : 2013-05-19
//
// Description : Search and include the TCPDF Barcode 1D class.
//
// Author: Nicola Asuni
//
// (c) Copyright:
// Nicola Asuni
// Tecnick.com LTD
// www.tecnick.com
// info@tecnick.com
//============================================================+
/**
* Search and include the TCPDF Barcode 1D class.
* @package com.tecnick.tcpdf
* @abstract TCPDF - Include the main class.
* @author Nicola Asuni
* @since 2013-05-19
*/
// Include the TCPDF 1D barcode class (search the class on the following directories).
$tcpdf_barcodes_1d_include_dirs = array(
realpath(dirname(__FILE__) . '/../../tcpdf_barcodes_1d.php'),// True source file
realpath('../../tcpdf_barcodes_1d.php'),// Relative from $PWD
'/usr/share/php/tcpdf/tcpdf_barcodes_1d.php',
'/usr/share/tcpdf/tcpdf_barcodes_1d.php',
'/usr/share/php-tcpdf/tcpdf_barcodes_1d.php',
'/var/www/tcpdf/tcpdf_barcodes_1d.php',
'/var/www/html/tcpdf/tcpdf_barcodes_1d.php',
'/usr/local/apache2/htdocs/tcpdf/tcpdf_barcodes_1d.php'
);
foreach ($tcpdf_barcodes_1d_include_dirs as $tcpdf_barcodes_1d_include_path) {
if (@file_exists($tcpdf_barcodes_1d_include_path)) {
require_once($tcpdf_barcodes_1d_include_path);
break;
}
}
//============================================================+
// END OF FILE
//============================================================+
@@ -0,0 +1,46 @@
<?php
//============================================================+
// File name : tcpdf_barcodes_2d_include.php
// Begin : 2013-05-19
// Last Update : 2013-05-19
//
// Description : Search and include the TCPDF Barcode 1D class.
//
// Author: Nicola Asuni
//
// (c) Copyright:
// Nicola Asuni
// Tecnick.com LTD
// www.tecnick.com
// info@tecnick.com
//============================================================+
/**
* Search and include the TCPDF Barcode 2D class.
* @package com.tecnick.tcpdf
* @abstract TCPDF - Include the main class.
* @author Nicola Asuni
* @since 2013-05-19
*/
// Include the TCPDF 2D barcode class (search the class on the following directories).
$tcpdf_barcodes_2d_include_dirs = array(
realpath(dirname(__FILE__) . '/../../tcpdf_barcodes_2d.php'),// True source file
realpath('../../tcpdf_barcodes_2d.php'),// Relative from $PWD
'/usr/share/php/tcpdf/tcpdf_barcodes_2d.php',
'/usr/share/tcpdf/tcpdf_barcodes_2d.php',
'/usr/share/php-tcpdf/tcpdf_barcodes_2d.php',
'/var/www/tcpdf/tcpdf_barcodes_2d.php',
'/var/www/html/tcpdf/tcpdf_barcodes_2d.php',
'/usr/local/apache2/htdocs/tcpdf/tcpdf_barcodes_2d.php'
);
foreach ($tcpdf_barcodes_2d_include_dirs as $tcpdf_barcodes_2d_include_path) {
if (@file_exists($tcpdf_barcodes_2d_include_path)) {
require_once($tcpdf_barcodes_2d_include_path);
break;
}
}
//============================================================+
// END OF FILE
//============================================================+
@@ -0,0 +1,230 @@
<?php
//============================================================+
// File name : tcpdf_config.php
// Begin : 2004-06-11
// Last Update : 2013-05-16
//
// Description : Example of alternative configuration file for TCPDF.
// Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - info@tecnick.com
// License : GNU-LGPL v3 (http://www.gnu.org/copyleft/lesser.html)
// -------------------------------------------------------------------
// Copyright (C) 2004-2013 Nicola Asuni - Tecnick.com LTD
//
// This file is part of TCPDF software library.
//
// TCPDF is free software: you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// TCPDF is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with TCPDF. If not, see <http://www.gnu.org/licenses/>.
//
// See LICENSE.TXT file for more information.
//============================================================+
/**
* Example of alternative configuration file for TCPDF.
* @author Nicola Asuni
* @package com.tecnick.tcpdf
* @version 4.9.005
* @since 2004-10-27
*/
/**
* Define the following constant to ignore the default configuration file.
*/
define ('K_TCPDF_EXTERNAL_CONFIG', true);
/**
* Installation path (/var/www/tcpdf/).
* By default it is automatically calculated but you can also set it as a fixed string to improve performances.
*/
//define ('K_PATH_MAIN', '');
/**
* URL path to tcpdf installation folder (http://localhost/tcpdf/).
* By default it is automatically set but you can also set it as a fixed string to improve performances.
*/
//define ('K_PATH_URL', '');
/**
* Path for PDF fonts.
* By default it is automatically set but you can also set it as a fixed string to improve performances.
*/
//define ('K_PATH_FONTS', K_PATH_MAIN.'fonts/');
/**
* Default images directory.
* By default it is automatically set but you can also set it as a fixed string to improve performances.
*/
define ('K_PATH_IMAGES', dirname(__FILE__).'/../images/');
/**
* Deafult image logo used be the default Header() method.
* Please set here your own logo or an empty string to disable it.
*/
define ('PDF_HEADER_LOGO', 'tcpdf_logo.jpg');
/**
* Header logo image width in user units.
*/
define ('PDF_HEADER_LOGO_WIDTH', 30);
/**
* Cache directory for temporary files (full path).
*/
define ('K_PATH_CACHE', sys_get_temp_dir().'/');
/**
* Generic name for a blank image.
*/
define ('K_BLANK_IMAGE', '_blank.png');
/**
* Page format.
*/
define ('PDF_PAGE_FORMAT', 'A4');
/**
* Page orientation (P=portrait, L=landscape).
*/
define ('PDF_PAGE_ORIENTATION', 'P');
/**
* Document creator.
*/
define ('PDF_CREATOR', 'TCPDF');
/**
* Document author.
*/
define ('PDF_AUTHOR', 'TCPDF');
/**
* Header title.
*/
define ('PDF_HEADER_TITLE', 'TCPDF Example');
/**
* Header description string.
*/
define ('PDF_HEADER_STRING', "by Nicola Asuni - Tecnick.com\nwww.tcpdf.org");
/**
* Document unit of measure [pt=point, mm=millimeter, cm=centimeter, in=inch].
*/
define ('PDF_UNIT', 'mm');
/**
* Header margin.
*/
define ('PDF_MARGIN_HEADER', 5);
/**
* Footer margin.
*/
define ('PDF_MARGIN_FOOTER', 10);
/**
* Top margin.
*/
define ('PDF_MARGIN_TOP', 27);
/**
* Bottom margin.
*/
define ('PDF_MARGIN_BOTTOM', 25);
/**
* Left margin.
*/
define ('PDF_MARGIN_LEFT', 15);
/**
* Right margin.
*/
define ('PDF_MARGIN_RIGHT', 15);
/**
* Default main font name.
*/
define ('PDF_FONT_NAME_MAIN', 'helvetica');
/**
* Default main font size.
*/
define ('PDF_FONT_SIZE_MAIN', 10);
/**
* Default data font name.
*/
define ('PDF_FONT_NAME_DATA', 'helvetica');
/**
* Default data font size.
*/
define ('PDF_FONT_SIZE_DATA', 8);
/**
* Default monospaced font name.
*/
define ('PDF_FONT_MONOSPACED', 'courier');
/**
* Ratio used to adjust the conversion of pixels to user units.
*/
define ('PDF_IMAGE_SCALE_RATIO', 1.25);
/**
* Magnification factor for titles.
*/
define('HEAD_MAGNIFICATION', 1.1);
/**
* Height of cell respect font height.
*/
define('K_CELL_HEIGHT_RATIO', 1.25);
/**
* Title magnification respect main font size.
*/
define('K_TITLE_MAGNIFICATION', 1.3);
/**
* Reduction factor for small font.
*/
define('K_SMALL_RATIO', 2/3);
/**
* Set to true to enable the special procedure used to avoid the overlappind of symbols on Thai language.
*/
define('K_THAI_TOPCHARS', true);
/**
* If true allows to call TCPDF methods using HTML syntax
* IMPORTANT: For security reason, disable this feature if you are printing user HTML content.
*/
define('K_TCPDF_CALLS_IN_HTML', true);
/**
* List of TCPDF methods that are allowed to be called using HTML syntax.
* Note: each method name must end with surrounded with | (pipe) character.
* The constant K_TCPDF_CALLS_IN_HTML must be set to true.
* IMPORTANT: For security reason, disable this feature if you are allowing user HTML content.
*/
define('K_ALLOWED_TCPDF_TAGS', '|AddPage|Rect|SetDrawColor|write1DBarcode|');
/**
* If true and PHP version is greater than 5, then the Error() method throw new exception instead of terminating the execution.
*/
define('K_TCPDF_THROW_EXCEPTION_ERROR', false);
//============================================================+
// END OF FILE
//============================================================+
+40
View File
@@ -0,0 +1,40 @@
Bag Attributes
localKeyID: 7B AB 1B 7A BE 4C 85 C0 1A A6 DC 59 3F 79 48 C3 93 38 68 9C
subject=/CN=TCPDF DEMO/O=TCPDF/OU=DEMO/emailAddress=you@example.com/C=IT
issuer=/CN=TCPDF DEMO/O=TCPDF/OU=DEMO/emailAddress=you@example.com/C=IT
-----BEGIN CERTIFICATE-----
MIIC1TCCAj6gAwIBAgIKkehOL/XGkB5cjjANBgkqhkiG9w0BAQUFADBhMRMwEQYD
VQQDEwpUQ1BERiBERU1PMQ4wDAYDVQQKEwVUQ1BERjENMAsGA1UECxMEREVNTzEe
MBwGCSqGSIb3DQEJARYPeW91QGV4YW1wbGUuY29tMQswCQYDVQQGEwJJVDAeFw0w
OTA4MjExMjU0NDhaFw0xNDA4MjExMjU0NDhaMGExEzARBgNVBAMTClRDUERGIERF
TU8xDjAMBgNVBAoTBVRDUERGMQ0wCwYDVQQLEwRERU1PMR4wHAYJKoZIhvcNAQkB
Fg95b3VAZXhhbXBsZS5jb20xCzAJBgNVBAYTAklUMIGfMA0GCSqGSIb3DQEBAQUA
A4GNADCBiQKBgQDAqIL0uGKmTR98Lxx2vEEE1OGKkMXFo0JViitALe7Onhxxqx0H
XMUDKF5mvEVu1rcvh7/oAnAfrCuEpL/up3u1mQCgBE7WXBnFFE/AE3jCksh9OkS0
Z0Xj9woN5bzxRDsGoPiOu/4xzk5qSEXt8jf2Ep90QuNkqLIRT4swAzpDbwIDAQAB
o4GTMIGQMDcGA1UdEgQwMC6gEQYDVQQDDApUQ1BERiBERU1PoAwGA1UECgwFVENQ
REagCwYDVQQLDARERU1PMDcGA1UdEQQwMC6gEQYDVQQDDApUQ1BERiBERU1PoAwG
A1UECgwFVENQREagCwYDVQQLDARERU1PMA8GCSqGSIb3LwEBCgQCBQAwCwYDVR0P
BAQDAgSQMA0GCSqGSIb3DQEBBQUAA4GBAEhTQfqX3ZNdHmpTLDbIj22RHXii2roE
OavCbu9WsHoWpva0qSd+yIoD594VHvYAd29sfzDfiN+7W0aiZfDhq5jpaSQMVlN8
RGYMupbHY/+a9Gz1wqxnR84mlTtIkZVRYAhsfPwy6M1BEjdMqfdh9h40JIdkdjtb
8faTCfXPePWQ
-----END CERTIFICATE-----
Bag Attributes
localKeyID: 7B AB 1B 7A BE 4C 85 C0 1A A6 DC 59 3F 79 48 C3 93 38 68 9C
Key Attributes: <No Attributes>
-----BEGIN RSA PRIVATE KEY-----
MIICXQIBAAKBgQDAqIL0uGKmTR98Lxx2vEEE1OGKkMXFo0JViitALe7Onhxxqx0H
XMUDKF5mvEVu1rcvh7/oAnAfrCuEpL/up3u1mQCgBE7WXBnFFE/AE3jCksh9OkS0
Z0Xj9woN5bzxRDsGoPiOu/4xzk5qSEXt8jf2Ep90QuNkqLIRT4swAzpDbwIDAQAB
AoGAXc+wNMmz/5Z+RlIKYia44klmqbplEx+0JULqXI4BQsrqvs67i+I4bJkznoL+
rEIRYSuQ3sCRKFsFtckjTGpxadnxkB+uwGKc6pZChv99BFX6HFR4hgBlT/BBRAQA
hMDlM2JIRr4S4SMVXR7MHwGMUf9mUeanGLR3ZWtU3aXJrIECQQD7OaYUVYNEEnM9
uXyjm22CuHyqyEf5gb13sK0uQty67547yJTMUQZd/sQc9KGwhzBbhrob2LO2jAhh
S+f+NSRnAkEAxFHm3fMI5RgXmswxlGm4QW07a/Ueo7ZJG6xjTkFXluJhd+XHswRD
dQIO3zG9nGjNUoeMrPhXhPvKqFc2F9RDuQJAQBEGin74N77gxqfr4ik79y8nE8J5
oGZ2s/RJZdfFRKLg3mwbjjNHhWb4Ck5UgZkoOt8TzRApXG8/n9hktE5HFwJBALur
M5AueO1Pl5kB489lNJ9OxUQRYUXMxpxuscuoCQwSwmv0O2+0/qtG2WKhUQnI4aYo
L+FV0YwtivBb1jj3T/kCQQDIWOxq8eRowdaMzvJpRUHFgMcf1AVZExKyrugwYOWd
KNsDxC4KaQOsPt8iT/Ulo4g/MJC0HolCOhWibKmR9Ayl
-----END RSA PRIVATE KEY-----
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,19 @@
Lorem ipsum dolor sit amet, consectetur adipiscing elit. In sed imperdiet lectus. Phasellus quis velit velit, non condimentum quam. Sed neque urna, ultrices ac volutpat vel, laoreet vitae augue. Sed vel velit erat. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Cras eget velit nulla, eu sagittis elit. Nunc ac arcu est, in lobortis tellus. Praesent condimentum rhoncus sodales. In hac habitasse platea dictumst. Proin porta eros pharetra enim tincidunt dignissim nec vel dolor. Cras sapien elit, ornare ac dignissim eu, ultricies ac eros. Maecenas augue magna, ultrices a congue in, mollis eu nulla. Nunc venenatis massa at est eleifend faucibus. Vivamus sed risus lectus, nec interdum nunc.
Fusce et felis vitae diam lobortis sollicitudin. Aenean tincidunt accumsan nisi, id vehicula quam laoreet elementum. Phasellus egestas interdum erat, et viverra ipsum ultricies ac. Praesent sagittis augue at augue volutpat eleifend. Cras nec orci neque. Mauris bibendum posuere blandit. Donec feugiat mollis dui sit amet pellentesque. Sed a enim justo. Donec tincidunt, nisl eget elementum aliquam, odio ipsum ultrices quam, eu porttitor ligula urna at lorem. Donec varius, eros et convallis laoreet, ligula tellus consequat felis, ut ornare metus tellus sodales velit. Duis sed diam ante. Ut rutrum malesuada massa, vitae consectetur ipsum rhoncus sed. Suspendisse potenti. Pellentesque a congue massa.
Integer non sem eget neque mattis accumsan. Maecenas eu nisl mauris, sit amet interdum ipsum. In pharetra erat vel lectus venenatis elementum. Nulla non elit ligula, sit amet mollis urna. Morbi ut gravida est. Mauris tincidunt sem et turpis molestie malesuada. Curabitur vel nulla risus, sed mollis erat. Suspendisse vehicula accumsan purus nec varius. Donec fermentum lorem id felis sodales dictum. Quisque et dolor ipsum. Nam luctus consectetur dui vitae fermentum. Curabitur sodales consequat augue, id ultricies augue tempor ac. Aliquam ac magna id ipsum vehicula bibendum. Sed elementum congue tristique. Phasellus vel lorem eu lectus porta sodales. Etiam neque tortor, sagittis id pharetra quis, laoreet vel arcu.
Cras quam mi, ornare laoreet laoreet vel, vehicula at lacus. Maecenas a lacus accumsan augue convallis sagittis sed quis odio. Morbi sit amet turpis diam, dictum convallis urna. Cras eget interdum augue. Cras eu nisi sit amet dolor faucibus porttitor. Suspendisse potenti. Nunc vitae dolor risus, at cursus libero. Suspendisse bibendum tellus non nibh hendrerit tristique. Mauris eget orci elit. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam porta libero non ante laoreet semper. Proin volutpat sodales mi, ac fermentum erat sagittis in. Vivamus at viverra felis. Ut pretium facilisis ante et pharetra.
Nulla facilisi. Cras varius quam eget libero aliquam vitae tincidunt leo rutrum. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Pellentesque a nisl massa, quis pretium urna. Proin vel porttitor tortor. Cras rhoncus congue velit in bibendum. Donec pharetra semper augue id lacinia. Quisque magna quam, hendrerit eu aliquam et, pellentesque ut tellus. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Maecenas nulla quam, rutrum eu feugiat at, elementum eu libero. Maecenas ullamcorper leo et turpis rutrum ac laoreet eros faucibus. Phasellus condimentum lorem quis neque imperdiet quis molestie enim iaculis. Phasellus risus est, vestibulum ut convallis ultrices, dignissim nec erat. Etiam congue lobortis laoreet. Nulla ut neque sed velit dapibus semper. Quisque nec dolor id nibh eleifend iaculis. Vivamus vitae fermentum odio. Etiam malesuada quam in nulla aliquam sed convallis dui feugiat.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. In sed imperdiet lectus. Phasellus quis velit velit, non condimentum quam. Sed neque urna, ultrices ac volutpat vel, laoreet vitae augue. Sed vel velit erat. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Cras eget velit nulla, eu sagittis elit. Nunc ac arcu est, in lobortis tellus. Praesent condimentum rhoncus sodales. In hac habitasse platea dictumst. Proin porta eros pharetra enim tincidunt dignissim nec vel dolor. Cras sapien elit, ornare ac dignissim eu, ultricies ac eros. Maecenas augue magna, ultrices a congue in, mollis eu nulla. Nunc venenatis massa at est eleifend faucibus. Vivamus sed risus lectus, nec interdum nunc.
Fusce et felis vitae diam lobortis sollicitudin. Aenean tincidunt accumsan nisi, id vehicula quam laoreet elementum. Phasellus egestas interdum erat, et viverra ipsum ultricies ac. Praesent sagittis augue at augue volutpat eleifend. Cras nec orci neque. Mauris bibendum posuere blandit. Donec feugiat mollis dui sit amet pellentesque. Sed a enim justo. Donec tincidunt, nisl eget elementum aliquam, odio ipsum ultrices quam, eu porttitor ligula urna at lorem. Donec varius, eros et convallis laoreet, ligula tellus consequat felis, ut ornare metus tellus sodales velit. Duis sed diam ante. Ut rutrum malesuada massa, vitae consectetur ipsum rhoncus sed. Suspendisse potenti. Pellentesque a congue massa.
Integer non sem eget neque mattis accumsan. Maecenas eu nisl mauris, sit amet interdum ipsum. In pharetra erat vel lectus venenatis elementum. Nulla non elit ligula, sit amet mollis urna. Morbi ut gravida est. Mauris tincidunt sem et turpis molestie malesuada. Curabitur vel nulla risus, sed mollis erat. Suspendisse vehicula accumsan purus nec varius. Donec fermentum lorem id felis sodales dictum. Quisque et dolor ipsum. Nam luctus consectetur dui vitae fermentum. Curabitur sodales consequat augue, id ultricies augue tempor ac. Aliquam ac magna id ipsum vehicula bibendum. Sed elementum congue tristique. Phasellus vel lorem eu lectus porta sodales. Etiam neque tortor, sagittis id pharetra quis, laoreet vel arcu.
Cras quam mi, ornare laoreet laoreet vel, vehicula at lacus. Maecenas a lacus accumsan augue convallis sagittis sed quis odio. Morbi sit amet turpis diam, dictum convallis urna. Cras eget interdum augue. Cras eu nisi sit amet dolor faucibus porttitor. Suspendisse potenti. Nunc vitae dolor risus, at cursus libero. Suspendisse bibendum tellus non nibh hendrerit tristique. Mauris eget orci elit. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam porta libero non ante laoreet semper. Proin volutpat sodales mi, ac fermentum erat sagittis in. Vivamus at viverra felis. Ut pretium facilisis ante et pharetra.
Nulla facilisi. Cras varius quam eget libero aliquam vitae tincidunt leo rutrum. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Pellentesque a nisl massa, quis pretium urna. Proin vel porttitor tortor. Cras rhoncus congue velit in bibendum. Donec pharetra semper augue id lacinia. Quisque magna quam, hendrerit eu aliquam et, pellentesque ut tellus. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Maecenas nulla quam, rutrum eu feugiat at, elementum eu libero. Maecenas ullamcorper leo et turpis rutrum ac laoreet eros faucibus. Phasellus condimentum lorem quis neque imperdiet quis molestie enim iaculis. Phasellus risus est, vestibulum ut convallis ultrices, dignissim nec erat. Etiam congue lobortis laoreet. Nulla ut neque sed velit dapibus semper. Quisque nec dolor id nibh eleifend iaculis. Vivamus vitae fermentum odio. Etiam malesuada quam in nulla aliquam sed convallis dui feugiat.
@@ -0,0 +1,23 @@
<p><strong>Lorem ipsum</strong> dolor sit amet, consectetur adipiscing elit. In sed imperdiet lectus. Phasellus quis velit velit, non condimentum quam. Sed neque urna, ultrices ac volutpat vel, laoreet vitae augue. Sed vel velit erat. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Cras eget velit nulla, eu sagittis elit. Nunc ac arcu est, in lobortis tellus. Praesent condimentum rhoncus sodales. In hac habitasse platea dictumst. Proin porta eros pharetra enim tincidunt dignissim nec vel dolor. Cras sapien elit, ornare ac dignissim eu, ultricies ac eros. Maecenas augue magna, ultrices a congue in, mollis eu nulla. Nunc venenatis massa at est eleifend faucibus. Vivamus sed risus lectus, nec interdum nunc.</p>
<img src="images/image_demo.jpg" width="54mm" height="80mm" />
<p style="background-color:yellow;"><i>Fusce et felis vitae diam lobortis sollicitudin. Aenean tincidunt accumsan nisi, id vehicula quam laoreet elementum. Phasellus egestas interdum erat, et viverra ipsum ultricies ac. Praesent sagittis augue at augue volutpat eleifend. Cras nec orci neque. Mauris bibendum posuere blandit. Donec feugiat mollis dui sit amet pellentesque. Sed a enim justo. Donec tincidunt, nisl eget elementum aliquam, odio ipsum ultrices quam, eu porttitor ligula urna at lorem. Donec varius, eros et convallis laoreet, ligula tellus consequat felis, ut ornare metus tellus sodales velit. Duis sed diam ante. Ut rutrum malesuada massa, vitae consectetur ipsum rhoncus sed. Suspendisse potenti. Pellentesque a congue massa.</i></p>
<p>Integer non sem eget neque mattis accumsan. Maecenas eu nisl mauris, sit amet interdum ipsum. In pharetra erat vel lectus venenatis elementum. Nulla non elit ligula, sit amet mollis urna. Morbi ut gravida est. Mauris tincidunt sem et turpis molestie malesuada. Curabitur vel nulla risus, sed mollis erat. Suspendisse vehicula accumsan purus nec varius. Donec fermentum lorem id felis sodales dictum. Quisque et dolor ipsum. Nam luctus consectetur dui vitae fermentum. Curabitur sodales consequat augue, id ultricies augue tempor ac. Aliquam ac magna id ipsum vehicula bibendum. Sed elementum congue tristique. Phasellus vel lorem eu lectus porta sodales. Etiam neque tortor, sagittis id pharetra quis, laoreet vel arcu.</p>
<p style="color:navy;">Cras quam mi, ornare laoreet laoreet vel, vehicula at lacus. Maecenas a lacus accumsan augue convallis sagittis sed quis odio. Morbi sit amet turpis diam, dictum convallis urna. Cras eget interdum augue. Cras eu nisi sit amet dolor faucibus porttitor. Suspendisse potenti. Nunc vitae dolor risus, at cursus libero. Suspendisse bibendum tellus non nibh hendrerit tristique. Mauris eget orci elit. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam porta libero non ante laoreet semper. Proin volutpat sodales mi, ac fermentum erat sagittis in. Vivamus at viverra felis. Ut pretium facilisis ante et pharetra.</p>
<p>Nulla facilisi. Cras varius quam eget libero aliquam vitae tincidunt leo rutrum. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Pellentesque a nisl massa, quis pretium urna. Proin vel porttitor tortor. Cras rhoncus congue velit in bibendum. Donec pharetra semper augue id lacinia. Quisque magna quam, hendrerit eu aliquam et, pellentesque ut tellus. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Maecenas nulla quam, rutrum eu feugiat at, elementum eu libero. Maecenas ullamcorper leo et turpis rutrum ac laoreet eros faucibus. Phasellus condimentum lorem quis neque imperdiet quis molestie enim iaculis. Phasellus risus est, vestibulum ut convallis ultrices, dignissim nec erat. Etiam congue lobortis laoreet. Nulla ut neque sed velit dapibus semper. Quisque nec dolor id nibh eleifend iaculis. Vivamus vitae fermentum odio. Etiam malesuada quam in nulla aliquam sed convallis dui feugiat.</p>
<p><strong>Lorem ipsum</strong> dolor sit amet, consectetur adipiscing elit. In sed imperdiet lectus. Phasellus quis velit velit, non condimentum quam. Sed neque urna, ultrices ac volutpat vel, laoreet vitae augue. Sed vel velit erat. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Cras eget velit nulla, eu sagittis elit. Nunc ac arcu est, in lobortis tellus. Praesent condimentum rhoncus sodales. In hac habitasse platea dictumst. Proin porta eros pharetra enim tincidunt dignissim nec vel dolor. Cras sapien elit, ornare ac dignissim eu, ultricies ac eros. Maecenas augue magna, ultrices a congue in, mollis eu nulla. Nunc venenatis massa at est eleifend faucibus. Vivamus sed risus lectus, nec interdum nunc.</p>
<img src="images/image_demo.jpg" width="54mm" height="80mm" />
<p style="background-color:yellow;"><i>Fusce et felis vitae diam lobortis sollicitudin. Aenean tincidunt accumsan nisi, id vehicula quam laoreet elementum. Phasellus egestas interdum erat, et viverra ipsum ultricies ac. Praesent sagittis augue at augue volutpat eleifend. Cras nec orci neque. Mauris bibendum posuere blandit. Donec feugiat mollis dui sit amet pellentesque. Sed a enim justo. Donec tincidunt, nisl eget elementum aliquam, odio ipsum ultrices quam, eu porttitor ligula urna at lorem. Donec varius, eros et convallis laoreet, ligula tellus consequat felis, ut ornare metus tellus sodales velit. Duis sed diam ante. Ut rutrum malesuada massa, vitae consectetur ipsum rhoncus sed. Suspendisse potenti. Pellentesque a congue massa.</i></p>
<p>Integer non sem eget neque mattis accumsan. Maecenas eu nisl mauris, sit amet interdum ipsum. In pharetra erat vel lectus venenatis elementum. Nulla non elit ligula, sit amet mollis urna. Morbi ut gravida est. Mauris tincidunt sem et turpis molestie malesuada. Curabitur vel nulla risus, sed mollis erat. Suspendisse vehicula accumsan purus nec varius. Donec fermentum lorem id felis sodales dictum. Quisque et dolor ipsum. Nam luctus consectetur dui vitae fermentum. Curabitur sodales consequat augue, id ultricies augue tempor ac. Aliquam ac magna id ipsum vehicula bibendum. Sed elementum congue tristique. Phasellus vel lorem eu lectus porta sodales. Etiam neque tortor, sagittis id pharetra quis, laoreet vel arcu.</p>
<p style="color:navy;">Cras quam mi, ornare laoreet laoreet vel, vehicula at lacus. Maecenas a lacus accumsan augue convallis sagittis sed quis odio. Morbi sit amet turpis diam, dictum convallis urna. Cras eget interdum augue. Cras eu nisi sit amet dolor faucibus porttitor. Suspendisse potenti. Nunc vitae dolor risus, at cursus libero. Suspendisse bibendum tellus non nibh hendrerit tristique. Mauris eget orci elit. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam porta libero non ante laoreet semper. Proin volutpat sodales mi, ac fermentum erat sagittis in. Vivamus at viverra felis. Ut pretium facilisis ante et pharetra.</p>
<p>Nulla facilisi. Cras varius quam eget libero aliquam vitae tincidunt leo rutrum. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Pellentesque a nisl massa, quis pretium urna. Proin vel porttitor tortor. Cras rhoncus congue velit in bibendum. Donec pharetra semper augue id lacinia. Quisque magna quam, hendrerit eu aliquam et, pellentesque ut tellus. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Maecenas nulla quam, rutrum eu feugiat at, elementum eu libero. Maecenas ullamcorper leo et turpis rutrum ac laoreet eros faucibus. Phasellus condimentum lorem quis neque imperdiet quis molestie enim iaculis. Phasellus risus est, vestibulum ut convallis ultrices, dignissim nec erat. Etiam congue lobortis laoreet. Nulla ut neque sed velit dapibus semper. Quisque nec dolor id nibh eleifend iaculis. Vivamus vitae fermentum odio. Etiam malesuada quam in nulla aliquam sed convallis dui feugiat.</p>
@@ -0,0 +1,15 @@
Austria;Vienna;83859;8075
Belgium;Brussels;30518;10192
Denmark;Copenhagen;43094;5295
Finland;Helsinki;304529;5147
France;Paris;543965;58728
Germany;Berlin;357022;82057
Greece;Athens;131625;10511
Ireland;Dublin;70723;3694
Italy;Roma;301316;57563
Luxembourg;Luxembourg;2586;424
Netherlands;Amsterdam;41526;15654
Portugal;Lisbon;91906;9957
Spain;Madrid;504790;39348
Sweden;Stockholm;410934;8839
United Kingdom;London;243820;58862
+128
View File
@@ -0,0 +1,128 @@
Sentences that contain all letters commonly used in a language
--------------------------------------------------------------
This file is UTF-8 encoded.
Czech (cz)
---------
Příšerně žluťoučký kůň úpěl ďábelské ódy.
Hleď, toť přízračný kůň v mátožné póze šíleně úpí.
Zvlášť zákeřný učeň s ďolíčky běží podél zóny úlů.
Loď čeří kýlem tůň obzvlášť v Grónské úžině.
Ó, náhlý déšť již zvířil prach a čilá laň teď běží s houfcem gazel k úkrytům.
Danish (da)
---------
Quizdeltagerne spiste jordbær med fløde, mens cirkusklovnen
Wolther spillede på xylofon.
(= Quiz contestants were eating strawbery with cream while Wolther
the circus clown played on xylophone.)
German (de)
-----------
Falsches Üben von Xylophonmusik quält jeden größeren Zwerg
(= Wrongful practicing of xylophone music tortures every larger dwarf)
Zwölf Boxkämpfer jagten Eva quer über den Sylter Deich
(= Twelve boxing fighters hunted Eva across the dike of Sylt)
Heizölrückstoßabdämpfung
(= fuel oil recoil absorber)
(jqvwxy missing, but all non-ASCII letters in one word)
English (en)
------------
The quick brown fox jumps over the lazy dog
Spanish (es)
------------
El pingüino Wenceslao hizo kilómetros bajo exhaustiva lluvia y
frío, añoraba a su querido cachorro.
(Contains every letter and every accent, but not every combination
of vowel + acute.)
French (fr)
-----------
Portez ce vieux whisky au juge blond qui fume sur son île intérieure, à
côté de l'alcôve ovoïde, où les bûches se consument dans l'âtre, ce
qui lui permet de penser à la cænogenèse de l'être dont il est question
dans la cause ambiguë entendue à Moÿ, dans un capharnaüm qui,
pense-t-il, diminue çà et là la qualité de son œuvre.
l'île exiguë
Où l'obèse jury mûr
Fête l'haï volapük,
Âne ex aéquo au whist,
Ôtez ce vœu déçu.
Le cœur déçu mais l'âme plutôt naïve, Louÿs rêva de crapaüter en
canoë au delà des îles, près du mälström où brûlent les novæ.
Irish Gaelic (ga)
-----------------
D'fhuascail Íosa, Úrmhac na hÓighe Beannaithe, pór Éava agus Ádhaimh
Hungarian (hu)
--------------
Árvíztűrő tükörfúrógép
(= flood-proof mirror-drilling machine, only all non-ASCII letters)
Icelandic (is)
--------------
Kæmi ný öxi hér ykist þjófum nú bæði víl og ádrepa
Sævör grét áðan því úlpan var ónýt
(some ASCII letters missing)
Greek (el)
-------------
Γαζέες καὶ μυρτιὲς δὲν θὰ βρῶ πιὰ στὸ χρυσαφὶ ξέφωτο
(= No more shall I see acacias or myrtles in the golden clearing)
Ξεσκεπάζω τὴν ψυχοφθόρα βδελυγμία
(= I uncover the soul-destroying abhorrence)
Hebrew (iw)
-----------
? דג סקרן שט בים מאוכזב ולפתע מצא לו חברה איך הקליטה
Polish (pl)
-----------
Pchnąć w tę łódź jeża lub osiem skrzyń fig
(= To push a hedgehog or eight bins of figs in this boat)
Zażółć gęślą jaźń
Russian (ru)
------------
В чащах юга жил бы цитрус? Да, но фальшивый экземпляр!
(= Would a citrus live in the bushes of south? Yes, but only a fake one!)
Thai (th)
---------
[--------------------------|------------------------]
๏ เป็นมนุษย์สุดประเสริฐเลิศคุณค่า กว่าบรรดาฝูงสัตว์เดรัจฉาน
จงฝ่าฟันพัฒนาวิชาการ อย่าล้างผลาญฤๅเข่นฆ่าบีฑาใคร
ไม่ถือโทษโกรธแช่งซัดฮึดฮัดด่า หัดอภัยเหมือนกีฬาอัชฌาสัย
ปฏิบัติประพฤติกฎกำหนดใจ พูดจาให้จ๊ะๆ จ๋าๆ น่าฟังเอย ฯ
[The copyright for the Thai example is owned by The Computer
Association of Thailand under the Royal Patronage of His Majesty the
King.]
Please let me know if you find others! Special thanks to the people
from all over the world who contributed these sentences.
+110
View File
@@ -0,0 +1,110 @@
<?php
//============================================================+
// File name : example_001.php
// Begin : 2008-03-04
// Last Update : 2013-05-14
//
// Description : Example 001 for TCPDF class
// Default Header and Footer
//
// Author: Nicola Asuni
//
// (c) Copyright:
// Nicola Asuni
// Tecnick.com LTD
// www.tecnick.com
// info@tecnick.com
//============================================================+
/**
* Creates an example PDF TEST document using TCPDF
* @package com.tecnick.tcpdf
* @abstract TCPDF - Example: Default Header and Footer
* @author Nicola Asuni
* @since 2008-03-04
* @group header
* @group footer
* @group page
* @group pdf
*/
// Include the main TCPDF library (search for installation path).
require_once('tcpdf_include.php');
// create new PDF document
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// set document information
$pdf->setCreator(PDF_CREATOR);
$pdf->setAuthor('Nicola Asuni');
$pdf->setTitle('TCPDF Example 001');
$pdf->setSubject('TCPDF Tutorial');
$pdf->setKeywords('TCPDF, PDF, example, test, guide');
// set default header data
$pdf->setHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 001', PDF_HEADER_STRING, array(0,64,255), array(0,64,128));
$pdf->setFooterData(array(0,64,0), array(0,64,128));
// set header and footer fonts
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
// set default monospaced font
$pdf->setDefaultMonospacedFont(PDF_FONT_MONOSPACED);
// set margins
$pdf->setMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$pdf->setHeaderMargin(PDF_MARGIN_HEADER);
$pdf->setFooterMargin(PDF_MARGIN_FOOTER);
// set auto page breaks
$pdf->setAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
// set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
// set some language-dependent strings (optional)
if (@file_exists(dirname(__FILE__).'/lang/eng.php')) {
require_once(dirname(__FILE__).'/lang/eng.php');
$pdf->setLanguageArray($l);
}
// ---------------------------------------------------------
// set default font subsetting mode
$pdf->setFontSubsetting(true);
// Set font
// dejavusans is a UTF-8 Unicode font, if you only need to
// print standard ASCII chars, you can use core fonts like
// helvetica or times to reduce file size.
$pdf->setFont('dejavusans', '', 14, '', true);
// Add a page
// This method has several options, check the source code documentation for more information.
$pdf->AddPage();
// set text shadow effect
$pdf->setTextShadow(array('enabled'=>true, 'depth_w'=>0.2, 'depth_h'=>0.2, 'color'=>array(196,196,196), 'opacity'=>1, 'blend_mode'=>'Normal'));
// Set some content to print
$html = <<<EOD
<h1>Welcome to <a href="http://www.tcpdf.org" style="text-decoration:none;background-color:#CC0000;color:black;">&nbsp;<span style="color:black;">TC</span><span style="color:white;">PDF</span>&nbsp;</a>!</h1>
<i>This is the first example of TCPDF library.</i>
<p>This text is printed using the <i>writeHTMLCell()</i> method but you can also use: <i>Multicell(), writeHTML(), Write(), Cell() and Text()</i>.</p>
<p>Please check the source code documentation and other examples for further information.</p>
<p style="color:#CC0000;">TO IMPROVE AND EXPAND TCPDF I NEED YOUR SUPPORT, PLEASE <a href="http://sourceforge.net/donate/index.php?group_id=128076">MAKE A DONATION!</a></p>
EOD;
// Print text using writeHTMLCell()
$pdf->writeHTMLCell(0, 0, '', '', $html, 0, 1, 0, true, '', true);
// ---------------------------------------------------------
// Close and output PDF document
// This method has several options, check the source code documentation for more information.
$pdf->Output('example_001.pdf', 'I');
//============================================================+
// END OF FILE
//============================================================+
+91
View File
@@ -0,0 +1,91 @@
<?php
//============================================================+
// File name : example_002.php
// Begin : 2008-03-04
// Last Update : 2013-05-14
//
// Description : Example 002 for TCPDF class
// Removing Header and Footer
//
// Author: Nicola Asuni
//
// (c) Copyright:
// Nicola Asuni
// Tecnick.com LTD
// www.tecnick.com
// info@tecnick.com
//============================================================+
/**
* Creates an example PDF TEST document using TCPDF
* @package com.tecnick.tcpdf
* @abstract TCPDF - Example: Removing Header and Footer
* @author Nicola Asuni
* @since 2008-03-04
* @group header
* @group footer
* @group page
* @group pdf
*/
// Include the main TCPDF library (search for installation path).
require_once('tcpdf_include.php');
// create new PDF document
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// set document information
$pdf->setCreator(PDF_CREATOR);
$pdf->setAuthor('Nicola Asuni');
$pdf->setTitle('TCPDF Example 002');
$pdf->setSubject('TCPDF Tutorial');
$pdf->setKeywords('TCPDF, PDF, example, test, guide');
// remove default header/footer
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);
// set default monospaced font
$pdf->setDefaultMonospacedFont(PDF_FONT_MONOSPACED);
// set margins
$pdf->setMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
// set auto page breaks
$pdf->setAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
// set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
// set some language-dependent strings (optional)
if (@file_exists(dirname(__FILE__).'/lang/eng.php')) {
require_once(dirname(__FILE__).'/lang/eng.php');
$pdf->setLanguageArray($l);
}
// ---------------------------------------------------------
// set font
$pdf->setFont('times', 'BI', 20);
// add a page
$pdf->AddPage();
// set some text to print
$txt = <<<EOD
TCPDF Example 002
Default page header and footer are disabled using setPrintHeader() and setPrintFooter() methods.
EOD;
// print a block of text using Write()
$pdf->Write(0, $txt, '', 0, 'C', true, 0, false, false, 0);
// ---------------------------------------------------------
//Close and output PDF document
$pdf->Output('example_002.pdf', 'I');
//============================================================+
// END OF FILE
//============================================================+
+122
View File
@@ -0,0 +1,122 @@
<?php
//============================================================+
// File name : example_003.php
// Begin : 2008-03-04
// Last Update : 2013-05-14
//
// Description : Example 003 for TCPDF class
// Custom Header and Footer
//
// Author: Nicola Asuni
//
// (c) Copyright:
// Nicola Asuni
// Tecnick.com LTD
// www.tecnick.com
// info@tecnick.com
//============================================================+
/**
* Creates an example PDF TEST document using TCPDF
* @package com.tecnick.tcpdf
* @abstract TCPDF - Example: Custom Header and Footer
* @author Nicola Asuni
* @since 2008-03-04
* @group header
* @group footer
* @group page
* @group pdf
*/
// Include the main TCPDF library (search for installation path).
require_once('tcpdf_include.php');
// Extend the TCPDF class to create custom Header and Footer
class MYPDF extends TCPDF {
//Page header
public function Header() {
// Logo
$image_file = K_PATH_IMAGES.'logo_example.jpg';
$this->Image($image_file, 10, 10, 15, '', 'JPG', '', 'T', false, 300, '', false, false, 0, false, false, false);
// Set font
$this->setFont('helvetica', 'B', 20);
// Title
$this->Cell(0, 15, '<< TCPDF Example 003 >>', 0, false, 'C', 0, '', 0, false, 'M', 'M');
}
// Page footer
public function Footer() {
// Position at 15 mm from bottom
$this->setY(-15);
// Set font
$this->setFont('helvetica', 'I', 8);
// Page number
$this->Cell(0, 10, 'Page '.$this->getAliasNumPage().'/'.$this->getAliasNbPages(), 0, false, 'C', 0, '', 0, false, 'T', 'M');
}
}
// create new PDF document
$pdf = new MYPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// set document information
$pdf->setCreator(PDF_CREATOR);
$pdf->setAuthor('Nicola Asuni');
$pdf->setTitle('TCPDF Example 003');
$pdf->setSubject('TCPDF Tutorial');
$pdf->setKeywords('TCPDF, PDF, example, test, guide');
// set default header data
$pdf->setHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING);
// set header and footer fonts
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
// set default monospaced font
$pdf->setDefaultMonospacedFont(PDF_FONT_MONOSPACED);
// set margins
$pdf->setMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$pdf->setHeaderMargin(PDF_MARGIN_HEADER);
$pdf->setFooterMargin(PDF_MARGIN_FOOTER);
// set auto page breaks
$pdf->setAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
// set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
// set some language-dependent strings (optional)
if (@file_exists(dirname(__FILE__).'/lang/eng.php')) {
require_once(dirname(__FILE__).'/lang/eng.php');
$pdf->setLanguageArray($l);
}
// ---------------------------------------------------------
// set font
$pdf->setFont('times', 'BI', 12);
// add a page
$pdf->AddPage();
// set some text to print
$txt = <<<EOD
TCPDF Example 003
Custom page header and footer are defined by extending the TCPDF class and overriding the Header() and Footer() methods.
EOD;
// print a block of text using Write()
$pdf->Write(0, $txt, '', 0, 'C', true, 0, false, false, 0);
// ---------------------------------------------------------
//Close and output PDF document
$pdf->Output('example_003.pdf', 'I');
//============================================================+
// END OF FILE
//============================================================+
+123
View File
@@ -0,0 +1,123 @@
<?php
//============================================================+
// File name : example_004.php
// Begin : 2008-03-04
// Last Update : 2013-05-14
//
// Description : Example 004 for TCPDF class
// Cell stretching
//
// Author: Nicola Asuni
//
// (c) Copyright:
// Nicola Asuni
// Tecnick.com LTD
// www.tecnick.com
// info@tecnick.com
//============================================================+
/**
* Creates an example PDF TEST document using TCPDF
* @package com.tecnick.tcpdf
* @abstract TCPDF - Example: Cell stretching
* @author Nicola Asuni
* @since 2008-03-04
* @group cell
* @group pdf
*/
// Include the main TCPDF library (search for installation path).
require_once('tcpdf_include.php');
// create new PDF document
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// set document information
$pdf->setCreator(PDF_CREATOR);
$pdf->setAuthor('Nicola Asuni');
$pdf->setTitle('TCPDF Example 004');
$pdf->setSubject('TCPDF Tutorial');
$pdf->setKeywords('TCPDF, PDF, example, test, guide');
// set default header data
$pdf->setHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 004', PDF_HEADER_STRING);
// set header and footer fonts
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
// set default monospaced font
$pdf->setDefaultMonospacedFont(PDF_FONT_MONOSPACED);
// set margins
$pdf->setMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$pdf->setHeaderMargin(PDF_MARGIN_HEADER);
$pdf->setFooterMargin(PDF_MARGIN_FOOTER);
// set auto page breaks
$pdf->setAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
// set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
// set some language-dependent strings (optional)
if (@file_exists(dirname(__FILE__).'/lang/eng.php')) {
require_once(dirname(__FILE__).'/lang/eng.php');
$pdf->setLanguageArray($l);
}
// ---------------------------------------------------------
// set font
$pdf->setFont('times', '', 11);
// add a page
$pdf->AddPage();
//Cell($w, $h=0, $txt='', $border=0, $ln=0, $align='', $fill=0, $link='', $stretch=0, $ignore_min_height=false, $calign='T', $valign='M')
// test Cell stretching
$pdf->Cell(0, 0, 'TEST CELL STRETCH: no stretch', 1, 1, 'C', 0, '', 0);
$pdf->Cell(0, 0, 'TEST CELL STRETCH: scaling', 1, 1, 'C', 0, '', 1);
$pdf->Cell(0, 0, 'TEST CELL STRETCH: force scaling', 1, 1, 'C', 0, '', 2);
$pdf->Cell(0, 0, 'TEST CELL STRETCH: spacing', 1, 1, 'C', 0, '', 3);
$pdf->Cell(0, 0, 'TEST CELL STRETCH: force spacing', 1, 1, 'C', 0, '', 4);
$pdf->Ln(5);
$pdf->Cell(45, 0, 'TEST CELL STRETCH: scaling', 1, 1, 'C', 0, '', 1);
$pdf->Cell(45, 0, 'TEST CELL STRETCH: force scaling', 1, 1, 'C', 0, '', 2);
$pdf->Cell(45, 0, 'TEST CELL STRETCH: spacing', 1, 1, 'C', 0, '', 3);
$pdf->Cell(45, 0, 'TEST CELL STRETCH: force spacing', 1, 1, 'C', 0, '', 4);
$pdf->AddPage();
// example using general stretching and spacing
for ($stretching = 90; $stretching <= 110; $stretching += 10) {
for ($spacing = -0.254; $spacing <= 0.254; $spacing += 0.254) {
// set general stretching (scaling) value
$pdf->setFontStretching($stretching);
// set general spacing value
$pdf->setFontSpacing($spacing);
$pdf->Cell(0, 0, 'Stretching '.$stretching.'%, Spacing '.sprintf('%+.3F', $spacing).'mm, no stretch', 1, 1, 'C', 0, '', 0);
$pdf->Cell(0, 0, 'Stretching '.$stretching.'%, Spacing '.sprintf('%+.3F', $spacing).'mm, scaling', 1, 1, 'C', 0, '', 1);
$pdf->Cell(0, 0, 'Stretching '.$stretching.'%, Spacing '.sprintf('%+.3F', $spacing).'mm, force scaling', 1, 1, 'C', 0, '', 2);
$pdf->Cell(0, 0, 'Stretching '.$stretching.'%, Spacing '.sprintf('%+.3F', $spacing).'mm, spacing', 1, 1, 'C', 0, '', 3);
$pdf->Cell(0, 0, 'Stretching '.$stretching.'%, Spacing '.sprintf('%+.3F', $spacing).'mm, force spacing', 1, 1, 'C', 0, '', 4);
$pdf->Ln(2);
}
}
// ---------------------------------------------------------
//Close and output PDF document
$pdf->Output('example_004.pdf', 'I');
//============================================================+
// END OF FILE
//============================================================+
+160
View File
@@ -0,0 +1,160 @@
<?php
//============================================================+
// File name : example_005.php
// Begin : 2008-03-04
// Last Update : 2013-05-14
//
// Description : Example 005 for TCPDF class
// Multicell
//
// Author: Nicola Asuni
//
// (c) Copyright:
// Nicola Asuni
// Tecnick.com LTD
// www.tecnick.com
// info@tecnick.com
//============================================================+
/**
* Creates an example PDF TEST document using TCPDF
* @package com.tecnick.tcpdf
* @abstract TCPDF - Example: Multicell
* @author Nicola Asuni
* @since 2008-03-04
* @group cell
* @group pdf
*/
// Include the main TCPDF library (search for installation path).
require_once('tcpdf_include.php');
// create new PDF document
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// set document information
$pdf->setCreator(PDF_CREATOR);
$pdf->setAuthor('Nicola Asuni');
$pdf->setTitle('TCPDF Example 005');
$pdf->setSubject('TCPDF Tutorial');
$pdf->setKeywords('TCPDF, PDF, example, test, guide');
// set default header data
$pdf->setHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 005', PDF_HEADER_STRING);
// set header and footer fonts
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
// set default monospaced font
$pdf->setDefaultMonospacedFont(PDF_FONT_MONOSPACED);
// set margins
$pdf->setMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$pdf->setHeaderMargin(PDF_MARGIN_HEADER);
$pdf->setFooterMargin(PDF_MARGIN_FOOTER);
// set auto page breaks
$pdf->setAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
// set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
// set some language-dependent strings (optional)
if (@file_exists(dirname(__FILE__).'/lang/eng.php')) {
require_once(dirname(__FILE__).'/lang/eng.php');
$pdf->setLanguageArray($l);
}
// ---------------------------------------------------------
// set font
$pdf->setFont('times', '', 10);
// add a page
$pdf->AddPage();
// set cell padding
$pdf->setCellPaddings(1, 1, 1, 1);
// set cell margins
$pdf->setCellMargins(1, 1, 1, 1);
// set color for background
$pdf->setFillColor(255, 255, 127);
// MultiCell($w, $h, $txt, $border=0, $align='J', $fill=0, $ln=1, $x='', $y='', $reseth=true, $stretch=0, $ishtml=false, $autopadding=true, $maxh=0)
// set some text for example
$txt = 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.';
// Multicell test
$pdf->MultiCell(55, 5, '[LEFT] '.$txt, 1, 'L', 1, 0, '', '', true);
$pdf->MultiCell(55, 5, '[RIGHT] '.$txt, 1, 'R', 0, 1, '', '', true);
$pdf->MultiCell(55, 5, '[CENTER] '.$txt, 1, 'C', 0, 0, '', '', true);
$pdf->MultiCell(55, 5, '[JUSTIFY] '.$txt."\n", 1, 'J', 1, 2, '' ,'', true);
$pdf->MultiCell(55, 5, '[DEFAULT] '.$txt, 1, '', 0, 1, '', '', true);
$pdf->Ln(4);
// set color for background
$pdf->setFillColor(220, 255, 220);
// Vertical alignment
$pdf->MultiCell(55, 40, '[VERTICAL ALIGNMENT - TOP] '.$txt, 1, 'J', 1, 0, '', '', true, 0, false, true, 40, 'T');
$pdf->MultiCell(55, 40, '[VERTICAL ALIGNMENT - MIDDLE] '.$txt, 1, 'J', 1, 0, '', '', true, 0, false, true, 40, 'M');
$pdf->MultiCell(55, 40, '[VERTICAL ALIGNMENT - BOTTOM] '.$txt, 1, 'J', 1, 1, '', '', true, 0, false, true, 40, 'B');
$pdf->Ln(4);
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// set color for background
$pdf->setFillColor(215, 235, 255);
// set some text for example
$txt = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. In sed imperdiet lectus. Phasellus quis velit velit, non condimentum quam. Sed neque urna, ultrices ac volutpat vel, laoreet vitae augue. Sed vel velit erat. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Cras eget velit nulla, eu sagittis elit. Nunc ac arcu est, in lobortis tellus. Praesent condimentum rhoncus sodales. In hac habitasse platea dictumst. Proin porta eros pharetra enim tincidunt dignissim nec vel dolor. Cras sapien elit, ornare ac dignissim eu, ultricies ac eros. Maecenas augue magna, ultrices a congue in, mollis eu nulla. Nunc venenatis massa at est eleifend faucibus. Vivamus sed risus lectus, nec interdum nunc.
Fusce et felis vitae diam lobortis sollicitudin. Aenean tincidunt accumsan nisi, id vehicula quam laoreet elementum. Phasellus egestas interdum erat, et viverra ipsum ultricies ac. Praesent sagittis augue at augue volutpat eleifend. Cras nec orci neque. Mauris bibendum posuere blandit. Donec feugiat mollis dui sit amet pellentesque. Sed a enim justo. Donec tincidunt, nisl eget elementum aliquam, odio ipsum ultrices quam, eu porttitor ligula urna at lorem. Donec varius, eros et convallis laoreet, ligula tellus consequat felis, ut ornare metus tellus sodales velit. Duis sed diam ante. Ut rutrum malesuada massa, vitae consectetur ipsum rhoncus sed. Suspendisse potenti. Pellentesque a congue massa.';
// print a blox of text using multicell()
$pdf->MultiCell(80, 5, $txt."\n", 1, 'J', 1, 1, '' ,'', true);
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// AUTO-FITTING
// set color for background
$pdf->setFillColor(255, 235, 235);
// Fit text on cell by reducing font size
$pdf->MultiCell(55, 60, '[FIT CELL] '.$txt."\n", 1, 'J', 1, 1, 125, 145, true, 0, false, true, 60, 'M', true);
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// CUSTOM PADDING
// set color for background
$pdf->setFillColor(255, 255, 215);
// set font
$pdf->setFont('helvetica', '', 8);
// set cell padding
$pdf->setCellPaddings(2, 4, 6, 8);
$txt = "CUSTOM PADDING:\nLeft=2, Top=4, Right=6, Bottom=8\nLorem ipsum dolor sit amet, consectetur adipiscing elit. In sed imperdiet lectus. Phasellus quis velit velit, non condimentum quam. Sed neque urna, ultrices ac volutpat vel, laoreet vitae augue.\n";
$pdf->MultiCell(55, 5, $txt, 1, 'J', 1, 2, 125, 210, true);
// move pointer to last page
$pdf->lastPage();
// ---------------------------------------------------------
//Close and output PDF document
$pdf->Output('example_005.pdf', 'I');
//============================================================+
// END OF FILE
//============================================================+
+347
View File
@@ -0,0 +1,347 @@
<?php
//============================================================+
// File name : example_006.php
// Begin : 2008-03-04
// Last Update : 2013-05-14
//
// Description : Example 006 for TCPDF class
// WriteHTML and RTL support
//
// Author: Nicola Asuni
//
// (c) Copyright:
// Nicola Asuni
// Tecnick.com LTD
// www.tecnick.com
// info@tecnick.com
//============================================================+
/**
* Creates an example PDF TEST document using TCPDF
* @package com.tecnick.tcpdf
* @abstract TCPDF - Example: WriteHTML and RTL support
* @author Nicola Asuni
* @since 2008-03-04
* @group html
* @group rtl
* @group pdf
*/
// Include the main TCPDF library (search for installation path).
require_once('tcpdf_include.php');
// create new PDF document
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// set document information
$pdf->setCreator(PDF_CREATOR);
$pdf->setAuthor('Nicola Asuni');
$pdf->setTitle('TCPDF Example 006');
$pdf->setSubject('TCPDF Tutorial');
$pdf->setKeywords('TCPDF, PDF, example, test, guide');
// set default header data
$pdf->setHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 006', PDF_HEADER_STRING);
// set header and footer fonts
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
// set default monospaced font
$pdf->setDefaultMonospacedFont(PDF_FONT_MONOSPACED);
// set margins
$pdf->setMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$pdf->setHeaderMargin(PDF_MARGIN_HEADER);
$pdf->setFooterMargin(PDF_MARGIN_FOOTER);
// set auto page breaks
$pdf->setAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
// set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
// set some language-dependent strings (optional)
if (@file_exists(dirname(__FILE__).'/lang/eng.php')) {
require_once(dirname(__FILE__).'/lang/eng.php');
$pdf->setLanguageArray($l);
}
// ---------------------------------------------------------
// set font
$pdf->setFont('dejavusans', '', 10);
// add a page
$pdf->AddPage();
// writeHTML($html, $ln=true, $fill=false, $reseth=false, $cell=false, $align='')
// writeHTMLCell($w, $h, $x, $y, $html='', $border=0, $ln=0, $fill=0, $reseth=true, $align='', $autopadding=true)
// create some HTML content
$html = '<h1>HTML Example</h1>
Some special characters: &lt; € &euro; &#8364; &amp; è &egrave; &copy; &gt; \\slash \\\\double-slash \\\\\\triple-slash
<h2>List</h2>
List example:
<ol>
<li><img src="images/logo_example.png" alt="test alt attribute" width="30" height="30" border="0" /> test image</li>
<li><b>bold text</b></li>
<li><i>italic text</i></li>
<li><u>underlined text</u></li>
<li><b>b<i>bi<u>biu</u>bi</i>b</b></li>
<li><a href="http://www.tecnick.com" dir="ltr">link to http://www.tecnick.com</a></li>
<li>Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo.<br />Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt.</li>
<li>SUBLIST
<ol>
<li>row one
<ul>
<li>sublist</li>
</ul>
</li>
<li>row two</li>
</ol>
</li>
<li><b>T</b>E<i>S</i><u>T</u> <del>line through</del></li>
<li><font size="+3">font + 3</font></li>
<li><small>small text</small> normal <small>small text</small> normal <sub>subscript</sub> normal <sup>superscript</sup> normal</li>
</ol>
<dl>
<dt>Coffee</dt>
<dd>Black hot drink</dd>
<dt>Milk</dt>
<dd>White cold drink</dd>
</dl>
<div style="text-align:center">IMAGES<br />
<img src="images/logo_example.png" alt="test alt attribute" width="100" height="100" border="0" /><img src="images/tcpdf_box.svg" alt="test alt attribute" width="100" height="100" border="0" /><img src="images/logo_example.jpg" alt="test alt attribute" width="100" height="100" border="0" />
</div>';
// output the HTML content
$pdf->writeHTML($html, true, false, true, false, '');
// output some RTL HTML content
$html = '<div style="text-align:center">The words &#8220;<span dir="rtl">&#1502;&#1494;&#1500; [mazel] &#1496;&#1493;&#1489; [tov]</span>&#8221; mean &#8220;Congratulations!&#8221;</div>';
$pdf->writeHTML($html, true, false, true, false, '');
// test some inline CSS
$html = '<p>This is just an example of html code to demonstrate some supported CSS inline styles.
<span style="font-weight: bold;">bold text</span>
<span style="text-decoration: line-through;">line-trough</span>
<span style="text-decoration: underline line-through;">underline and line-trough</span>
<span style="color: rgb(0, 128, 64);">color</span>
<span style="background-color: rgb(255, 0, 0); color: rgb(255, 255, 255);">background color</span>
<span style="font-weight: bold;">bold</span>
<span style="font-size: xx-small;">xx-small</span>
<span style="font-size: x-small;">x-small</span>
<span style="font-size: small;">small</span>
<span style="font-size: medium;">medium</span>
<span style="font-size: large;">large</span>
<span style="font-size: x-large;">x-large</span>
<span style="font-size: xx-large;">xx-large</span>
</p>';
$pdf->writeHTML($html, true, false, true, false, '');
// reset pointer to the last page
$pdf->lastPage();
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Print a table
// add a page
$pdf->AddPage();
// create some HTML content
$subtable = '<table border="1" cellspacing="6" cellpadding="4"><tr><td>a</td><td>b</td></tr><tr><td>c</td><td>d</td></tr></table>';
$html = '<h2>HTML TABLE:</h2>
<table border="1" cellspacing="3" cellpadding="4">
<tr>
<th>#</th>
<th align="right">RIGHT align</th>
<th align="left">LEFT align</th>
<th>4A</th>
</tr>
<tr>
<td>1</td>
<td bgcolor="#cccccc" align="center" colspan="2">A1 ex<i>amp</i>le <a href="http://www.tcpdf.org">link</a> column span. One two tree four five six seven eight nine ten.<br />line after br<br /><small>small text</small> normal <sub>subscript</sub> normal <sup>superscript</sup> normal bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla<ol><li>first<ol><li>sublist</li><li>sublist</li></ol></li><li>second</li></ol><small color="#FF0000" bgcolor="#FFFF00">small small small small small small small small small small small small small small small small small small small small</small></td>
<td>4B</td>
</tr>
<tr>
<td>'.$subtable.'</td>
<td bgcolor="#0000FF" color="yellow" align="center">A2 € &euro; &#8364; &amp; è &egrave;<br/>A2 € &euro; &#8364; &amp; è &egrave;</td>
<td bgcolor="#FFFF00" align="left"><font color="#FF0000">Red</font> Yellow BG</td>
<td>4C</td>
</tr>
<tr>
<td>1A</td>
<td rowspan="2" colspan="2" bgcolor="#FFFFCC">2AA<br />2AB<br />2AC</td>
<td bgcolor="#FF0000">4D</td>
</tr>
<tr>
<td>1B</td>
<td>4E</td>
</tr>
<tr>
<td>1C</td>
<td>2C</td>
<td>3C</td>
<td>4F</td>
</tr>
</table>';
// output the HTML content
$pdf->writeHTML($html, true, false, true, false, '');
// Print some HTML Cells
$html = '<span color="red">red</span> <span color="green">green</span> <span color="blue">blue</span><br /><span color="red">red</span> <span color="green">green</span> <span color="blue">blue</span>';
$pdf->setFillColor(255,255,0);
$pdf->writeHTMLCell(0, 0, '', '', $html, 'LRTB', 1, 0, true, 'L', true);
$pdf->writeHTMLCell(0, 0, '', '', $html, 'LRTB', 1, 1, true, 'C', true);
$pdf->writeHTMLCell(0, 0, '', '', $html, 'LRTB', 1, 0, true, 'R', true);
// reset pointer to the last page
$pdf->lastPage();
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Print a table
// add a page
$pdf->AddPage();
// create some HTML content
$html = '<h1>Image alignments on HTML table</h1>
<table cellpadding="1" cellspacing="1" border="1" style="text-align:center;">
<tr><td><img src="images/logo_example.png" border="0" height="41" width="41" /></td></tr>
<tr style="text-align:left;"><td><img src="images/logo_example.png" border="0" height="41" width="41" align="top" /></td></tr>
<tr style="text-align:center;"><td><img src="images/logo_example.png" border="0" height="41" width="41" align="middle" /></td></tr>
<tr style="text-align:right;"><td><img src="images/logo_example.png" border="0" height="41" width="41" align="bottom" /></td></tr>
<tr><td style="text-align:left;"><img src="images/logo_example.png" border="0" height="41" width="41" align="top" /></td></tr>
<tr><td style="text-align:center;"><img src="images/logo_example.png" border="0" height="41" width="41" align="middle" /></td></tr>
<tr><td style="text-align:right;"><img src="images/logo_example.png" border="0" height="41" width="41" align="bottom" /></td></tr>
</table>';
// output the HTML content
$pdf->writeHTML($html, true, false, true, false, '');
// create some HTML content
$html = '<h1>Embedded Images</h1>
<table cellpadding="1" cellspacing="1" border="1" style="text-align:center;">
<tr><td>src="@..." </td><td><img src="@DATA1@" border="0" height="41" width="41" /></td></tr>
<tr><td>src="data..."</td><td><img src="@DATA2@" border="0" height="41" width="41" /></td></tr>
</table>';
$data = base64_encode(file_get_contents("images/logo_example.png"));
$html = str_replace("@DATA1@", "@" . $data, $html);
$html = str_replace("@DATA2@", "data:image/png;base64," . $data, $html);
// output the HTML content
$pdf->writeHTML($html, true, false, true, false, '');
// reset pointer to the last page
$pdf->lastPage();
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Print all HTML colors
// add a page
$pdf->AddPage();
$textcolors = '<h1>HTML Text Colors</h1>';
$bgcolors = '<hr /><h1>HTML Background Colors</h1>';
foreach(TCPDF_COLORS::$webcolor as $k => $v) {
$textcolors .= '<span color="#'.$v.'">'.$v.'</span> ';
$bgcolors .= '<span bgcolor="#'.$v.'" color="#333333">'.$v.'</span> ';
}
// output the HTML content
$pdf->writeHTML($textcolors, true, false, true, false, '');
$pdf->writeHTML($bgcolors, true, false, true, false, '');
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Test word-wrap
// create some HTML content
$html = '<hr />
<h1>Various tests</h1>
<a href="#2">link to page 2</a><br />
<font face="courier"><b>thisisaverylongword</b></font> <font face="helvetica"><i>thisisanotherverylongword</i></font> <font face="times"><b>thisisaverylongword</b></font> thisisanotherverylongword <font face="times">thisisaverylongword</font> <font face="courier"><b>thisisaverylongword</b></font> <font face="helvetica"><i>thisisanotherverylongword</i></font> <font face="times"><b>thisisaverylongword</b></font> thisisanotherverylongword <font face="times">thisisaverylongword</font> <font face="courier"><b>thisisaverylongword</b></font> <font face="helvetica"><i>thisisanotherverylongword</i></font> <font face="times"><b>thisisaverylongword</b></font> thisisanotherverylongword <font face="times">thisisaverylongword</font> <font face="courier"><b>thisisaverylongword</b></font> <font face="helvetica"><i>thisisanotherverylongword</i></font> <font face="times"><b>thisisaverylongword</b></font> thisisanotherverylongword <font face="times">thisisaverylongword</font> <font face="courier"><b>thisisaverylongword</b></font> <font face="helvetica"><i>thisisanotherverylongword</i></font> <font face="times"><b>thisisaverylongword</b></font> thisisanotherverylongword <font face="times">thisisaverylongword</font>';
// output the HTML content
$pdf->writeHTML($html, true, false, true, false, '');
// Test fonts nesting
$html1 = 'Default <font face="courier">Courier <font face="helvetica">Helvetica <font face="times">Times <font face="dejavusans">dejavusans </font>Times </font>Helvetica </font>Courier </font>Default';
$html2 = '<small>small text</small> normal <small>small text</small> normal <sub>subscript</sub> normal <sup>superscript</sup> normal';
$html3 = '<font size="10" color="#ff7f50">The</font> <font size="10" color="#6495ed">quick</font> <font size="14" color="#dc143c">brown</font> <font size="18" color="#008000">fox</font> <font size="22"><a href="http://www.tcpdf.org">jumps</a></font> <font size="22" color="#a0522d">over</font> <font size="18" color="#da70d6">the</font> <font size="14" color="#9400d3">lazy</font> <font size="10" color="#4169el">dog</font>.';
$html = $html1.'<br />'.$html2.'<br />'.$html3.'<br />'.$html3.'<br />'.$html2;
// output the HTML content
$pdf->writeHTML($html, true, false, true, false, '');
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// test pre tag
// add a page
$pdf->AddPage();
$html = <<<EOF
<div style="background-color:#880000;color:white;">
Hello World!<br />
Hello
</div>
<pre style="background-color:#336699;color:white;">
int main() {
printf("HelloWorld");
return 0;
}
</pre>
<tt>Monospace font</tt>, normal font, <tt>monospace font</tt>, normal font.
<br />
<div style="background-color:#880000;color:white;">DIV LEVEL 1<div style="background-color:#008800;color:white;">DIV LEVEL 2</div>DIV LEVEL 1</div>
<br />
<span style="background-color:#880000;color:white;">SPAN LEVEL 1 <span style="background-color:#008800;color:white;">SPAN LEVEL 2</span> SPAN LEVEL 1</span>
EOF;
// output the HTML content
$pdf->writeHTML($html, true, false, true, false, '');
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// test custom bullet points for list
// add a page
$pdf->AddPage();
$html = <<<EOF
<h1>Test custom bullet image for list items</h1>
<ul style="font-size:14pt;list-style-type:img|png|4|4|images/logo_example.png">
<li>test custom bullet image</li>
<li>test custom bullet image</li>
<li>test custom bullet image</li>
<li>test custom bullet image</li>
<ul>
EOF;
// output the HTML content
$pdf->writeHTML($html, true, false, true, false, '');
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// reset pointer to the last page
$pdf->lastPage();
// ---------------------------------------------------------
//Close and output PDF document
$pdf->Output('example_006.pdf', 'I');
//============================================================+
// END OF FILE
//============================================================+
+117
View File
@@ -0,0 +1,117 @@
<?php
//============================================================+
// File name : example_007.php
// Begin : 2008-03-04
// Last Update : 2013-05-14
//
// Description : Example 007 for TCPDF class
// Two independent columns with WriteHTMLCell()
//
// Author: Nicola Asuni
//
// (c) Copyright:
// Nicola Asuni
// Tecnick.com LTD
// www.tecnick.com
// info@tecnick.com
//============================================================+
/**
* Creates an example PDF TEST document using TCPDF
* @package com.tecnick.tcpdf
* @abstract TCPDF - Example: Two independent columns with WriteHTMLCell()
* @author Nicola Asuni
* @since 2008-03-04
* @group column
* @group cell
* @group html
* @group pdf
*/
// Include the main TCPDF library (search for installation path).
require_once('tcpdf_include.php');
// create new PDF document
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// set document information
$pdf->setCreator(PDF_CREATOR);
$pdf->setAuthor('Nicola Asuni');
$pdf->setTitle('TCPDF Example 007');
$pdf->setSubject('TCPDF Tutorial');
$pdf->setKeywords('TCPDF, PDF, example, test, guide');
// set default header data
$pdf->setHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 007', PDF_HEADER_STRING);
// set header and footer fonts
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
// set default monospaced font
$pdf->setDefaultMonospacedFont(PDF_FONT_MONOSPACED);
// set margins
$pdf->setMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$pdf->setHeaderMargin(PDF_MARGIN_HEADER);
$pdf->setFooterMargin(PDF_MARGIN_FOOTER);
// set auto page breaks
$pdf->setAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
// set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
// set some language-dependent strings (optional)
if (@file_exists(dirname(__FILE__).'/lang/eng.php')) {
require_once(dirname(__FILE__).'/lang/eng.php');
$pdf->setLanguageArray($l);
}
// ---------------------------------------------------------
// set font
$pdf->setFont('times', '', 12);
// add a page
$pdf->AddPage();
// create columns content
$left_column = '<b>LEFT COLUMN</b> left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column';
$right_column = '<b>RIGHT COLUMN</b> right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column';
// writeHTMLCell($w, $h, $x, $y, $html='', $border=0, $ln=0, $fill=0, $reseth=true, $align='', $autopadding=true)
// get current vertical position
$y = $pdf->getY();
// set color for background
$pdf->setFillColor(255, 255, 200);
// set color for text
$pdf->setTextColor(0, 63, 127);
// write the first column
$pdf->writeHTMLCell(80, '', '', $y, $left_column, 1, 0, 1, true, 'J', true);
// set color for background
$pdf->setFillColor(215, 235, 255);
// set color for text
$pdf->setTextColor(127, 31, 0);
// write the second column
$pdf->writeHTMLCell(80, '', '', '', $right_column, 1, 1, 1, true, 'J', true);
// reset pointer to the last page
$pdf->lastPage();
// ---------------------------------------------------------
//Close and output PDF document
$pdf->Output('example_007.pdf', 'I');
//============================================================+
// END OF FILE
//============================================================+
+99
View File
@@ -0,0 +1,99 @@
<?php
//============================================================+
// File name : example_008.php
// Begin : 2008-03-04
// Last Update : 2013-05-14
//
// Description : Example 008 for TCPDF class
// Include external UTF-8 text file
//
// Author: Nicola Asuni
//
// (c) Copyright:
// Nicola Asuni
// Tecnick.com LTD
// www.tecnick.com
// info@tecnick.com
//============================================================+
/**
* Creates an example PDF TEST document using TCPDF
* @package com.tecnick.tcpdf
* @abstract TCPDF - Example: Include external UTF-8 text file
* @author Nicola Asuni
* @since 2008-03-04
* @group unicode
* @group pdf
*/
// Include the main TCPDF library (search for installation path).
require_once('tcpdf_include.php');
// create new PDF document
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// set document information
$pdf->setCreator(PDF_CREATOR);
$pdf->setAuthor('Nicola Asuni');
$pdf->setTitle('TCPDF Example 008');
$pdf->setSubject('TCPDF Tutorial');
$pdf->setKeywords('TCPDF, PDF, example, test, guide');
// set default header data
$pdf->setHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 008', PDF_HEADER_STRING);
// set header and footer fonts
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
// set default monospaced font
$pdf->setDefaultMonospacedFont(PDF_FONT_MONOSPACED);
// set margins
$pdf->setMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$pdf->setHeaderMargin(PDF_MARGIN_HEADER);
$pdf->setFooterMargin(PDF_MARGIN_FOOTER);
// set auto page breaks
$pdf->setAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
// set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
// set some language-dependent strings (optional)
if (@file_exists(dirname(__FILE__).'/lang/eng.php')) {
require_once(dirname(__FILE__).'/lang/eng.php');
$pdf->setLanguageArray($l);
}
// ---------------------------------------------------------
// set default font subsetting mode
$pdf->setFontSubsetting(true);
// set font
$pdf->setFont('freeserif', '', 12);
// add a page
$pdf->AddPage();
// get external file content
$utf8text = file_get_contents('data/utf8test.txt', false);
// set color for text
$pdf->setTextColor(0, 63, 127);
//Write($h, $txt, $link='', $fill=0, $align='', $ln=false, $stretch=0, $firstline=false, $firstblock=false, $maxh=0)
// write the text
$pdf->Write(5, $utf8text, '', 0, '', false, 0, false, false, 0);
// ---------------------------------------------------------
//Close and output PDF document
$pdf->Output('example_008.pdf', 'I');
//============================================================+
// END OF FILE
//============================================================+
+148
View File
@@ -0,0 +1,148 @@
<?php
//============================================================+
// File name : example_009.php
// Begin : 2008-03-04
// Last Update : 2013-05-14
//
// Description : Example 009 for TCPDF class
// Test Image
//
// Author: Nicola Asuni
//
// (c) Copyright:
// Nicola Asuni
// Tecnick.com LTD
// www.tecnick.com
// info@tecnick.com
//============================================================+
/**
* Creates an example PDF TEST document using TCPDF
* @package com.tecnick.tcpdf
* @abstract TCPDF - Example: Test Image
* @author Nicola Asuni
* @since 2008-03-04
* @group image
* @group pdf
*/
// Include the main TCPDF library (search for installation path).
require_once('tcpdf_include.php');
// create new PDF document
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// set document information
$pdf->setCreator(PDF_CREATOR);
$pdf->setAuthor('Nicola Asuni');
$pdf->setTitle('TCPDF Example 009');
$pdf->setSubject('TCPDF Tutorial');
$pdf->setKeywords('TCPDF, PDF, example, test, guide');
// set default header data
$pdf->setHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 009', PDF_HEADER_STRING);
// set header and footer fonts
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
// set default monospaced font
$pdf->setDefaultMonospacedFont(PDF_FONT_MONOSPACED);
// set margins
$pdf->setMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$pdf->setHeaderMargin(PDF_MARGIN_HEADER);
$pdf->setFooterMargin(PDF_MARGIN_FOOTER);
// set auto page breaks
$pdf->setAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
// set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
// set some language-dependent strings (optional)
if (@file_exists(dirname(__FILE__).'/lang/eng.php')) {
require_once(dirname(__FILE__).'/lang/eng.php');
$pdf->setLanguageArray($l);
}
// -------------------------------------------------------------------
// add a page
$pdf->AddPage();
// set JPEG quality
$pdf->setJPEGQuality(75);
// Image method signature:
// Image($file, $x='', $y='', $w=0, $h=0, $type='', $link='', $align='', $resize=false, $dpi=300, $palign='', $ismask=false, $imgmask=false, $border=0, $fitbox=false, $hidden=false, $fitonpage=false)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Example of Image from data stream ('PHP rules')
$imgdata = base64_decode('iVBORw0KGgoAAAANSUhEUgAAABwAAAASCAMAAAB/2U7WAAAABlBMVEUAAAD///+l2Z/dAAAASUlEQVR4XqWQUQoAIAxC2/0vXZDrEX4IJTRkb7lobNUStXsB0jIXIAMSsQnWlsV+wULF4Avk9fLq2r8a5HSE35Q3eO2XP1A1wQkZSgETvDtKdQAAAABJRU5ErkJggg==');
// The '@' character is used to indicate that follows an image data stream and not an image file name
$pdf->Image('@'.$imgdata);
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Image example with resizing
$pdf->Image('images/image_demo.jpg', 15, 140, 75, 113, 'JPG', 'http://www.tcpdf.org', '', true, 150, '', false, false, 1, false, false, false);
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// test fitbox with all alignment combinations
$horizontal_alignments = array('L', 'C', 'R');
$vertical_alignments = array('T', 'M', 'B');
$x = 15;
$y = 35;
$w = 30;
$h = 30;
// test all combinations of alignments
for ($i = 0; $i < 3; ++$i) {
$fitbox = $horizontal_alignments[$i].' ';
$x = 15;
for ($j = 0; $j < 3; ++$j) {
$fitbox[1] = $vertical_alignments[$j];
$pdf->Rect($x, $y, $w, $h, 'F', array(), array(128,255,128));
$pdf->Image('images/image_demo.jpg', $x, $y, $w, $h, 'JPG', '', '', false, 300, '', false, false, 0, $fitbox, false, false);
$x += 32; // new column
}
$y += 32; // new row
}
$x = 115;
$y = 35;
$w = 25;
$h = 50;
for ($i = 0; $i < 3; ++$i) {
$fitbox = $horizontal_alignments[$i].' ';
$x = 115;
for ($j = 0; $j < 3; ++$j) {
$fitbox[1] = $vertical_alignments[$j];
$pdf->Rect($x, $y, $w, $h, 'F', array(), array(128,255,255));
$pdf->Image('images/image_demo.jpg', $x, $y, $w, $h, 'JPG', '', '', false, 300, '', false, false, 0, $fitbox, false, false);
$x += 27; // new column
}
$y += 52; // new row
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Stretching, position and alignment example
$pdf->setXY(110, 200);
$pdf->Image('images/image_demo.jpg', '', '', 40, 40, '', '', 'T', false, 300, '', false, false, 1, false, false, false);
$pdf->Image('images/image_demo.jpg', '', '', 40, 40, '', '', '', false, 300, '', false, false, 1, false, false, false);
// -------------------------------------------------------------------
//Close and output PDF document
$pdf->Output('example_009.pdf', 'I');
//============================================================+
// END OF FILE
//============================================================+
+152
View File
@@ -0,0 +1,152 @@
<?php
//============================================================+
// File name : example_010.php
// Begin : 2008-03-04
// Last Update : 2013-05-14
//
// Description : Example 010 for TCPDF class
// Text on multiple columns
//
// Author: Nicola Asuni
//
// (c) Copyright:
// Nicola Asuni
// Tecnick.com LTD
// www.tecnick.com
// info@tecnick.com
//============================================================+
/**
* Creates an example PDF TEST document using TCPDF
* @package com.tecnick.tcpdf
* @abstract TCPDF - Example: Text on multiple columns
* @author Nicola Asuni
* @since 2008-03-04
* @group column
* @group pdf
*/
// Include the main TCPDF library (search for installation path).
require_once('tcpdf_include.php');
/**
* Extend TCPDF to work with multiple columns
*/
class MC_TCPDF extends TCPDF {
/**
* Print chapter
* @param int $num chapter number
* @param string $title chapter title
* @param string $file name of the file containing the chapter body
* @param boolean $mode if true the chapter body is in HTML, otherwise in simple text.
* @public
*/
public function PrintChapter($num, $title, $file, $mode=false) {
// add a new page
$this->AddPage();
// disable existing columns
$this->resetColumns();
// print chapter title
$this->ChapterTitle($num, $title);
// set columns
$this->setEqualColumns(3, 57);
// print chapter body
$this->ChapterBody($file, $mode);
}
/**
* Set chapter title
* @param int $num chapter number
* @param string $title chapter title
* @public
*/
public function ChapterTitle($num, $title) {
$this->setFont('helvetica', '', 14);
$this->setFillColor(200, 220, 255);
$this->Cell(180, 6, 'Chapter '.$num.' : '.$title, 0, 1, '', 1);
$this->Ln(4);
}
/**
* Print chapter body
* @param string $file name of the file containing the chapter body
* @param boolean $mode if true the chapter body is in HTML, otherwise in simple text.
* @public
*/
public function ChapterBody($file, $mode=false) {
$this->selectColumn();
// get esternal file content
$content = file_get_contents($file, false);
// set font
$this->setFont('times', '', 9);
$this->setTextColor(50, 50, 50);
// print content
if ($mode) {
// ------ HTML MODE ------
$this->writeHTML($content, true, false, true, false, 'J');
} else {
// ------ TEXT MODE ------
$this->Write(0, $content, '', 0, 'J', true, 0, false, true, 0);
}
$this->Ln();
}
} // end of extended class
// ---------------------------------------------------------
// EXAMPLE
// ---------------------------------------------------------
// create new PDF document
$pdf = new MC_TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// set document information
$pdf->setCreator(PDF_CREATOR);
$pdf->setAuthor('Nicola Asuni');
$pdf->setTitle('TCPDF Example 010');
$pdf->setSubject('TCPDF Tutorial');
$pdf->setKeywords('TCPDF, PDF, example, test, guide');
// set default header data
$pdf->setHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 010', PDF_HEADER_STRING);
// set header and footer fonts
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
// set default monospaced font
$pdf->setDefaultMonospacedFont(PDF_FONT_MONOSPACED);
// set margins
$pdf->setMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$pdf->setHeaderMargin(PDF_MARGIN_HEADER);
$pdf->setFooterMargin(PDF_MARGIN_FOOTER);
// set auto page breaks
$pdf->setAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
// set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
// set some language-dependent strings (optional)
if (@file_exists(dirname(__FILE__).'/lang/eng.php')) {
require_once(dirname(__FILE__).'/lang/eng.php');
$pdf->setLanguageArray($l);
}
// ---------------------------------------------------------
// print TEXT
$pdf->PrintChapter(1, 'LOREM IPSUM [TEXT]', 'data/chapter_demo_1.txt', false);
// print HTML
$pdf->PrintChapter(2, 'LOREM IPSUM [HTML]', 'data/chapter_demo_2.txt', true);
// ---------------------------------------------------------
//Close and output PDF document
$pdf->Output('example_010.pdf', 'I');
//============================================================+
// END OF FILE
//============================================================+
+141
View File
@@ -0,0 +1,141 @@
<?php
//============================================================+
// File name : example_011.php
// Begin : 2008-03-04
// Last Update : 2013-05-14
//
// Description : Example 011 for TCPDF class
// Colored Table (very simple table)
//
// Author: Nicola Asuni
//
// (c) Copyright:
// Nicola Asuni
// Tecnick.com LTD
// www.tecnick.com
// info@tecnick.com
//============================================================+
/**
* Creates an example PDF TEST document using TCPDF
* @package com.tecnick.tcpdf
* @abstract TCPDF - Example: Colored Table
* @author Nicola Asuni
* @since 2008-03-04
* @group table
* @group color
* @group pdf
*/
// Include the main TCPDF library (search for installation path).
require_once('tcpdf_include.php');
// extend TCPF with custom functions
class MYPDF extends TCPDF {
// Load table data from file
public function LoadData($file) {
// Read file lines
$lines = file($file);
$data = array();
foreach($lines as $line) {
$data[] = explode(';', chop($line));
}
return $data;
}
// Colored table
public function ColoredTable($header,$data) {
// Colors, line width and bold font
$this->setFillColor(255, 0, 0);
$this->setTextColor(255);
$this->setDrawColor(128, 0, 0);
$this->setLineWidth(0.3);
$this->setFont('', 'B');
// Header
$w = array(40, 35, 40, 45);
$num_headers = count($header);
for($i = 0; $i < $num_headers; ++$i) {
$this->Cell($w[$i], 7, $header[$i], 1, 0, 'C', 1);
}
$this->Ln();
// Color and font restoration
$this->setFillColor(224, 235, 255);
$this->setTextColor(0);
$this->setFont('');
// Data
$fill = 0;
foreach($data as $row) {
$this->Cell($w[0], 6, $row[0], 'LR', 0, 'L', $fill);
$this->Cell($w[1], 6, $row[1], 'LR', 0, 'L', $fill);
$this->Cell($w[2], 6, number_format($row[2]), 'LR', 0, 'R', $fill);
$this->Cell($w[3], 6, number_format($row[3]), 'LR', 0, 'R', $fill);
$this->Ln();
$fill=!$fill;
}
$this->Cell(array_sum($w), 0, '', 'T');
}
}
// create new PDF document
$pdf = new MYPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// set document information
$pdf->setCreator(PDF_CREATOR);
$pdf->setAuthor('Nicola Asuni');
$pdf->setTitle('TCPDF Example 011');
$pdf->setSubject('TCPDF Tutorial');
$pdf->setKeywords('TCPDF, PDF, example, test, guide');
// set default header data
$pdf->setHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 011', PDF_HEADER_STRING);
// set header and footer fonts
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
// set default monospaced font
$pdf->setDefaultMonospacedFont(PDF_FONT_MONOSPACED);
// set margins
$pdf->setMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$pdf->setHeaderMargin(PDF_MARGIN_HEADER);
$pdf->setFooterMargin(PDF_MARGIN_FOOTER);
// set auto page breaks
$pdf->setAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
// set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
// set some language-dependent strings (optional)
if (@file_exists(dirname(__FILE__).'/lang/eng.php')) {
require_once(dirname(__FILE__).'/lang/eng.php');
$pdf->setLanguageArray($l);
}
// ---------------------------------------------------------
// set font
$pdf->setFont('helvetica', '', 12);
// add a page
$pdf->AddPage();
// column titles
$header = array('Country', 'Capital', 'Area (sq km)', 'Pop. (thousands)');
// data loading
$data = $pdf->LoadData('data/table_data_demo.txt');
// print colored table
$pdf->ColoredTable($header, $data);
// ---------------------------------------------------------
// close and output PDF document
$pdf->Output('example_011.pdf', 'I');
//============================================================+
// END OF FILE
//============================================================+
Binary file not shown.
+207
View File
@@ -0,0 +1,207 @@
<?php
//============================================================+
// File name : example_012.php
// Begin : 2008-03-04
// Last Update : 2013-05-14
//
// Description : Example 012 for TCPDF class
// Graphic Functions
//
// Author: Nicola Asuni
//
// (c) Copyright:
// Nicola Asuni
// Tecnick.com LTD
// www.tecnick.com
// info@tecnick.com
//============================================================+
/**
* Creates an example PDF TEST document using TCPDF
* @package com.tecnick.tcpdf
* @abstract TCPDF - Example: Graphic Functions
* @author Nicola Asuni
* @since 2008-03-04
* @group drawing
* @group pdf
*/
// Include the main TCPDF library (search for installation path).
require_once('tcpdf_include.php');
// create new PDF document
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// set document information
$pdf->setCreator(PDF_CREATOR);
$pdf->setAuthor('Nicola Asuni');
$pdf->setTitle('TCPDF Example 012');
$pdf->setSubject('TCPDF Tutorial');
$pdf->setKeywords('TCPDF, PDF, example, test, guide');
// disable header and footer
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);
// set default monospaced font
$pdf->setDefaultMonospacedFont(PDF_FONT_MONOSPACED);
// set margins
$pdf->setMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
// set auto page breaks
$pdf->setAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
// set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
// set some language-dependent strings (optional)
if (@file_exists(dirname(__FILE__).'/lang/eng.php')) {
require_once(dirname(__FILE__).'/lang/eng.php');
$pdf->setLanguageArray($l);
}
// ---------------------------------------------------------
// set font
$pdf->setFont('helvetica', '', 10);
// add a page
$pdf->AddPage();
$style = array('width' => 0.5, 'cap' => 'butt', 'join' => 'miter', 'dash' => '10,20,5,10', 'phase' => 10, 'color' => array(255, 0, 0));
$style2 = array('width' => 0.5, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(255, 0, 0));
$style3 = array('width' => 1, 'cap' => 'round', 'join' => 'round', 'dash' => '2,10', 'color' => array(255, 0, 0));
$style4 = array('L' => 0,
'T' => array('width' => 0.25, 'cap' => 'butt', 'join' => 'miter', 'dash' => '20,10', 'phase' => 10, 'color' => array(100, 100, 255)),
'R' => array('width' => 0.50, 'cap' => 'round', 'join' => 'miter', 'dash' => 0, 'color' => array(50, 50, 127)),
'B' => array('width' => 0.75, 'cap' => 'square', 'join' => 'miter', 'dash' => '30,10,5,10'));
$style5 = array('width' => 0.25, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 64, 128));
$style6 = array('width' => 0.5, 'cap' => 'butt', 'join' => 'miter', 'dash' => '10,10', 'color' => array(0, 128, 0));
$style7 = array('width' => 0.5, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(255, 128, 0));
// Line
$pdf->Text(5, 4, 'Line examples');
$pdf->Line(5, 10, 80, 30, $style);
$pdf->Line(5, 10, 5, 30, $style2);
$pdf->Line(5, 10, 80, 10, $style3);
// Rect
$pdf->Text(100, 4, 'Rectangle examples');
$pdf->Rect(100, 10, 40, 20, 'DF', $style4, array(220, 220, 200));
$pdf->Rect(145, 10, 40, 20, 'D', array('all' => $style3));
// Curve
$pdf->Text(5, 34, 'Curve examples');
$pdf->Curve(5, 40, 30, 55, 70, 45, 60, 75, '', $style6);
$pdf->Curve(80, 40, 70, 75, 150, 45, 100, 75, 'F', $style6);
$pdf->Curve(140, 40, 150, 55, 180, 45, 200, 75, 'DF', $style6, array(200, 220, 200));
// Circle and ellipse
$pdf->Text(5, 79, 'Circle and ellipse examples');
$pdf->setLineStyle($style5);
$pdf->Circle(25,105,20);
$pdf->Circle(25,105,10, 90, 180, '', $style6);
$pdf->Circle(25,105,10, 270, 360, 'F');
$pdf->Circle(25,105,10, 270, 360, 'C', $style6);
$pdf->setLineStyle($style5);
$pdf->Ellipse(100,103,40,20);
$pdf->Ellipse(100,105,20,10, 0, 90, 180, '', $style6);
$pdf->Ellipse(100,105,20,10, 0, 270, 360, 'DF', $style6);
$pdf->setLineStyle($style5);
$pdf->Ellipse(175,103,30,15,45);
$pdf->Ellipse(175,105,15,7.50, 45, 90, 180, '', $style6);
$pdf->Ellipse(175,105,15,7.50, 45, 270, 360, 'F', $style6, array(220, 200, 200));
// Polygon
$pdf->Text(5, 129, 'Polygon examples');
$pdf->setLineStyle(array('width' => 0.5, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0)));
$pdf->Polygon(array(5,135,45,135,15,165));
$pdf->Polygon(array(60,135,80,135,80,155,70,165,50,155), 'DF', array($style6, $style7, $style7, 0, $style6), array(220, 200, 200));
$pdf->Polygon(array(120,135,140,135,150,155,110,155), 'D', array($style6, 0, $style7, $style6));
$pdf->Polygon(array(160,135,190,155,170,155,200,160,160,165), 'DF', array('all' => $style6), array(220, 220, 220));
// Polygonal Line
$pdf->setLineStyle(array('width' => 0.5, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 164)));
$pdf->PolyLine(array(80,165,90,160,100,165,110,160,120,165,130,160,140,165), 'D', array(), array());
// Regular polygon
$pdf->Text(5, 169, 'Regular polygon examples');
$pdf->setLineStyle($style5);
$pdf->RegularPolygon(20, 190, 15, 6, 0, 1, 'F');
$pdf->RegularPolygon(55, 190, 15, 6);
$pdf->RegularPolygon(55, 190, 10, 6, 45, false, 'DF', array($style6, 0, $style7, 0, $style7, $style7));
$pdf->RegularPolygon(90, 190, 15, 3, 0, true, 'DF', array('all' => $style5), array(200, 220, 200), 'F', array(255, 200, 200));
$pdf->RegularPolygon(125, 190, 15, 4, 30, true, '', array('all' => $style5), array(), '', $style6);
$pdf->RegularPolygon(160, 190, 15, 10);
// Star polygon
$pdf->Text(5, 209, 'Star polygon examples');
$pdf->setLineStyle($style5);
$pdf->StarPolygon(20, 230, 15, 20, 3, 0, 1, 'F');
$pdf->StarPolygon(55, 230, 15, 12, 5);
$pdf->StarPolygon(55, 230, 7, 12, 5, 45, false, 'DF', array('all' => $style7), array(220, 220, 200), 'F', array(255, 200, 200));
$pdf->StarPolygon(90, 230, 15, 20, 6, 0, true, 'DF', array('all' => $style5), array(220, 220, 200), 'F', array(255, 200, 200));
$pdf->StarPolygon(125, 230, 15, 5, 2, 30, true, '', array('all' => $style5), array(), '', $style6);
$pdf->StarPolygon(160, 230, 15, 10, 3);
$pdf->StarPolygon(160, 230, 7, 50, 26);
// Rounded rectangle
$pdf->Text(5, 249, 'Rounded rectangle examples');
$pdf->setLineStyle(array('width' => 0.5, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0)));
$pdf->RoundedRect(5, 255, 40, 30, 3.50, '1111', 'DF');
$pdf->RoundedRect(50, 255, 40, 30, 6.50, '1000');
$pdf->RoundedRect(95, 255, 40, 30, 10.0, '1111', '', $style6);
$pdf->RoundedRect(140, 255, 40, 30, 8.0, '0101', 'DF', $style6, array(200, 200, 200));
// Arrows
$pdf->Text(185, 249, 'Arrows');
$pdf->setLineStyle($style5);
$pdf->setFillColor(255, 0, 0);
$pdf->Arrow(200, 280, 185, 266, 0, 5, 15);
$pdf->Arrow(200, 280, 190, 263, 1, 5, 15);
$pdf->Arrow(200, 280, 195, 261, 2, 5, 15);
$pdf->Arrow(200, 280, 200, 260, 3, 5, 15);
// - . - . - . - . - . - . - . - . - . - . - . - . - . - . -
// ellipse
// add a page
$pdf->AddPage();
$pdf->Cell(0, 0, 'Arc of Ellipse');
// center of ellipse
$xc=100;
$yc=100;
// X Y axis
$pdf->setDrawColor(200, 200, 200);
$pdf->Line($xc-50, $yc, $xc+50, $yc);
$pdf->Line($xc, $yc-50, $xc, $yc+50);
// ellipse axis
$pdf->setDrawColor(200, 220, 255);
$pdf->Line($xc-50, $yc-50, $xc+50, $yc+50);
$pdf->Line($xc-50, $yc+50, $xc+50, $yc-50);
// ellipse
$pdf->setDrawColor(200, 255, 200);
$pdf->Ellipse($xc, $yc, 30, 15, 45, 0, 360, 'D', array(), array(), 2);
// ellipse arc
$pdf->setDrawColor(255, 0, 0);
$pdf->Ellipse($xc, $yc, 30, 15, 45, 45, 90, 'D', array(), array(), 2);
// ---------------------------------------------------------
//Close and output PDF document
$pdf->Output('example_012.pdf', 'I');
//============================================================+
// END OF FILE
//============================================================+
+231
View File
@@ -0,0 +1,231 @@
<?php
//============================================================+
// File name : example_013.php
// Begin : 2008-03-04
// Last Update : 2013-05-14
//
// Description : Example 013 for TCPDF class
// Graphic Transformations
//
// Author: Nicola Asuni
//
// (c) Copyright:
// Nicola Asuni
// Tecnick.com LTD
// www.tecnick.com
// info@tecnick.com
//============================================================+
/**
* Creates an example PDF TEST document using TCPDF
* @package com.tecnick.tcpdf
* @abstract TCPDF - Example: Graphic Transformations
* @author Nicola Asuni
* @since 2008-03-04
* @group drawing
* @group pdf
*/
// Include the main TCPDF library (search for installation path).
require_once('tcpdf_include.php');
// create new PDF document
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// set document information
$pdf->setCreator(PDF_CREATOR);
$pdf->setAuthor('Nicola Asuni');
$pdf->setTitle('TCPDF Example 013');
$pdf->setSubject('TCPDF Tutorial');
$pdf->setKeywords('TCPDF, PDF, example, test, guide');
// set default header data
$pdf->setHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 013', PDF_HEADER_STRING);
// set header and footer fonts
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
// set default monospaced font
$pdf->setDefaultMonospacedFont(PDF_FONT_MONOSPACED);
// set margins
$pdf->setMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$pdf->setHeaderMargin(PDF_MARGIN_HEADER);
$pdf->setFooterMargin(PDF_MARGIN_FOOTER);
// set auto page breaks
$pdf->setAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
// set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
// set some language-dependent strings (optional)
if (@file_exists(dirname(__FILE__).'/lang/eng.php')) {
require_once(dirname(__FILE__).'/lang/eng.php');
$pdf->setLanguageArray($l);
}
// ---------------------------------------------------------
// set font
$pdf->setFont('helvetica', 'B', 20);
// add a page
$pdf->AddPage();
$pdf->Write(0, 'Graphic Transformations', '', 0, 'C', 1, 0, false, false, 0);
// set font
$pdf->setFont('helvetica', '', 10);
// --- Scaling ---------------------------------------------
$pdf->setDrawColor(200);
$pdf->setTextColor(200);
$pdf->Rect(50, 70, 40, 10, 'D');
$pdf->Text(50, 66, 'Scale');
$pdf->setDrawColor(0);
$pdf->setTextColor(0);
// Start Transformation
$pdf->StartTransform();
// Scale by 150% centered by (50,80) which is the lower left corner of the rectangle
$pdf->ScaleXY(150, 50, 80);
$pdf->Rect(50, 70, 40, 10, 'D');
$pdf->Text(50, 66, 'Scale');
// Stop Transformation
$pdf->StopTransform();
// --- Translation -----------------------------------------
$pdf->setDrawColor(200);
$pdf->setTextColor(200);
$pdf->Rect(125, 70, 40, 10, 'D');
$pdf->Text(125, 66, 'Translate');
$pdf->setDrawColor(0);
$pdf->setTextColor(0);
// Start Transformation
$pdf->StartTransform();
// Translate 7 to the right, 5 to the bottom
$pdf->Translate(7, 5);
$pdf->Rect(125, 70, 40, 10, 'D');
$pdf->Text(125, 66, 'Translate');
// Stop Transformation
$pdf->StopTransform();
// --- Rotation --------------------------------------------
$pdf->setDrawColor(200);
$pdf->setTextColor(200);
$pdf->Rect(70, 100, 40, 10, 'D');
$pdf->Text(70, 96, 'Rotate');
$pdf->setDrawColor(0);
$pdf->setTextColor(0);
// Start Transformation
$pdf->StartTransform();
// Rotate 20 degrees counter-clockwise centered by (70,110) which is the lower left corner of the rectangle
$pdf->Rotate(20, 70, 110);
$pdf->Rect(70, 100, 40, 10, 'D');
$pdf->Text(70, 96, 'Rotate');
// Stop Transformation
$pdf->StopTransform();
// --- Skewing ---------------------------------------------
$pdf->setDrawColor(200);
$pdf->setTextColor(200);
$pdf->Rect(125, 100, 40, 10, 'D');
$pdf->Text(125, 96, 'Skew');
$pdf->setDrawColor(0);
$pdf->setTextColor(0);
// Start Transformation
$pdf->StartTransform();
// skew 30 degrees along the x-axis centered by (125,110) which is the lower left corner of the rectangle
$pdf->SkewX(30, 125, 110);
$pdf->Rect(125, 100, 40, 10, 'D');
$pdf->Text(125, 96, 'Skew');
// Stop Transformation
$pdf->StopTransform();
// --- Mirroring horizontally ------------------------------
$pdf->setDrawColor(200);
$pdf->setTextColor(200);
$pdf->Rect(70, 130, 40, 10, 'D');
$pdf->Text(70, 126, 'MirrorH');
$pdf->setDrawColor(0);
$pdf->setTextColor(0);
// Start Transformation
$pdf->StartTransform();
// mirror horizontally with axis of reflection at x-position 70 (left side of the rectangle)
$pdf->MirrorH(70);
$pdf->Rect(70, 130, 40, 10, 'D');
$pdf->Text(70, 126, 'MirrorH');
// Stop Transformation
$pdf->StopTransform();
// --- Mirroring vertically --------------------------------
$pdf->setDrawColor(200);
$pdf->setTextColor(200);
$pdf->Rect(125, 130, 40, 10, 'D');
$pdf->Text(125, 126, 'MirrorV');
$pdf->setDrawColor(0);
$pdf->setTextColor(0);
// Start Transformation
$pdf->StartTransform();
// mirror vertically with axis of reflection at y-position 140 (bottom side of the rectangle)
$pdf->MirrorV(140);
$pdf->Rect(125, 130, 40, 10, 'D');
$pdf->Text(125, 126, 'MirrorV');
// Stop Transformation
$pdf->StopTransform();
// --- Point reflection ------------------------------------
$pdf->setDrawColor(200);
$pdf->setTextColor(200);
$pdf->Rect(70, 160, 40, 10, 'D');
$pdf->Text(70, 156, 'MirrorP');
$pdf->setDrawColor(0);
$pdf->setTextColor(0);
// Start Transformation
$pdf->StartTransform();
// point reflection at the lower left point of rectangle
$pdf->MirrorP(70,170);
$pdf->Rect(70, 160, 40, 10, 'D');
$pdf->Text(70, 156, 'MirrorP');
// Stop Transformation
$pdf->StopTransform();
// --- Mirroring against a straigth line described by a point (120, 120) and an angle -20°
$angle=-20;
$px=120;
$py=170;
// just for visualisation: the straight line to mirror against
$pdf->setDrawColor(200);
$pdf->Line($px-1,$py-1,$px+1,$py+1);
$pdf->Line($px-1,$py+1,$px+1,$py-1);
$pdf->StartTransform();
$pdf->Rotate($angle, $px, $py);
$pdf->Line($px-5, $py, $px+60, $py);
$pdf->StopTransform();
$pdf->setDrawColor(200);
$pdf->setTextColor(200);
$pdf->Rect(125, 160, 40, 10, 'D');
$pdf->Text(125, 156, 'MirrorL');
$pdf->setDrawColor(0);
$pdf->setTextColor(0);
//Start Transformation
$pdf->StartTransform();
//mirror against the straight line
$pdf->MirrorL($angle, $px, $py);
$pdf->Rect(125, 160, 40, 10, 'D');
$pdf->Text(125, 156, 'MirrorL');
//Stop Transformation
$pdf->StopTransform();
// ---------------------------------------------------------
//Close and output PDF document
$pdf->Output('example_013.pdf', 'I');
//============================================================+
// END OF FILE
//============================================================+
+197
View File
@@ -0,0 +1,197 @@
<?php
//============================================================+
// File name : example_014.php
// Begin : 2008-03-04
// Last Update : 2013-05-14
//
// Description : Example 014 for TCPDF class
// Javascript Form and user rights (only works on Adobe Acrobat)
//
// Author: Nicola Asuni
//
// (c) Copyright:
// Nicola Asuni
// Tecnick.com LTD
// www.tecnick.com
// info@tecnick.com
//============================================================+
/**
* Creates an example PDF TEST document using TCPDF
* @package com.tecnick.tcpdf
* @abstract TCPDF - Example: Javascript Form and user rights (only works on Adobe Acrobat)
* @author Nicola Asuni
* @since 2008-03-04
* @group javascript
* @group form
* @group pdf
*/
// Include the main TCPDF library (search for installation path).
require_once('tcpdf_include.php');
// create new PDF document
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// set document information
$pdf->setCreator(PDF_CREATOR);
$pdf->setAuthor('Nicola Asuni');
$pdf->setTitle('TCPDF Example 014');
$pdf->setSubject('TCPDF Tutorial');
$pdf->setKeywords('TCPDF, PDF, example, test, guide');
// set default header data
$pdf->setHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 014', PDF_HEADER_STRING);
// set header and footer fonts
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
// set default monospaced font
$pdf->setDefaultMonospacedFont(PDF_FONT_MONOSPACED);
// set margins
$pdf->setMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$pdf->setHeaderMargin(PDF_MARGIN_HEADER);
$pdf->setFooterMargin(PDF_MARGIN_FOOTER);
// set auto page breaks
$pdf->setAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
// set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
// set some language-dependent strings (optional)
if (@file_exists(dirname(__FILE__).'/lang/eng.php')) {
require_once(dirname(__FILE__).'/lang/eng.php');
$pdf->setLanguageArray($l);
}
// ---------------------------------------------------------
// IMPORTANT: disable font subsetting to allow users editing the document
$pdf->setFontSubsetting(false);
// set font. 'helvetica' MUST be used to avoid a PHP notice from PHP 7.4+
$pdf->setFont('helvetica', '', 10, '', false);
// add a page
$pdf->AddPage();
/*
It is possible to create text fields, combo boxes, check boxes and buttons.
Fields are created at the current position and are given a name.
This name allows to manipulate them via JavaScript in order to perform some validation for instance.
*/
// set default form properties
$pdf->setFormDefaultProp(array('lineWidth'=>1, 'borderStyle'=>'solid', 'fillColor'=>array(255, 255, 200), 'strokeColor'=>array(255, 128, 128)));
$pdf->setFont('helvetica', 'BI', 18);
$pdf->Cell(0, 5, 'Example of Form', 0, 1, 'C');
$pdf->Ln(10);
$pdf->setFont('helvetica', '', 12);
// First name
$pdf->Cell(35, 5, 'First name:');
$pdf->TextField('firstname', 50, 5);
$pdf->Ln(6);
// Last name
$pdf->Cell(35, 5, 'Last name:');
$pdf->TextField('lastname', 50, 5);
$pdf->Ln(6);
// Gender
$pdf->Cell(35, 5, 'Gender:');
$pdf->ComboBox('gender', 30, 5, array(array('', '-'), array('M', 'Male'), array('F', 'Female')));
$pdf->Ln(6);
// Drink
$pdf->Cell(35, 5, 'Drink:');
//$pdf->RadioButton('drink', 5, array('readonly' => 'true'), array(), 'Water');
$pdf->RadioButton('drink', 5, array(), array(), 'Water');
$pdf->Cell(35, 5, 'Water');
$pdf->Ln(6);
$pdf->Cell(35, 5, '');
$pdf->RadioButton('drink', 5, array(), array(), 'Beer', true);
$pdf->Cell(35, 5, 'Beer');
$pdf->Ln(6);
$pdf->Cell(35, 5, '');
$pdf->RadioButton('drink', 5, array(), array(), 'Wine');
$pdf->Cell(35, 5, 'Wine');
$pdf->Ln(6);
$pdf->Cell(35, 5, '');
$pdf->RadioButton('drink', 5, array(), array(), 'Milk');
$pdf->Cell(35, 5, 'Milk');
$pdf->Ln(10);
// Newsletter
$pdf->Cell(35, 5, 'Newsletter:');
$pdf->CheckBox('newsletter', 5, true, array(), array(), 'OK');
$pdf->Ln(10);
// Address
$pdf->Cell(35, 5, 'Address:');
$pdf->TextField('address', 60, 18, array('multiline'=>true, 'lineWidth'=>0, 'borderStyle'=>'none'), array('v'=>'Lorem ipsum dolor sit amet, consectetur adipiscing elit.', 'dv'=>'Lorem ipsum dolor sit amet, consectetur adipiscing elit.'));
$pdf->Ln(19);
// Listbox
$pdf->Cell(35, 5, 'List:');
$pdf->ListBox('listbox', 60, 15, array('', 'item1', 'item2', 'item3', 'item4', 'item5', 'item6', 'item7'), array('multipleSelection'=>'true'));
$pdf->Ln(20);
// E-mail
$pdf->Cell(35, 5, 'E-mail:');
$pdf->TextField('email', 50, 5);
$pdf->Ln(6);
// Date of the day
$pdf->Cell(35, 5, 'Date:');
$pdf->TextField('date', 30, 5, array(), array('v'=>date('Y-m-d'), 'dv'=>date('Y-m-d')));
$pdf->Ln(10);
$pdf->setX(50);
// Button to validate and print
$pdf->Button('print', 30, 10, 'Print', 'Print()', array('lineWidth'=>2, 'borderStyle'=>'beveled', 'fillColor'=>array(128, 196, 255), 'strokeColor'=>array(64, 64, 64)));
// Reset Button
$pdf->Button('reset', 30, 10, 'Reset', array('S'=>'ResetForm'), array('lineWidth'=>2, 'borderStyle'=>'beveled', 'fillColor'=>array(128, 196, 255), 'strokeColor'=>array(64, 64, 64)));
// Submit Button
$pdf->Button('submit', 30, 10, 'Submit', array('S'=>'SubmitForm', 'F'=>'http://localhost/printvars.php', 'Flags'=>array('ExportFormat')), array('lineWidth'=>2, 'borderStyle'=>'beveled', 'fillColor'=>array(128, 196, 255), 'strokeColor'=>array(64, 64, 64)));
// Form validation functions
$js = <<<EOD
function CheckField(name,message) {
var f = getField(name);
if(f.value == '') {
app.alert(message);
f.setFocus();
return false;
}
return true;
}
function Print() {
if(!CheckField('firstname','First name is mandatory')) {return;}
if(!CheckField('lastname','Last name is mandatory')) {return;}
if(!CheckField('gender','Gender is mandatory')) {return;}
if(!CheckField('address','Address is mandatory')) {return;}
print();
}
EOD;
// Add Javascript code
$pdf->IncludeJS($js);
// ---------------------------------------------------------
//Close and output PDF document
$pdf->Output('example_014.pdf', 'D');
//============================================================+
// END OF FILE
//============================================================+
+164
View File
@@ -0,0 +1,164 @@
<?php
//============================================================+
// File name : example_015.php
// Begin : 2008-03-04
// Last Update : 2013-05-14
//
// Description : Example 015 for TCPDF class
// Bookmarks (Table of Content)
// and Named Destinations.
//
// Author: Nicola Asuni
//
// (c) Copyright:
// Nicola Asuni
// Tecnick.com LTD
// www.tecnick.com
// info@tecnick.com
//============================================================+
/**
* Creates an example PDF TEST document using TCPDF
* @package com.tecnick.tcpdf
* @abstract TCPDF - Example: Bookmarks (Table of Content)
* @author Nicola Asuni
* @since 2008-03-04
* @group toc
* @group bookmark
* @group pdf
*/
// Include the main TCPDF library (search for installation path).
require_once('tcpdf_include.php');
// create new PDF document
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// set document information
$pdf->setCreator(PDF_CREATOR);
$pdf->setAuthor('Nicola Asuni');
$pdf->setTitle('TCPDF Example 015');
$pdf->setSubject('TCPDF Tutorial');
$pdf->setKeywords('TCPDF, PDF, example, test, guide');
// set default header data
$pdf->setHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 015', PDF_HEADER_STRING);
// set header and footer fonts
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
// set default monospaced font
$pdf->setDefaultMonospacedFont(PDF_FONT_MONOSPACED);
// set margins
$pdf->setMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$pdf->setHeaderMargin(PDF_MARGIN_HEADER);
$pdf->setFooterMargin(PDF_MARGIN_FOOTER);
// set auto page breaks
$pdf->setAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
// set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
// set some language-dependent strings (optional)
if (@file_exists(dirname(__FILE__).'/lang/eng.php')) {
require_once(dirname(__FILE__).'/lang/eng.php');
$pdf->setLanguageArray($l);
}
// ---------------------------------------------------------
// Bookmark($txt, $level=0, $y=-1, $page='', $style='', $color=array(0,0,0))
// set font
$pdf->setFont('times', 'B', 20);
// add a page
$pdf->AddPage();
// set a bookmark for the current position
$pdf->Bookmark('Chapter 1', 0, 0, '', 'B', array(0,64,128));
// print a line using Cell()
$pdf->Cell(0, 10, 'Chapter 1', 0, 1, 'L');
$pdf->setFont('times', 'I', 14);
$pdf->Write(0, 'You can set PDF Bookmarks using the Bookmark() method.
You can set PDF Named Destinations using the setDestination() method.');
$pdf->setFont('times', 'B', 20);
// add other pages and bookmarks
$pdf->AddPage();
$pdf->Bookmark('Paragraph 1.1', 1, 0, '', '', array(0,0,0));
$pdf->Cell(0, 10, 'Paragraph 1.1', 0, 1, 'L');
$pdf->AddPage();
$pdf->Bookmark('Paragraph 1.2', 1, 0, '', '', array(0,0,0));
$pdf->Cell(0, 10, 'Paragraph 1.2', 0, 1, 'L');
$pdf->AddPage();
$pdf->Bookmark('Sub-Paragraph 1.2.1', 2, 0, '', 'I', array(0,0,0));
$pdf->Cell(0, 10, 'Sub-Paragraph 1.2.1', 0, 1, 'L');
$pdf->AddPage();
$pdf->Bookmark('Paragraph 1.3', 1, 0, '', '', array(0,0,0));
$pdf->Cell(0, 10, 'Paragraph 1.3', 0, 1, 'L');
$pdf->AddPage();
// add a named destination so you can open this document at this page using the link: "example_015.pdf#chapter2"
$pdf->setDestination('chapter2', 0, '');
// add a bookmark that points to a named destination
$pdf->Bookmark('Chapter 2', 0, 0, '', 'BI', array(128,0,0), -1, '#chapter2');
$pdf->Cell(0, 10, 'Chapter 2', 0, 1, 'L');
$pdf->setFont('times', 'I', 14);
$pdf->Write(0, 'Once saved, you can open this document at this page using the link: "example_015.pdf#chapter2".');
$pdf->AddPage();
$pdf->setDestination('chapter3', 0, '');
$pdf->setFont('times', 'B', 20);
$pdf->Bookmark('Chapter 3', 0, 0, '', 'B', array(0,64,128));
$pdf->Cell(0, 10, 'Chapter 3', 0, 1, 'L');
$pdf->AddPage();
$pdf->setDestination('chapter4', 0, '');
$pdf->setFont('times', 'B', 20);
$pdf->Bookmark('Chapter 4', 0, 0, '', 'B', array(0,64,128));
$pdf->Cell(0, 10, 'Chapter 4', 0, 1, 'L');
$pdf->AddPage();
$pdf->Bookmark('Chapter 5', 0, 0, '', 'B', array(0,128,0));
$pdf->Cell(0, 10, 'Chapter 5', 0, 1, 'L');
$txt = 'Example of File Attachment.
Double click on the icon to open the attached file.';
$pdf->setFont('helvetica', '', 10);
$pdf->Write(0, $txt, '', 0, 'L', true, 0, false, false, 0);
// attach an external file TXT file
$pdf->Annotation(20, 50, 5, 5, 'TXT file', array('Subtype'=>'FileAttachment', 'Name' => 'PushPin', 'FS' => 'data/utf8test.txt'));
// attach an external file
$pdf->Annotation(50, 50, 5, 5, 'PDF file', array('Subtype'=>'FileAttachment', 'Name' => 'PushPin', 'FS' => 'example_012.pdf'));
// add a bookmark that points to an embedded file
// NOTE: prefix the file name with the * character for generic file and with % character for PDF file
$pdf->Bookmark('TXT file', 0, 0, '', 'B', array(128,0,255), -1, '*utf8test.txt');
// add a bookmark that points to an embedded file
// NOTE: prefix the file name with the * character for generic file and with % character for PDF file
$pdf->Bookmark('PDF file', 0, 0, '', 'B', array(128,0,255), -1, '%example_012.pdf');
// add a bookmark that points to an external URL
$pdf->Bookmark('External URL', 0, 0, '', 'B', array(0,0,255), -1, 'http://www.tcpdf.org');
// ---------------------------------------------------------
//Close and output PDF document
$pdf->Output('example_015.pdf', 'D');
//============================================================+
// END OF FILE
//============================================================+
+136
View File
@@ -0,0 +1,136 @@
<?php
//============================================================+
// File name : example_016.php
// Begin : 2008-03-04
// Last Update : 2013-05-14
//
// Description : Example 016 for TCPDF class
// Document Encryption / Security
//
// Author: Nicola Asuni
//
// (c) Copyright:
// Nicola Asuni
// Tecnick.com LTD
// www.tecnick.com
// info@tecnick.com
//============================================================+
/**
* Creates an example PDF TEST document using TCPDF
* @package com.tecnick.tcpdf
* @abstract TCPDF - Example: Document Encryption / Security
* @author Nicola Asuni
* @since 2008-03-04
* @group security
* @group pdf
*/
// Include the main TCPDF library (search for installation path).
require_once('tcpdf_include.php');
// create new PDF document
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// *** Set PDF protection (encryption) *********************
/*
The permission array is composed of values taken from the following ones (specify the ones you want to block):
- print : Print the document;
- modify : Modify the contents of the document by operations other than those controlled by 'fill-forms', 'extract' and 'assemble';
- copy : Copy or otherwise extract text and graphics from the document;
- annot-forms : Add or modify text annotations, fill in interactive form fields, and, if 'modify' is also set, create or modify interactive form fields (including signature fields);
- fill-forms : Fill in existing interactive form fields (including signature fields), even if 'annot-forms' is not specified;
- extract : Extract text and graphics (in support of accessibility to users with disabilities or for other purposes);
- assemble : Assemble the document (insert, rotate, or delete pages and create bookmarks or thumbnail images), even if 'modify' is not set;
- print-high : Print the document to a representation from which a faithful digital copy of the PDF content could be generated. When this is not set, printing is limited to a low-level representation of the appearance, possibly of degraded quality.
- owner : (inverted logic - only for public-key) when set permits change of encryption and enables all other permissions.
If you don't set any password, the document will open as usual.
If you set a user password, the PDF viewer will ask for it before displaying the document.
The master (owner) password, if different from the user one, can be used to get full document access.
Possible encryption modes are:
0 = RSA 40 bit
1 = RSA 128 bit
2 = AES 128 bit
3 = AES 256 bit
NOTES:
- To create self-signed signature: openssl req -x509 -nodes -days 365000 -newkey rsa:1024 -keyout tcpdf.crt -out tcpdf.crt
- To export crt to p12: openssl pkcs12 -export -in tcpdf.crt -out tcpdf.p12
- To convert pfx certificate to pem: openssl pkcs12 -in tcpdf.pfx -out tcpdf.crt -nodes
*/
$pdf->setProtection(array('print', 'copy'), '', null, 0, null);
// Example with public-key
// To open the document you need to install the private key (tcpdf.p12) on the Acrobat Reader. The password is: 1234
//$pdf->setProtection($permissions=array('print', 'copy'), $user_pass='', $owner_pass=null, $mode=1, $pubkeys=array(array('c' => 'file://../config/cert/tcpdf.crt', 'p' => array('print'))));
// *********************************************************
// set document information
$pdf->setCreator(PDF_CREATOR);
$pdf->setAuthor('Nicola Asuni');
$pdf->setTitle('TCPDF Example 016');
$pdf->setSubject('TCPDF Tutorial');
$pdf->setKeywords('TCPDF, PDF, example, test, guide');
// set default header data
$pdf->setHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 016', PDF_HEADER_STRING);
// set header and footer fonts
$pdf->setHeaderFont(Array('helvetica', '', PDF_FONT_SIZE_MAIN));
$pdf->setFooterFont(Array('helvetica', '', PDF_FONT_SIZE_DATA));
// set default monospaced font
$pdf->setDefaultMonospacedFont(PDF_FONT_MONOSPACED);
// set margins
$pdf->setMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$pdf->setHeaderMargin(PDF_MARGIN_HEADER);
$pdf->setFooterMargin(PDF_MARGIN_FOOTER);
// set auto page breaks
$pdf->setAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
// set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
// set some language-dependent strings (optional)
if (@file_exists(dirname(__FILE__).'/lang/eng.php')) {
require_once(dirname(__FILE__).'/lang/eng.php');
$pdf->setLanguageArray($l);
}
// ---------------------------------------------------------
// set font
$pdf->setFont('times', '', 16);
// add a page
$pdf->AddPage();
// set some text to print
$txt = <<<EOD
Encryption Example
Consult the source code documentation for the SetProtection() method.
EOD;
// print a block of text using Write()
$pdf->Write(0, $txt, '', 0, 'L', true, 0, false, false, 0);
// ---------------------------------------------------------
//Close and output PDF document
$pdf->Output('example_016.pdf', 'D');
//============================================================+
// END OF FILE
//============================================================+
+120
View File
@@ -0,0 +1,120 @@
<?php
//============================================================+
// File name : example_017.php
// Begin : 2008-03-04
// Last Update : 2013-05-14
//
// Description : Example 017 for TCPDF class
// Two independent columns with MultiCell
//
// Author: Nicola Asuni
//
// (c) Copyright:
// Nicola Asuni
// Tecnick.com LTD
// www.tecnick.com
// info@tecnick.com
//============================================================+
/**
* Creates an example PDF TEST document using TCPDF
* @package com.tecnick.tcpdf
* @abstract TCPDF - Example: Two independent columns with MultiCell
* @author Nicola Asuni
* @since 2008-03-04
* @group column
* @group cell
* @group pdf
*/
// Include the main TCPDF library (search for installation path).
require_once('tcpdf_include.php');
// create new PDF document
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// set document information
$pdf->setCreator(PDF_CREATOR);
$pdf->setAuthor('Nicola Asuni');
$pdf->setTitle('TCPDF Example 017');
$pdf->setSubject('TCPDF Tutorial');
$pdf->setKeywords('TCPDF, PDF, example, test, guide');
// set default header data
$pdf->setHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 017', PDF_HEADER_STRING);
// set header and footer fonts
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
// set default monospaced font
$pdf->setDefaultMonospacedFont(PDF_FONT_MONOSPACED);
// set margins
$pdf->setMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$pdf->setHeaderMargin(PDF_MARGIN_HEADER);
$pdf->setFooterMargin(PDF_MARGIN_FOOTER);
// set auto page breaks
$pdf->setAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
// set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
// set some language-dependent strings (optional)
if (@file_exists(dirname(__FILE__).'/lang/eng.php')) {
require_once(dirname(__FILE__).'/lang/eng.php');
$pdf->setLanguageArray($l);
}
// ---------------------------------------------------------
// set font
$pdf->setFont('helvetica', '', 20);
// add a page
$pdf->AddPage();
$pdf->Write(0, 'Example of independent Multicell() columns', '', 0, 'L', true, 0, false, false, 0);
$pdf->Ln(5);
$pdf->setFont('times', '', 12);
// create columns content
// create columns content
$left_column = '[LEFT COLUMN] left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column'."\n";
$right_column = '[RIGHT COLUMN] right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column'."\n";
// MultiCell($w, $h, $txt, $border=0, $align='J', $fill=0, $ln=1, $x='', $y='', $reseth=true, $stretch=0, $ishtml=false, $autopadding=true, $maxh=0)
// set color for background
$pdf->setFillColor(255, 255, 200);
// set color for text
$pdf->setTextColor(0, 63, 127);
// write the first column
$pdf->MultiCell(80, 0, $left_column, 1, 'J', 1, 0, '', '', true, 0, false, true, 0);
// set color for background
$pdf->setFillColor(215, 235, 255);
// set color for text
$pdf->setTextColor(127, 31, 0);
// write the second column
$pdf->MultiCell(80, 0, $right_column, 1, 'J', 1, 1, '', '', true, 0, false, true, 0);
// reset pointer to the last page
$pdf->lastPage();
// ---------------------------------------------------------
//Close and output PDF document
$pdf->Output('example_017.pdf', 'I');
//============================================================+
// END OF FILE
//============================================================+
Loaded 100 of 425 files, more files were not shown because too many files have changed in this diff. Show more