OPALE - 10.0 - Utilisation

Sécuriser un PDF avec un mot de passe dont sa valeur est présente dans le fichier spool d'entrée

De MappingDoc

Préambule

The purpose of this document is to describe the procedure for securing a PDF file directly generated from the AS/400 system using the map_xps command.

Customer request

The customer wishes to secure his PDF file with a password with a value contained in the input spooled file of Mapping. This information can be the customer number, invoice number, etc.

Securing procedure

First of all, we must make sure that the model we generate on the AS/400 system is in XPS format. Indeed we will use the command map_xps and to work it is necessary that the model is in the right format. The easiest method to set up is to create a memory area in the model and place the key we want to use to secure the PDF. As mentioned above it can be the customer number, the invoice number or anything else the customer chooses. In my example we will choose the invoice number as the password.

M-Designer

In the project properties make sure that the design language is in XPS format.

OP SRV PDFSECURE 1.jpg


In the design of the model select the key value you want to use to secure your PDF.

OP SRV PDFSECURE 2.jpg


OP SRV PDFSECURE 3.jpg


OP SRV PDFSECURE 4.jpg

Make sure that the field you have created is of metadata type and index subtype

OP SRV PDFSECURE 5.jpg


Don't forget to fill in the name of the index field in order to be able to call it correctly. In my example and to follow the information contained in the spool, I named it NUMFAC

OP SRV PDFSECURE 6.jpg

Once this field is created you can generate and import the format on the AS/400 system

OP SRV PDFSECURE 7.jpg

AS/400 system

The first thing to do is to put the library where Mapping is installed online

ADDLIBLE MAP400

On the Mapping operating menu press option 2 to import the format. From this point on, you can perform the composition action of the model using the mapcpysplf command.

Please note that we are working in XPS format and that we want to output the file in a temporary directory in order to convert it to PDF format.

- MAPCPYSPLF SPLF(CHRISTIAN) SPLNUM(8) JOB(QPADEV0003) JOBNUM(260629)USER(JDIEU) MAPNAM(VSSAVEKOI) MAPSEQ(*MRG) TYPLAN(*XPS)XPSCONVERT(*NONE) XPSOUTFILE(‘/home/alfeakr/mapping/out.xps')

Once the XPS file has been created, it is now time to do the conversion action. To do this you must call the following action:

- CALL PGM(MAP_XPS) PARM('-infile:/home/alfeakr/mapping/out.xps' '-outfile:[[NUMFAC]].pdf' '-param:encryptmode=on' '-param:encryptuserpwd=[[NUMFAC]]' '-fromXPS' '-toPDF')

Naming your output PDF file in the following way allows you to split on the invoice number.

OP SRV PDFSECURE 8.jpg


The created files are stored in the Mapping library (/home/map400/mapping/xxx.pdf)

Final result

OP SRV PDFSECURE 9.jpg

For these tests, the password for PDF files is the invoice number, and therefore the file name.

OP SRV PDFSECURE 10.jpg