Re: XMLMind support for protected PDF output

Hussein Shafie <[email protected]> Sun, 24 Jul 2016 11:02:41 +0200
Newsgroups gmane.text.xml.xfc.general
Message-ID <[email protected]>
On 07/22/2016 08:43 PM, Peter Le wrote:
>
> Does XMLMind have the capability to output a PDF that is protected from
> copying/editing/etc?
>
> I have seen that the Apache FOP (latest version) has this capability.
>
> https://xmlgraphics.apache.org/fop/0.95/pdfencryption.html
>

My answer assumes that you are using a recent version of XMLmind XSL 
Utility because only XMLmind XSL Utility (and XMLmind XSL Server) can 
generate PDF.



First of all, FOP 0.95 is completely obsolete. Latest version of XMLmind 
XSL Utility includes latest version of FOP which is 2.1. So please refer to:

http://xmlgraphics.apache.org/fop/2.1/configuration.html



The answer to your question is: no, there is no easy way to make XMLmind 
XSL Utility generate protected PDF files. You must use a FOP 
configuration file for that.

Fortunately, XMLmind XSL Utility can automatically create  the FOP 
configuration file for you and then automatically use this FOP 
configuration file.

First steps:

1) Start XMLmind XSL Utility and click "Preferences".

2) Select the "Addon|FOP" section.

3) Declare at least one font as explained in 
http://www.xmlmind.com/foconverter/_distrib/xslutil/doc/help/com.xmlmind.guiutil.PreferencesEditorDialog.html#fop_preferences

The simplest is to click "Use Windows standard fonts".

4) Quit XMLmind XSL Utility.

The above steps have caused XMLmind XSL Utility to create FOP 
configuration file <XFC_user_preferences_dir>/fop/fop.conf

where <XFC_user_preferences_dir> is:

     * $HOME/.xfc/ on Linux.

     * $HOME/Library/Application Support/XMLmind/FOConverter/ on the Mac.

     * %APPDATA%\XMLmind\FOConverter\ on Windows XP, Vista, 7, 8, 10.

     Example: C:\Documents and Settings\john\Application 
Data\XMLmind\FOConverter\ on Windows XP. 
C:\Users\john\AppData\Roaming\XMLmind\FOConverter\ on Windows Vista, 7, 
8 and 10.

Final step, please edit fop.conf using a text or XML editor and add, for 
example:

---
       <encryption-params>
          <noprint/>
          <nocopy/>
          <noedit/>
       </encryption-params>
---

as the first child of the <renderer mime="application/pdf"> element.

After doing that, fop.conf looks like this:

---
<?xml version="1.0"?>
<fop>
   <renderers>
     <renderer mime="application/pdf">
       <encryption-params>
          <noprint/>
          <nocopy/>
          <noedit/>
       </encryption-params>

       <fonts>
         <font embed-url="file:/usr/share/fonts/truetype/arial.ttf"
               kerning="yes">
           <font-triplet name="Arial" style="normal" weight="normal"/>
           <font-triplet name="sans-serif" style="normal" weight="normal"/>
         </font>
         ...
  ---

Now restart XMLmind XSL Utility. From now, all the PDF you'll generate 
using XMLmind XSL Utility will be "protected".

--
XMLmind FO Converter Support List
[email protected]
http://www.xmlmind.com/mailman/listinfo/xfc-support