Please enable JavaScript to view this site.

Manual InterForm400 English 2023

Navigation: PDF output

PDF file naming definition

Scroll Prev Top Next More

The PDF file name finish definition

 

By creating a finishing definition of type '06 = PDF File naming' you can create PDF files in InterForm400 using advanced functions - without any programming! You can use information from the spooled file to break up the spooled file as it is merged into PDF files and let information from the spooled file be a part of the PDF file name and/or the path where it is placed.

 

You define a PDF file name definition via these options from the main menu:

 

5. Work with Auto Forms Control

4. Finish Definitions

Now you can e.g. create a new definition with F6=Add and select type: 06 = PDF Filenaming.

 

The functionality is simular to the E-mail/fax finishing definition but more advanced. You can e.g. define and use up to 35 variables (and 3 keys) for the path and PDF file names and use exit programs for the variables if necessary.

 

NOTE:  In order to get PDF output you need to purchase the PDF module or  the classic package for InterForm400.

 

When you create a new PDF file naming finishing definition you will see this screen:

 

 

         Work with PDF Filenaming                                     PNM300D  

                                                                               

Definition name  . . . . :  DEMO_MAN                                          

Description  . . . . . . :  Demo for manual                                    

                                                                               

Select one of the following options:                                          

                                                                               

   1. Receipient Key Definition                                                

   2. Variable Definitions                                                    

   3. PDF File Name Composition                                                

                                                                               

   5. Page selections and Document breaks                                      

   6. Receipient ID Information                                                

   7. Closing User-Exit                                                        

   8. Encryption and Signature                                                

   9. PDF bookmark definition                                                  

  10. ZUGFeRD definition name                                                  

   

Option:  _                                                                      

                                                                               

                                                                               

                                                                               

                                                                               

F3=Exit                                                     F12=Cancel        

                                                                               

 

 

1. Receipient Key Definition  

 

This function works exactly as '1. Key definition' for the e-mail/fax finishing definition. You can define up to 3 keys identified as *KEY1-3. They can be referred to in the PDF file name/path later in '3. PDF File Name Composition'.

 

The keys are also used in '6. Receipient ID Information' where you can state a PDF password for protected PDF files depending on who the PDF file is intended for. You can also let a user exit program return the passwords to be used. Refer to source file APF3812/APISRC member PNMEXIT for more information. A program based on this source can be called with &Entrystep = '*ID'.

 

NOTE:  You must define at least one key. If not you will get an error when running the definition.

 

Positions of the keys are defined in option 5. Page selections and Document breaks.

 

 

2. Variable Definitions

 

Select this option and you will see a list of the defined keys and variables. Press F6 to add new a variable:

 

 

        Create Variable Definition                                    PNM325D  

                                                                               

Definition name  . . . . :  DEMO_MAN                                          

Description  . . . . . . :  Demo for manual                                    

                                                                               

Type choices and then press Enter. Press F3 or F12 to exit.                    

  Variable . . . . . . . . . *VA            *VA-*VZ, *V1-*V9                  

  Description  . . . . . . . Customer Name                                  

  Max. outputlength  . . . . 30             1 - 40                            

                                                                               

  Variable type  . . . . . . 1              1=Spooled printinfo              

                                             2=Spoolfile attribute            

                                             3=Auto numerator                  

                                             4=Date                            

                                             5=Time                            

                                             6=System environment info        

                                             7=User exit                      

                                                                               

                                                                               

                                                                               

                                                                               

                                                                               

F3=Exit   F4=Prompt   F5=Refresh   F12=Cancel                                  

 

 

 

The variable can by of various types:

 

Spooled print info:        

Contains information from the contents of the spooled file. Refers to text in a certain line and interval of positions. Size can be up to 40 characters.

 

Spoolfile attribute:        

Can be any of these values: 1=Unique spoolID (40), 2=Spoolname, 3=Spoolno, 4=Jobname, 5=Owner, 6=Jobno, 7=Formtype, 8=Userdata, 9=Programm name, A=Program library                      

 

Auto numerator:              

A counter, that increases each time a certain break occours. You can state:

 

The number of digits to use.

 

If it should be fixed in length (*FIXED) or if preceding blank signs should be removed (*TRIM).

 

What to do if counter value exceeds the highest value allowed: 1=Wrap means start from the initial value again and 2=Error means, that the AFC job will halt with an error.

 

The increment value for the numerator.

 

The level of the numerator: *SYS, *TASK, *SPOOL, *TASKKEY, *KEY:

 

*SYS

One common numerator for InterForm400.

*TASK

A numerator for this finishing definition.

*SPOOL

It is reset for each new incoming spooled file.

*TASKKEY

A numerator within this task / finishing definition, that increases each time the key(s) change.

*KEY

Like *TASKKEY except this works across tasks / finishing definitions.  

 

NOTE:  All the autonumerators change for each new PDF file. Except *TASKKEY and *KEY. Normally you would create a new PDF file for each new key, but not necessarily.

 

Date:                              

Inserts the current date. It can be the: 1=System date, 2=Job date (the date of the AFC job) or the 3=Spoolfile creation date. Many different formats (without delimiters) are supported.  

                               

Time:                                

Inserts the current time. It can be either: 1=System or 2=Spool creation time.

     

System environment info:        

At the moment only '1=System name' can be selected.

 

User exit:

Select this possibility and you will see this:

 

                                                                         

User exit program  . . . .  __________     Name, *NONE                    

User exit program  . . . .    __________   Library, *LIBL                

                                                                         

Exit fields variables                                                    

  Parm 1 - 5 . . . . . . .  _____ _____ _____ _____ _____      *KEY1-3, *VA-9

  Parm 6 - 10  . . . . . .  _____ _____ _____ _____ _____                

 

 

So with this option you can call your own program to insert a value in a variable e.g. found by using other variables. You can only use variables with names, that are lower e.g. *V2 can be calculated with the values from *VA-*VZ and *V1.

 

TIP:For a demo source of a user exit program look in source file APF3812/APISRC in member PNMEXIT. The program will be called with &Entrystep = *VAR. You return the value for the variable in &Rtnparm1.

 

NOTE: The same exit program can be called several times from different places in the PDF File naming finishing definition. The field &Entrystep indicates from where it is called.

 

 

3. PDF File Name Composition

 

Select this option to state how the PDF file name is determined:

 

 

        Create PDF Filename Composition                               PNM330D  

                                                                               

Definition name  . . . . :  DEMO_MAN    Demo for manual                        

                                                                               

Type choices and then press Enter. Press F3 or F12 to exit.                    

                                                                               

  PDF output path/file . . . /Invoices/*KEY1/Inv *VB.pdf                       >

                                        Composition, *USEREXIT                

  Concat with PDF file . . .                                                   >

  Create directory . . . . . N         (Y=Yes, N=No)                          

  Replace file method  . . . 3         0=Never, 1=Always, 2=Append: .nnn  

                                        3=Generate: File-nnn.ext (nnn = 000-999)  

  Available variables                                                          

    Var.   Type      Description      Len  Info                                

    *KEY1  Keydef.   Customer Numbers   4  Numeric, Allow blanks=N            

    *VA    SpoolVar  Customer name     40  Inputlen.: 40, Position  (-)        

    *VB    SpoolVar  Invoice number    10  Inputlen.: 10, Position  (-)        

    *VC    AutoNum   Global counter     6  *SYS, Len=6, Str=0, Incr=0, *FIXED  

                                                                               

                                                                               

                                                                               

                                                                        Bottom

F3=Exit   F4=Prompt   F5=Refresh   F9=Expand   F12=Cancel   F14=Test          

 

 

                                                                               

PDF output path/file

In the top of the screen you state either the composition of the PDF file names to be created or *USEREXIT to let a user exit program determine the names of the PDF files.

As a part of the path you can use the keys and variables, that you have already defined. They are all listed in the bottom of the screen.

 

If you specify *USEREXIT for the PDF file name(s) you should call a program simular to the source in file APF3812/APISRC and member PNMEXIT. The program will be called with &EntryStep = *NAME.

 

You can press F4 to get the list of the defined variables to select from (when typing the path/file name), F9 to get access to the full length available for the PDF file name composition or F14 to test the composition with a specific spooled file and see what PDF file names it will create.

 

Other options are:

 

Concat with PDF file:                

This field is optional. In this field you can insert the path and file name of a PDF file, that should be added/appended to the PDF files, that resulted in the merge between the overlay and spooled file. You can use variables as a part of the path and file name as for the PDF output above. The field can e.g. be used for adding general terms of delivery (or a page with a special offer) to the end of a PDF file without changing anything in the overlay(s) used. Variables are not supported.

The use of PDFCON require a license key, that includes the advanced PDF module. The use also require JAVA 1.6 and the AFC subsystem also need to run.

 

Create directory:

Specify if you want InterForm400 to create the necessary directories or not.

 

Replace file method:

The possible values are:

0=Never

An error message is generated if the file already exists.

1=Always

The file will be replaced if it already exists.

2=Append .nnn

This is not recommended. It will add a counter after the extension like: file.pdf.001, whereby normal file association cannot be used.

3=Generate File-nnn.ext

This add a counter prior to the extension like file-001.pdf thus keeping the original file extension.

 

 

5. Page selections and Document breaks

 

This works much like '6. Definition recipient-ID' for the E.mail/fax finishing definition.

 

Normally it is sufficient with just one sequence line without any Page selection criteria.

You should however create one sequence line for each different layout - if the variables and/or keys moves depending on the layout of the *SCS spooled file. If you use more than one sequence line you should use the Page selection criteria.

 

As the document break definitions you need to state a place on the spooled file, that will trigger a break i.e. whenever this information changes a new PDF file will be created. This will normally be the positions of the key(s), but it does not necessarily need to be so.

 

For the InterForm400 demo spooled file, there is a 4 digit number in position 57-60 in line 13, for which a new value should trigger a new PDF file. That is done with this setup:

 

 

        Change Page Selection and Document Break                      PNM355D  

                                                                               

Definition name  . . . . :  DEMO_TEST1                                        

Description  . . . . . . :  Test PDF creation                                  

Seqno. . . . . . . . . . :    1                                                

                                                                               

Type choices and then press Enter. Press F3 or F12 to exit.                    

  Description  . . . . . . .  all pages                                        

  Skip selected pages  . . .  N                           (Y=Yes, N=No)        

  Page selection criteria                                                      

                 Printline    Position   Oper  Compare value                  

                                  -                                            

                                  -                                            

                                  -                                            

  Document breaks definitions                                                  

                 Printline    Position                                        

                      13       57 -  60                                        

                                  -                                            

                                  -                                            

                                  -                                            

                                  -                                            

                                  -                                            

F3=Exit   F12=Cancel   F13=Select spooled file                                

 

 

                                                                               

Normally a single sequence number is enough - unless the position of the document break information (or the keys and variables) moves around from page to page.

 

After creating a sequence line you must remember to use option 8=Keys and variables, to state where the variables and keys are placed for this selection of pages:

 

WARNING: DO remember to specify the position of all the keys and variables found in the spooled file through option '8=Keys and variables' ! If you forget the AFC job will halt with an error when you run the definition later.

 

 

 

       Change Receipient Keys and Spoolvariables                     PNM357D  

                                                                               

Definition name  . . . . :  DEMO_TEST1                                        

Description  . . . . . . :  Test PDF creation                                  

Sequence number  . . . . :  001                                                

Description  . . . . . . :  all pages                                          

                                                                               

Enter where to find key(s) and variables in the print.                        

                                                                               

                                        Page                                  

                                        1=First                                

Var.    Description           Length    9=Last    Printline     Startposition  

*KEY1   Key                     4               13           57            

*V1     Number                  4               13           57            

*V2     Contact_first          40       1         11           13            

*V3     Contact_last           40       9         11           13            

                                                                               

                                                                               

                                                                               

                                                                               

                                                                               

                                                                        Bottom

F3=Exit   F12=Cancel   F13=Select spooled file                                

 

 

The Page parameter does this:

1=First

Take the spooled file information from the first of the pages, that are included in the resulting PDF file.

9=Last

Take the spooled file information from the last of the pages, that are included in the PDF file.

(If you leave the parameter blank, then the value from the first page is used.)

 

In the example above the *KEY1 and *V1 is expected to be identical on all pages, that are to be included in the same PDF file. *V2 is taken from the page of the spooled file, that represents the first page of the PDF file (1=First), and *V3 is taken from the last page of the PDF (9=Last).

With 9=Last you can e.g. locate the total from the last page of the spooled file, and transfer that to a user exit (closing) program, so that the total can be archived.

 

For the demo spooled file page 2 and 3 both contains the number ‘1001' in positions 57-60 in line 13. For the result of the related PDF file the variables V2 and V3 will be this:

V2=’Susan Sunflower’.

V3=’Wolly Weed’.

 

 

6. Receipient ID Information

 

Through this option you can maintain passwords for the receivers of the PDF files - per key value, when you created protected PDFs. Below only the key, 'Customer number' has been defined.

Instead of manually setting the password for each user you can also set the password via a special Recipient Key user exit program. This is setup in option 1. Receipient Key Definition.

 

 

         Create Receipient ID                                         PNM365D

                                                                             

Definition name  . . . . . : DEMO_MAN                                        

Description  . . . . . . . : Demo for manual                                  

                                                                             

Customer Number  . . .      __________                                      

                                                                             

                                                                             

                                                                             

PDF User Password  . .      _______________________________________      

                                                                             

 

NOTE:  The use of PDF passwords requires purchase of the Digital Signature/PDF security module plus installation of certain OS/400 products and options.

 

 

7. Closing User-Exit

 

Select this option to specify a program, that will be called right after each PDF file has been created. You will get this screen when selecting this option:

 

 

        Change Closing User Exit Program                              PNM370D  

                                                                               

Definition name  . . . . :  DEMO_MAN                                          

Description  . . . . . . :  Demo for manual                                    

                                                                               

Type choices and then press Enter. Press F3 or F12 to exit.                    

                                                                               

  User exit program  .  *NONE_____            Name, *NONE                      

    Library  . . . . .    *LIBL_____          Library, *LIBL      

 

  Parameter list format  . 1                 1, 2, 3, 4            

                                                                               

  Exit fields variables                                                        

  Parm 1 - 5 . . . . .  _____ _____ _____ _____ _____ *KEY1-3, *VA-9

  Parm 6 - 10  . . . .  _____ _____ _____ _____ _____                

  Parm 11 - 15 . . . .  _____ _____ _____ _____ _____ (Format 2, 3 and 4 only)

  Parm 16 - 20 . . . .  _____ _____ _____ _____ _____                                                      

  Parm 21 - 25 . . . .  _____ _____ _____ _____ _____ (Format 3 and 4 only)  

  Parm 26 - 30 . . . .  _____ _____ _____ _____ _____                                                      

  Parm 31 - 35 . . . .  _____ _____ _____ _____ _____                                                      

  Parm 36 - 38 . . . .  _____ _____ _____                                                              

                                                                               

 

You can state your own user program, that e.g. can create an index file and archive the created PDF file.

 

The user program is linked with the parameter list format:

 

Parameter list format

1

The user program should be based on the demo source member, PNMCLSEXIT in source file APF3812/APISRC. The program is called with up to 10 index fields/variables.

2

Use a program based on demo source member, PNMCLSEXI2 in source file APF3812/APISRC. The program is called with up to 20 index fields/variables.

3

Based on demo source member, PNMCLSEXI3 in source file APF3812/APISRC. The program is called with up to 38 index fields/variables.

4

Based on demo source member, PNMCLSEXI4 in source file APF3812/APISRC. The program is called with up to 38 index fields/variables, and supports unicode spooled files.

 

The exit program is called with &Entrystep = *CLS.

 

NOTE: Any program called by InterForm400 must be owned by QSECOFR. You can change the owner (if you have enough authority) with the command: CHGOBJOWN.

 

WARNING: NEVER place any objects e.g. programs or output queues in the APF3812 library. Those objects will NOT be copied to the new release, when later doing a release update of InterForm400.

 

 

8. Encryption and Signature

 

This option works exactly like option 9 of the E-mail/fax finishing definition. Refer to Digital signature and Protected PDFs for more information.

 

NOTE:  Password protection and/or digital signature of the PDF file requires a purchase of the Advanced PDF module for InterForm400.

 

 

9. PDF bookmark definition

 

If you decide, that the PDF file should include bookmarks,  you can specify what bookmark definition to use here. If you want no bookmarks you can state *NONE.

 

 

10. PDF embedding definition

It is possible to embed one or more files (of any file type) into the output PDF file. In this option you refer to an existing embedding definition. The Advanced PDF module is required for this functionality.

 

 

11. ZUGFeRD definition name

 

In this option you can refer to a ZUGFeRD definition. With such a definition you can create special PDF files fitting the ZUGFeRD standard. The InterXML Module is required for this.

 

 

Implementation of PDF file naming

When you are done defining the PDF file naming definition you can go on and insert it in production or test. You insert it in Auto Forms Control by inserting a function N = Create PDF File.