<?php $invoiceId = $_GET['invoiceId']; $format = $_GET['format']; $filePath = __DIR__ . '/../modules/basic/upload/boletos/boleto-' . $invoiceId . '.' . $format; if ( file_exists($filePath) ) { $boleto = file_get_contents($filePath); if ( $format == 'pdf' ) { header('Content-Type: application/pdf'); } echo $boleto; exit; }