İlk temizlik tamamlandı bir önceki projeden

This commit is contained in:
Ümit Tunç
2026-04-28 21:14:25 +03:00
commit f80443aec0
10000 changed files with 959965 additions and 0 deletions
+38
View File
@@ -0,0 +1,38 @@
<?php
use Barryvdh\DomPDF\Facade\Pdf;
function file_force_contents( $fullPath, $contents, $flags = 0 ){
$parts = explode( '/', $fullPath );
array_pop( $parts );
$dir = implode( '/', $parts );
if( !is_dir( $dir ) )
mkdir( $dir, 0777, true );
file_put_contents( $fullPath, $contents, $flags );
}
function pdf_create($path, $html)
{
$pdf = App::make('dompdf.wrapper');
$pdf->setPaper('A4',$j['paper']);
$pdf->setOption(['dpi' => $j['dpi'], ]);
$pdf->loadHTML($html);
$path = "$path.pdf";
Storage::delete($path);
Storage::put($path, $pdf->output());
}
function html_create($path, $html, $paper="portrait")
{
$path = "$path.html";
Storage::delete($path);
Storage::put($path, $html);
$htmlPath = "storage/documents/" . $path;
$pdfPath = str_replace(".html", ".pdf", $htmlPath);
html_to_pdf($htmlPath, $pdfPath, $paper);
unlink($htmlPath);
} ?>