public function testDefaultOptionsWithJPG() { $watermark_jpg = new PDFWatermark($this->_assets_directory . 'star.jpg'); $watermarker_jpg = new PDFWatermarker($this->_assets_directory . 'test.pdf', $this->output, $watermark_jpg); $watermarker_jpg->savePdf(); $this->assertTrue(file_exists($this->output) === true); $this->assertTrue(filesize($this->_assets_directory . 'output-from-jpg.pdf') === filesize($this->output)); }
$output = array('success' => false, 'error' => $e->getMessage()); } $url = 'https://dsv.sgdoc.sisicmbio.icmbio.gov.br/webservices/migracao/checksum.php?digital=' . $_REQUEST['digital'] . '&checksum=' . $output['checksum']; //json_encode($output); $qr = new QR(); //set it to writable location, a place for temp generated PNG files $PNG_TEMP_DIR = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'temp' . DIRECTORY_SEPARATOR; //html PNG location prefix $PNG_WEB_DIR = 'temp/'; include "phpqrcode/qrlib.php"; //ofcourse we need rights to create temp dir if (!file_exists($PNG_TEMP_DIR)) { mkdir($PNG_TEMP_DIR); } $filename = $PNG_TEMP_DIR . '/' . $_REQUEST['digital'] . '.png'; $errorCorrectionLevel = 'L'; $matrixPointSize = 1; QRcode::png($url, $filename, $errorCorrectionLevel, $matrixPointSize, 2); exit; include 'pdf-watermarker-master/pdfwatermarker/pdfwatermark.php'; include 'pdf-watermarker-master/pdfwatermarker/pdfwatermarker.php'; include 'pdf-watermarker-master/fpdf/fpdf.php'; include 'pdf-watermarker-master/fpdi/fpdi.php'; //Specify path to image $watermark = new PDFWatermark('/var/www/html/sgdoc/webservices/migracao/temp/' . $_REQUEST['digital'] . '.png'); //Specify the path to the existing pdf, the path to the new pdf file, and the watermark object $watermarker = new PDFWatermarker($output['path'], $output['path'] . '-marked.pdf', $watermark); //Set the position $watermarker->setWatermarkPosition('buttomright'); //Save the new PDF to its specified location $watermarker->watermarkPdf();
<?php include 'pdf-watermarker-master/pdfwatermarker/pdfwatermark.php'; include 'pdf-watermarker-master/pdfwatermarker/pdfwatermarker.php'; include 'pdf-watermarker-master/fpdf/fpdf.php'; include 'pdf-watermarker-master/fpdi/fpdi.php'; //Specify path to image $watermark = new PDFWatermark('/var/www/html/sgdoc/webservices/migracao/temp/' . $_REQUEST['digital'] . '.png'); //Specify the path to the existing pdf, the path to the new pdf file, and the watermark object $watermarker = new PDFWatermarker('/var/www/html/sgdoc/cache/import/LOTE2/0028233.pdf', '/var/www/html/sgdoc/cache/import/LOTE2/0028233-marked.pdf', $watermark); //Set the position $watermarker->setWatermarkPosition('topright'); //Save the new PDF to its specified location $watermarker->watermarkPdf();