insight's avatar

How to convert csv,xlsx,png,jpg,jpeg.txt files to pdf ?

Dear Friends, As a part of a requirement I need to accept all types of files (CSV,xlsx,txt,doc,docx,png,jpg) and need to upload and save in PDF format. There is any library available in Laravel for same...

Waiting your fast reply

Thanks

Anes

0 likes
10 replies
insight's avatar

Dear Friends

@NOMGUY : You told about a chrome extension , I mean a Laravel mechanism to convert an uploaded file in image or txt format to PDF . So it's not relevant for me sorry.

@knubbe82 : You told about HTML to PDF conversion. I mean a Laravel mechanism to convert an uploaded file in image or txt format to PDF by automate it on upload . There is any mechanism for it ?

@komalbhatt : You also mention about html to pdf .

any new options friends ?

Anes

insight's avatar

Dear @LearnHunter , (You make my requirement opposite lol!)

I got my exact requirement using PHP FPDF method by using

require('fpdf.php');

$image = 'webcam-toy-photo3.jpg';
$withoutExt = preg_replace('/\.[^.\s]{3,4}$/', '', $image);
$pdfName = $withoutExt.".pdf";
$pdf = new FPDF();
$pdf->AddPage();
$pdf->Image($image,20,40,170);
$pdf->Output(F,$pdfName);

But my Concern now is how to convert "txt" file to "PDF". Any body please suggest a method

Thanks

Anes

insight's avatar

Dear @ReneeLRoberts73 ,

I am looking a coding solution dear. Please provide an answer in that way ... Hope it's good for another type of questions that may faced in life interviews lol!!

Thanks Anes

Davids's avatar

You can drop the txt file to a view and then use dompdf

Please or to participate in this conversation.