Data URI Hash Parameters (Hide PDF toolbar for data URI)

前端 未结 4 2076
既然无缘
既然无缘 2021-02-15 04:00

I have a PDF base64 encode data URI.

eg:

return 

        
      
      
      
4条回答
  •  野的像风
    2021-02-15 05:02

    I'm in the same position myself here, and, unfortunately looking at

    https://developer.mozilla.org/en-US/docs/Web/HTTP/data_URIs

    the statement (within "common problems"):

    No support for query strings, etc. The data portion of a data URI is opaque, so an attempt to use a query string (page-specific parameters, with the syntax ?parameter-data) with a data URI will just include the query string in the data the URI represents.

    seems to indicate that this is not possible.

    If you are trying to prevent the printing of the PDF, and have access to the code that generates it (such as iText) you can programatically disable the print button using code similar to (encrypting the doc)

    stamper.setEncryption(null,null, PdfWriter.HideWindowUI, PdfWriter.STRENGTH40BITS); 
    stamper.setViewerPreferences(PdfWriter.HideToolbar);
    

    however this will not prevent the document being able to be saved. (see : http://developers.itextpdf.com/question/how-disable-save-button-and-hide-menu-bar-adobe-reader)

    It would be nice to be able to pass through has parameters to an embed(or object) element, but ho hum.

提交回复
热议问题