Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/corpentunida-org/corpen/llms.txt

Use this file to discover all available pages before exploring further.

Corpen generates downloadable PDF reports across more than a dozen modules — exequial service records, five-percent accounting statements, insurance claims, correspondence history, workflow audits, indicators dashboards, and more. All PDFs are produced by the barryvdh/laravel-dompdf ^2.2 package, which renders a Blade view to a PDF byte stream that is either downloaded directly to the user’s browser or stored on S3 before downloading.

Installed Package

"barryvdh/laravel-dompdf": "^2.2"
The package registers the Barryvdh\DomPDF\Facade\Pdf facade (aliased as Pdf) automatically via Laravel’s package discovery. The full configuration is published to config/dompdf.php.

Default DomPDF Configuration

Corpen ships with the following defaults in config/dompdf.php:
OptionValue
default_paper_sizea4
default_paper_orientationportrait
default_fontserif
dpi96
pdf_backendCPDF
enable_remotetrue (allows loading external images)
enable_phpfalse
font_dir / font_cachestorage/fonts/
Custom fontCorinthia-Regular.ttf (signature rendering)
Individual controller actions override the paper size and orientation by calling ->setPaper('letter', 'landscape') on the Pdf instance. You can also pass 'A4' and 'portrait' for standard portrait reports. These per-request overrides take precedence over the config/dompdf.php defaults.

How DomPDF Works in Corpen

Every PDF generation method follows the same three-line pattern:
use Barryvdh\DomPDF\Facade\Pdf;

$pdf = Pdf::loadView('blade.view.path', $data)
           ->setPaper('letter', 'landscape');

return $pdf->download('filename.pdf');
// — or —
return $pdf->stream('filename.pdf'); // open in browser tab instead of downloading
Pdf::loadView() renders the Blade template with the supplied data array, converting the resulting HTML to a PDF byte stream. ->download() sends a Content-Disposition: attachment response; ->stream() sends Content-Disposition: inline so the browser displays the PDF in a new tab. For reports that must also be archived, the ->output() method returns the raw PDF bytes for storage:
// Indicators module: save to S3, then also send as download
Storage::disk('s3')->put('corpentunida/indicators/' . $fileName, $pdf->output());
return $pdf->download('informe_indicadores.pdf');

PDF Endpoints

RouteHTTPController methodDescription
GET /exequial/asociados/{id}/generarpdf/{active}GETComaeExCliController::generarpdfExequial client coverage sheet (portrait or landscape depending on $active)
GET /exequial/prestarServicio/generarpdfGETMaeC_ExSerController::generarpdfFull exequial monitoring report — all records, letter landscape
GET /exequial/prestarServicio/{id}/generarpdfGETMaeC_ExSerController::reporteIndividualIndividual exequial service record, letter landscape
GET /movcontables/{id}/reportepdf/GETMoviContCincoController::generarpdfFive-percent accounting movements per associate, letter landscape
GET /condicionRetiros/{id}/reportepdf/GETCondicionesRetirosController::generarpdfRetirement liquidation sheet (currently renders as web view for review)
GET /comunicaciones-salida/{id}/descargar-pdfGETComunicacionSalidaController::descargarPdfOutgoing correspondence letter with S3 signature image embedded as Base64
POST /indicators/generar/informePOSTIndicadoresController::descargarInformeIndicators dashboard report — saved to S3 and logged before download
POST /seguros/reclamacion/generarpdfPOSTSegReclamacionesController::generarpdfInsurance claim PDF

Sample PDF Generation Methods

The examples below are taken directly from the Corpen source.
use Barryvdh\DomPDF\Facade\Pdf;

public function generarpdf()
{
    $registros = ExMonitoria::orderBy('id', 'desc')->get();

    // Resolve parentesco labels before passing to view
    $controllerparentesco = app()->make(ParentescosController::class);
    foreach ($registros as $registro) {
        $registro->parentesco = $controllerparentesco->showName($registro->parentesco);
    }

    $pdf = Pdf::loadView('exequial.prestarServicio.indexpdf', [
        'registros'   => $registros,
        'image_path'  => public_path('assets/images/CORPENTUNIDA_LOGO PRINCIPAL  (2).png'),
    ])->setPaper('letter', 'landscape');

    return $pdf->download(date('Y-m-d') . ' Reporte.pdf');
}

Blade Views for PDFs

PDF templates live in resources/views/ using the same dot-notation as any other Blade view. The naming convention used across Corpen is to append pdf or pdf.blade.php to the view directory:
Blade view pathModule
exequial/prestarServicio/indexpdf.blade.phpExequial monitoring
exequial/asociados/showpdf.blade.phpExequial client — portrait
exequial/asociados/showpdf2.blade.phpExequial client — landscape
cinco/movcontables/reportepdf.blade.phpFive-percent accounting
cinco/retiros/liquidacionpdf.blade.phpRetirement liquidation
correspondencia/comunicaciones_salida/pdf.blade.phpCorrespondence letter
correspondencia/correspondencias/historial_pdf.blade.phpCorrespondence history
correspondencia/tablero/pdf.blade.phpCorrespondence dashboard
cartera/morosospdf.blade.phpPortfolio delinquency
indicators/informepdf.blade.phpIndicators dashboard
interactions/reportes/pdf.blade.phpInteraction audit
inventario/activos/pdf.blade.phpAsset inventory
inventario/compras/pdf.blade.phpPurchase invoice
inventario/movimientos/pdf.blade.phpInventory movement
flujo/auditoria/pdf.blade.phpWorkflow audit
flujo/workflows/pdf.blade.phpWorkflow report
seguros/reclamaciones/pdf.blade.phpInsurance claims
reserva/dashboard/pdf.blade.phpReservation dashboard
DomPDF renders HTML/CSS to PDF without a browser rendering engine, so only a subset of CSS is supported. All PDF Blade views in Corpen use inline CSS (style="...") or <style> blocks inside the document — external stylesheets loaded via <link> are not reliably applied. Background images and signature images must be passed as Base64-encoded data URIs (see the descargarPdf correspondence example above).

Custom Font: Corinthia

The config/dompdf.php registers the Corinthia script font for signature rendering:
'font_metrics' => [
    'Corinthia' => [
        'normal' => storage_path('fonts/Corinthia-Regular.ttf'),
    ],
],
Place Corinthia-Regular.ttf in storage/fonts/ and the font will be available in any PDF Blade view via font-family: Corinthia;.

Generating PDFs from Artisan (Debugging)

To verify a PDF template renders correctly without hitting an HTTP route, call the controller directly from Tinker:
php artisan tinker
$ctrl = app(\App\Http\Controllers\Exequial\MaeC_ExSerController::class);
$response = $ctrl->generarpdf();
file_put_contents('/tmp/test.pdf', $response->getContent());
Open /tmp/test.pdf locally to inspect layout before deploying.

Build docs developers (and LLMs) love