作者 刘锟

update

@@ -36,14 +36,26 @@ protected function error($message = 'error', $status = 400, $data = []) @@ -36,14 +36,26 @@ protected function error($message = 'error', $status = 400, $data = [])
36 return json_encode($array, JSON_UNESCAPED_UNICODE); 36 return json_encode($array, JSON_UNESCAPED_UNICODE);
37 } 37 }
38 38
  39 + /**
  40 + * pdf文件添加二维码
  41 + * @param Request $request
  42 + * @return string
  43 + * @throws \setasign\Fpdi\PdfParser\CrossReference\CrossReferenceException
  44 + * @throws \setasign\Fpdi\PdfParser\Filter\FilterException
  45 + * @throws \setasign\Fpdi\PdfParser\PdfParserException
  46 + * @throws \setasign\Fpdi\PdfParser\Type\PdfTypeException
  47 + * @throws \setasign\Fpdi\PdfReader\PdfReaderException
  48 + * @author Akun
  49 + * @date 2026/03/04 10:43
  50 + */
39 public function addQrToPdf(Request $request) 51 public function addQrToPdf(Request $request)
40 { 52 {
41 $sourceFile = $request->input('original_pdf'); 53 $sourceFile = $request->input('original_pdf');
42 if (empty($sourceFile)) { 54 if (empty($sourceFile)) {
43 - return $this->error('原始pdf未传参'); 55 + return $this->error('原始pdf地址未知');
44 } 56 }
45 if (!file_exists($sourceFile)) { 57 if (!file_exists($sourceFile)) {
46 - return $this->error('原始pdf不存在'); 58 + return $this->error('原始pdf文件不存在');
47 } 59 }
48 $qrText = $request->input('qr_text'); 60 $qrText = $request->input('qr_text');
49 if (empty($qrText)) { 61 if (empty($qrText)) {