rajaramprobytes Posted June 15, 2017 Share Posted June 15, 2017 Hi My client asking for product attachment "custom PDF " Every time upload the pdf for product in attachment .... that time automatically header and footer page added in dynamically in pdf. I have PHP code but i can't able to implement this in AdminAttachmentsController.php Please help me It's PHP Code ----------------------------------- <?php require_once('FPDF/fpdf.php'); require_once('FPDI/fpdi.php'); // define some files to concatenate $files = array( 'header.pdf', 'innerpage.pdf', 'footer.pdf' ); // initiate FPDI $pdf = new FPDI(); // iterate through the files foreach ($files AS $file) { // get the page count $pageCount = $pdf->setSourceFile($file); // iterate through all pages for ($pageNo = 1; $pageNo <= $pageCount; $pageNo++) { // import a page $templateId = $pdf->importPage($pageNo); // get the size of the imported page $size = $pdf->getTemplateSize($templateId); // create a page (landscape or portrait depending on the imported page size) if ($size['w'] > $size['h']) { $pdf->AddPage('L', array($size['w'], $size['h'])); } else { $pdf->AddPage('P', array($size['w'], $size['h'])); } // use the imported page $pdf->useTemplate($templateId); $pdf->SetFont('Helvetica'); $pdf->SetXY(5, 5); $pdf->Write(8, 'Its developed by rajaram'); } } // Output the new PDF //$pdf->Output(); $pdf->Output("sampleUpdated.pdf", 'F'); Link to comment Share on other sites More sharing options...
tuk66 Posted June 21, 2017 Share Posted June 21, 2017 Is that product attachment a product catalog page? I mean is it related to every single product? If yes, the M4 PDF Extensions module prints product pages in the Front Office. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now