Php DomPDF-addInfo(base64_编码)和setEncryption

Php DomPDF-addInfo(base64_编码)和setEncryption,php,wordpress,pdf,pdf-generation,dompdf,Php,Wordpress,Pdf,Pdf Generation,Dompdf,我对DomPDF和带有setEncryption函数的base64_编码有问题 这是我的代码示例 // Render the HTML as PDF $dompdf->render(); //Encode title into base64 and add it to PDF Meta $title_64 = base64_encode( $title ); $dompdf->getCanvas()->get_cpdf()->ad

我对DomPDF和带有setEncryption函数的base64_编码有问题

这是我的代码示例

    // Render the HTML as PDF
    $dompdf->render();

    //Encode title into base64 and add it to PDF Meta
    $title_64 = base64_encode( $title );
    $dompdf->getCanvas()->get_cpdf()->addInfo( 'Subject' , $title_64 );

    //Locking pdf to allow printing only
    $dompdf->getCanvas()->get_cpdf()->setEncryption( '' , '' , array( 'print' ) );

    // Output the generated PDF to Browser
    $dompdf->stream( $post->post_name . ".pdf" , array( "Attachment" => TRUE ) );
因此,几乎所有的元数据都丢失了,一旦下载了PDF,就会发生什么

一旦我删除了包装$title元数据的base64_encode函数,它就回来了

如果我保留base64_编码,但删除

$dompdf->getCanvas->get_cpdf->setEncryption,,数组“print”

一切似乎都在工作,但我能够修改PDF,我不想

作为我的最终结果,我应该只能打印PDF,这是我现在拥有的+所有元数据

base64_编码


有人遇到过类似的问题吗?

这是DomPDF使用的CPDF类/版本中的一个错误。加密字符串未正确转义:

/Producer (Œa6Sq©åðÇ9Å—ÙÒ°Çl¡ÿÝøVóVѪ!Õñ¶7(Þýä¡)
在弦的末端有一个开放的括号,它既没有逃逸也没有平衡


中的逻辑是错误的。字符串在加密之前被转义,这是完全错误的。

元数据为什么要用base-64编码?这没有任何意义…这是一个客户端请求,必须这样做。您能和丢失的数据共享一个示例输出吗?