lional Posted March 24, 2007 Share Posted March 24, 2007 Hi All Anyone please help I am trying to save pdf documents to the server. I would prefer that it is not shown to the user. What I am trying to achieve is to create a pdf, save it to the server, and then email it as an attachment Is this possible, and if so How is it done? Any help will be appreciated Thanks Lional Quote Link to comment https://forums.phpfreaks.com/topic/44089-saving-pdf-files-to-the-server/ Share on other sites More sharing options...
MadTechie Posted March 24, 2007 Share Posted March 24, 2007 how are you creating the PDF is the main question.. yes its possible but route depends on how you are creating the PDF, worst case i guess you could just us ob_flush Quote Link to comment https://forums.phpfreaks.com/topic/44089-saving-pdf-files-to-the-server/#findComment-214071 Share on other sites More sharing options...
lional Posted March 24, 2007 Author Share Posted March 24, 2007 This is my demo code require 'PDF.php'; // Require the class. $pdf = &PDF::factory('l', 'a4'); // Set up the pdf object. $pdf->open(); // Start the document. $pdf->setCompression(true); // Activate compression. $pdf->addPage(); // Start a page. $pdf->setFont('Arial', '', 36); // Set font to courier 8 pt. $pdf->text(25, 50, 'Supreme Grand Royal Arch Chapter of Scotland'); // Text at x=100 and y=100. //$pdf->setFontSize(20); // Set font size to 20 pt. //$pdf->setFillColor('rgb', 1, 0, 0); // Set text color to red. //$pdf->line(200, 100, 200, 100); // Draw a line. $pdf->setFont('Arial', '', 12); // Set font to courier 8 pt. $pdf->text(250, 100, 'DEGREE OF INSTALLED MASTER IN THE MARK DEGREE'); // Text at x=100 and y=100. $pdf->setFont('Arial', '', 24); // Set font to courier 8 pt. $pdf->text(275, 130, 'Certificate of Innstallation'); // Text at x=100 and y=100. //$pdf->setDrawColor('rgb', 0, 0, 1); // Set draw color to blue. //$pdf->setFillColor('rgb', 1, 1, 0); // Set fill/text to yellow. //$pdf->rect(200, 300, 100, 100, 'fd'); // Draw a filled rectangle. //$pdf->addPage(); // Add a new page. $pdf->setFont('Arial', 'BI', 12); // Set font to arial bold //$pdf->text(100, 100, 'Second page'); // Text at x=100 and y=100. //$pdf->image('sample.jpg', 400, 100); // Image at x=50 and y=200. //$pdf->setLineWidth(4); // Set line width to 4 pt. //$pdf->circle(200, 300, 150, 'd'); // Draw a non-filled $pdf->output('foo.pdf'); // Output the file named foo.pdf // Upload file to server $filename = 'foo.pdf'; // Move the file over. if (move_uploaded_file($_FILES['foo.pdf'], "uploads/$filename")) { echo '<p>The file has been uploaded!</p>'; } else { echo '<p><font color="red">The file could not be moved.</font></p>'; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/44089-saving-pdf-files-to-the-server/#findComment-214074 Share on other sites More sharing options...
MadTechie Posted March 24, 2007 Share Posted March 24, 2007 What about doing this instead, creatre in the location instead of moving it.. require 'PDF.php'; // Require the class. $filename = 'foo.pdf'; $fullpath = "uploads/".$filename; $pdf = &PDF::factory('l', 'a4'); // Set up the pdf object. $pdf->open(); // Start the document. $pdf->setCompression(true); // Activate compression. $pdf->addPage(); // Start a page. $pdf->setFont('Arial', '', 36); // Set font to courier 8 pt. $pdf->text(25, 50, 'Supreme Grand Royal Arch Chapter of Scotland'); // Text at x=100 and y=100. //$pdf->setFontSize(20); // Set font size to 20 pt. //$pdf->setFillColor('rgb', 1, 0, 0); // Set text color to red. //$pdf->line(200, 100, 200, 100); // Draw a line. $pdf->setFont('Arial', '', 12); // Set font to courier 8 pt. $pdf->text(250, 100, 'DEGREE OF INSTALLED MASTER IN THE MARK DEGREE'); // Text at x=100 and y=100. $pdf->setFont('Arial', '', 24); // Set font to courier 8 pt. $pdf->text(275, 130, 'Certificate of Innstallation'); // Text at x=100 and y=100. //$pdf->setDrawColor('rgb', 0, 0, 1); // Set draw color to blue. //$pdf->setFillColor('rgb', 1, 1, 0); // Set fill/text to yellow. //$pdf->rect(200, 300, 100, 100, 'fd'); // Draw a filled rectangle. //$pdf->addPage(); // Add a new page. $pdf->setFont('Arial', 'BI', 12); // Set font to arial bold //$pdf->text(100, 100, 'Second page'); // Text at x=100 and y=100. //$pdf->image('sample.jpg', 400, 100); // Image at x=50 and y=200. //$pdf->setLineWidth(4); // Set line width to 4 pt. //$pdf->circle(200, 300, 150, 'd'); // Draw a non-filled $pdf->output($fullpath); // Output the file named foo.pdf ?> Quote Link to comment https://forums.phpfreaks.com/topic/44089-saving-pdf-files-to-the-server/#findComment-214412 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.