sabato 25 aprile 2015

Even the OVERLAYs shift

If you though that what explained here was referred only to the text fields in a SCS compiled as an AFPDS, you couldn't have been more wrong! Even the graphics is shifted in the same way, here explained a method to solve it:

1. Draw your OVERLAY normally


Draw it with Word, Publisher, Libreoffice, finish it off with Photoshop or Gimp, take it from a pdf file, scan a scribble... you can do whatever you want, the important thing is that the width and height of the page are the same of your printing (A4? 210 × 297 mm or 8.27 × 11.69 inches).

2. Set the printer driver

First of all, you must download it from here:
http://www-01.ibm.com/support/docview.wss?uid=nas8N1011940.
Download it, unzip it in a folder, create a new printer in the Windows Control Panel on a local port of FILE: type, search for the drivers into the folder where you extracted the files, and then install the driver called "Generic InfoPrint 300dpi AFP".

Now, with the right mouse button on the fresh created printer, click on Printing Preferences and then on Advanced. Here the so desired view:


The idea is to set the driver so that it cuts out the sheet's unprintable borders, the same that we inserted in the FRONTMGN parameter:


using millimeters

using inches

in this case inches are more accurate.

 


3. Import in the system

Print your layout on the newly created printer, a window will appear asking to save a file, you can use the name that you want, I'll name it layout.prn for convenience.
Now let's write down some command, first of all , transfer layout.prn on your system IFS, for example into /tmp, then create a new physical file:

CRTPF FILE(QGPL/QOVLSRC) RCDLEN(1024) MAXMBRS(*NOMAX) MBR(*NONE)
 LVLCHK(*NO)

file name, library and length are not so important, only copy layout.prn in a new member:

CPYFRMSTMF
 FROMSTMF('/tmp/layout.prn') 
 TOMBR('/qsys.lib/qgpl.lib/qovlsrc.file/layout.mbr') 
 MBROPT(*REPLACE) 
CVTDTA(*NONE) ENDLINFMT(*FIXED) TABEXPN(*NO) 

and then:

CRTOVL OVL(QGPL/LAYOUT) FILE(QGPL/QOVLSRC) MBR(*OVL)

in order to create the object LAYOUT typed *OVL in QGPL.

4. Place your OVERLAY at the beginning of the printable area





As for the title, place LAYOUT into your printer file:

OVERLAY(QGPL/LAYOUT 0 0) 

the (0,0) position point out the top left corner of the printable area set with the FRONTMGN parameter.


Feels good.


sabato 18 aprile 2015

Anche gli OVERLAY si spostano

Voi speravate che quanto spiegato qui riguardasse solo i campi di testo di un SCS compilato come AFPDS, e invece no! Anche la grafica viene spostata, ecco come rimediare:

1. Disegnate il vostro OVERLAY normalmente


Disegnatelo con Word, Publisher, Libreoffice, rifinitelo con Photoshop o Gimp, prendetelo da un pdf, scannerizzate uno scarabocchio... potete fare come volete, l'importante è che sia delle dimensioni del foglio impostate nella misura della stampa (A4? 210 × 297 mm , 8.27 × 11.69 pollici) .

2. Impostate il driver di stampa

Che poi prima lo dovete scaricare, qui:
http://www-01.ibm.com/support/docview.wss?uid=nas8N1011940.
Una volta scaricato, estraete tutto in una cartella, create una nuova stampante locale dal Pannello di Controllo di Windows su porta di tipo FILE: , cercate i driver nella cartella dove avete estratto i file, dovreste installare il driver "Generic InfoPrint 300dpi AFP".

Ora tasto destro sulla stampante creata, poi cliccate su Proprietà Stampante e poi su Preferenze, ecco l'agognata schermata:


L'idea è di impostare il driver per ritagliare i bordi non stampabili del foglio, cioè gli stessi che abbiamo inserito nel parametro FRONTMGN:

per i millimetri

per i pollici

In questo caso i pollici sono più precisi.

 


3. Importate sul sistema

Stampate il vostro layout sulla nuova stampante creata, vi chiederà di salvare un file in una posizione, salvate con il nome che volete, per comodità lo chiamero layout.prn.
Ora un po' di comandi, innanzitutto, trasferite layout.prn sull'IFS del sistema ad esempio in /tmp, poi create un nuovo file fisico:

CRTPF FILE(QGPL/QOVLSRC) RCDLEN(1024) MAXMBRS(*NOMAX) MBR(*NONE)
 LVLCHK(*NO)

nome, libreria e lunghezza non sono importanti, dovete solo copiare layout.prn in un nuovo membro:

CPYFRMSTMF FROMSTMF('/tmp/layout.prn') 
 TOMBR('/qsys.lib/qgpl.lib/qovlsrc.file/layout.mbr') 
 MBROPT(*REPLACE) CVTDTA(*NONE) ENDLINFMT(*FIXED) TABEXPN(*NO)

e poi:

CRTOVL OVL(QGPL/LAYOUT) FILE(QGPL/QOVLSRC) MBR(*OVL)


per creare l'oggetto LAYOUT di tipo *OVL in QGPL.

4. Posizionate il vostro OVERLAY all'inizio dell'area stampabile





Come da titolo, posizionate LAYOUT nel vostro printer file:

OVERLAY(QGPL/LAYOUT 0 0) 

la posizione (0,0) indica l'angolo in alto a sinistra dell' area stampabile impostata con il parametro FRONTMGN.


Feels good.





domenica 2 novembre 2014

Honey, my AFP prints shifted.

II'll put this post here as a reminder for me and for whom has to deal with it:  the AFP prints shift. You have your print and you say: "Good, let's try it in *AFPDS, won't it be the same?". You'd compile your good old PRTF
like this:
CRTPRTF FILE(LIB/PRTF) DEVTYPE(*AFPDS)
and you'd print it. Some field shifted, others didn't. Ok, let's try it in PDF. Correct.

(average user reaction)

Flipping the tables like our friend RageGuy is not needed! The design of the Host Print Transform API (info) is to be "blamed" for all of this. In order to keep compatibility with IPDS systems, it shifts all the fields that fall into the unprintable borders of the sheet! That is well described in this article of the Support site.

For example, we could have this printer configuration:
CHGOUTQ OUTQ(QUEUE) TRANSFORM(*YES) MFRTYPMDL(*HP5)
We are teaching the system to use the HPT function in order to print on a PCL5 compatible printer, this kind of configuration sets the unprintable borders at 1/6 of an inch top and bottom and 1/4 of an inch left and right.
Those values are fixed into the terminal personalization object called QSYS/QWPHPLSR5 that corresponds to *HP5, the PDF transformation uses another personalization: that explains the different output!

You may say: "You know, my (laser) printer doesn't have UNPRINTABLE borders!" And I'd respond: "LOL! Yeah, and I climb mountains using a single finger like Manolo!". If you really insist on reducing the margins, you can set up a personalization object starting from *HP5 (for example).

Note: the margins are wide, guess why? To grant compatibilty with a vast number of printers.

(Compatibility is the favourite word of  Big Blue - isn't it?)

Even if you personalized your terminal, you could still be having this repositioning: text field or graphic, if they are located in the unprintable area they are "gently" moved to the printable area.
In order to solve this situation, the Support Site suggests three ways, let's see them.

  1. Move all the fields in the printable area


That is the "your problem" solution: armed with a graded ruler, you can easily perform calculations: if you print 15 CPI with 1/4 of an inch of unprintable border, the first printable column is the fifth.

Characters per Inch
(CPI) Value
Unprintable Border
in CPI
Earliest Starting
Column
5
5 / 4 = 1.2
3
10
10 / 4 = 2.5
4
12
12 / 4 = 3
4
13.3
13.3 / 4 = 3.325
5
15
15 / 4 = 3.75
5
16.7 o 17.1
16.7 / 4 = 4.175
6
18
18 / 4 = 4.5
6
20
20 / 4 = 5
6

Clearly, moving all the initial fields could mean refactoring the entire print...

  2. Change the FRONTMGN parameter


It's the best solution, pratically you'd set the margins of *HP5 in the print itself. This way you'll move all the fields of the print and you won't let the HPT function do what it wants; you can add this parameter during the creation or like a substitution:
CRTPRTF FILE(LIB/PRTF) FRONTMGN(0.17 0.25) UOM(*INCH)

CHGPRTF FILE(LIB/PRTF) FRONTMGN(0.17 0.25) UOM(*INCH)

OVRPRTF FILE(PRTF) FRONTMGN(0.17 0.25) OVERSCOPE(*JOB) 
        UOM(*INCH)

Please note that the unity of measure parameter (UOM) is set on inches. If instead you want to use centimeters you could go like this:
CRTPRTF FILE(LIB/PRTF) FRONTMGN(0.43 0.64) UOM(*CM)

CHGPRTF FILE(LIB/PRTF) FRONTMGN(0.43 0.64) UOM(*CM)

OVRPRTF FILE(PRTF) FRONTMGN(0.43 0.64) OVERSCOPE(*JOB) UOM(*CM)

  3. Printing in raster mode


That is the "meh" solution: you can set up a terminal personalization by setting the raster mode on, in the section:
:RASTERMODE
 SCS=NO
 AFP=NO.
change this fields
 SCS=YES
 AFP=YES.
With this configuration, you make the HPT function treat everything as graphic, translating even the character fields as bitmap (that's it, rasterizing), what will it imply?

- the fields in the unprintable borders won't be shifted but cropped,
- the resulting spool file is larger and the printing production slows down,
- you should install a couple of options in order to grant the compatibility with all the fonts (AFP Compatibility Fonts - IBM AFP Font Collection for IBM Operating System - Advanced Function Printing DBCS Fonts/400),
- if you have a tool that translates from PCL to PDF (one above all: GhostPDL), the text won't be selected.

...seriously!?

IBM makes available additional terminal personalizations (download the SAVF), some of them have the raster mode activated (like PCL5RASTER), and some other type and models (MFRTYPMDLs) with the raster mode are already installed in the system: *IBM4076, *HP310, *HP320, *HP500, *HP520 and *HP540.

In conclusion, create your printer files with:
CRTPRTF FILE(LIB/PRTF) FRONTMGN(0.17 0.25) UOM(*INCH)
And here you go!


P.S.: if you don't know, AFPDS is the graphic format made available by IBM, OS integrated.
You can do a lot of good things like changing fonts, inserting barcodes, impressing images and graphics to the prints, all this using keywords in the printer file (Did I say that it is integrated?).

http://afpcinc.org/
 (There is a Consortium that promotes it.)

(Bwahahaha! I found this on Google Images, it brings here, ask me nothing.)

domenica 5 ottobre 2014

Tesoro, mi si sono spostati gli AFP

Lascio qui questo post a monito mio e di quanti si cimenteranno: le stampe AFP si spostano. Avete la vostra bella stampa e dite: "Bene, ora proviamo a crearla come *AFPDS, non dovrebbe essere uguale?" Compilate il vostro bel PRTF
con
CRTPRTF FILE(LIB/PRTF) DEVTYPE(*AFPDS)
e stampate. Alcuni campi vengono spostati, altri no. Provate allora a farne un pdf. Corretto.

(reazione utente medio)

Non serve ribaltare i tavoli come il nostro amico RageGuy! La "colpa" di tutto questo è di come è stata pensata l'api Host Print Transform (info), che per mantanere una compatibilità con sistemi IPDS sposta tutta la grafica che ricade dentro i bordi non stampabili del foglio!
Tutto è spiegato bene in questo articolo del Support.

Prendiamo la nostra stampante così configurata:
CHGOUTQ OUTQ(QUEUE) TRANSFORM(*YES) MFRTYPMDL(*HP5)
In pratica, stiamo dicendo al sistema di utilizzare la funzione HPT su una stampante configurata come compatibile PCL5, una configurazione del genere fissa i margini non stampabili a 1/6 di pollice in alto e in basso e 1/4 di pollice a sinistra e destra.
Questi valori sono impostati nell' oggetto di personalizzazione di terminale QSYS/QWPHPLSR5 che corrisponde a *HP5, la trasformazione in PDF usa un'altra personalizzazione, che non ha quei margini lì, ecco spiegata la differenza di output!
Voi direte: "Ma la mia stampante (laser) può stampare al VIVO del foglio!"
E io rispondo: "LOL! Sì, e io scalo e montagne con un dito come Manolo!" Se proprio volete ridurre i margini, allora modificatevi un oggetto di personalizzazione terminale a partire da *HP5 (ad esempio).
NB: i margini sono piuttosto larghi, potete indovinare perchè? Per compatibilità con il maggior numero di stampanti.

(Compatibilità è la parola preferita di Big Blue - no?)

Anche personalizzando un terminale potreste incappare nello spostamento maledetto: che sia campo di testo o grafica, se ricade nell'area non stampabile viene "gentilmente" fatto accomodare da HPT dentro l'area stampabile.
Per ovviare a questo problema il Support propone tre vie, vediamole.

1. Spostate tutti i campi che rientrano nell'area non stampabile


Questa è la soluzione "arrangiati": riga meccanografica alla mano, i calcoli sono presto fatti, con 1/4 di margine non stampabile, se stampi a 15 CPI la prima colonna utile è la quinta.

Caratteri per Pollice
(CPI) Valore
Bordo Non Stampabile
in CPI
Prima Colonna
Stampabile
5
5 / 4 = 1.2
3
10
10 / 4 = 2.5
4
12
12 / 4 = 3
4
13.3
13.3 / 4 = 3.325
5
15
15 / 4 = 3.75
5
16.7 o 17.1
16.7 / 4 = 4.175
6
18
18 / 4 = 4.5
6
20
20 / 4 = 5
6

Certo, spostare i campi iniziali potrebbe voler dire ripensare l'intera stampa...

  2. Modificate il parametro FRONTMGN


E' la soluzione migliore, in pratica fissate i margini di *HP5 direttamente nella stampa, in questo modo spostate tutti i campi della stampa e non lasciate fare a HPT quello che vuole; potete inserire il parametro in fase di creazione o come sovrapposizione:
CRTPRTF FILE(LIB/PRTF) FRONTMGN(0.17 0.25) UOM(*INCH)

CHGPRTF FILE(LIB/PRTF) FRONTMGN(0.17 0.25) UOM(*INCH)

OVRPRTF FILE(PRTF) FRONTMGN(0.17 0.25) OVERSCOPE(*JOB) 
        UOM(*INCH)

Notate il parametro unità di misura (UOM) fissato sui pollici, se si usano i centimetri:
CRTPRTF FILE(LIB/PRTF) FRONTMGN(0.43 0.64) UOM(*CM)

CHGPRTF FILE(LIB/PRTF) FRONTMGN(0.43 0.64) UOM(*CM)

OVRPRTF FILE(PRTF) FRONTMGN(0.43 0.64) OVERSCOPE(*JOB) UOM(*CM)

3. Stampate in raster mode


Questa è la soluzione meh: potete modificare una personalizzazione di terminale attivando il raster mode, nella sezione:
:RASTERMODE
 SCS=NO
 AFP=NO.
modificate i campi
 SCS=YES
 AFP=YES.
Con questa configurazione dite a HPT di considerare tutto come grafica, quindi tradurre anche i campi di testo in bitmap (appunto, rasterizzare), cosa comporta questo?

- I campi nell'area non stampabile non vengono spostati ma vengono tagliati,
- la stampa è più pesante e la produzione della stessa è più lenta,
- dovete installare un paio di opzioni per la massima compatibilità con tutti i font (AFP Compatibility Fonts - IBM AFP Font Collection for IBM Operating System - Advanced Function Printing DBCS Fonts/400),
- se avete un tool che traduce da PCL a PDF (tipo GhostPDL), il testo risulterà non selezionabile,

insomma meh.

IBM mette a disposizione anche qualche personalizzazione di terminale aggiuntiva (scaricate il SAVF), alcune delle quali predisposte per il raster mode (tipo PCL5RASTER), alcuni tipi e modelli (MFRTYPMDLs) in raster mode sono invece già presenti nel sistema: *IBM4076, *HP310, *HP320, *HP500, *HP520 e *HP540.

In conclusione, create le vostre stampe con:
CRTPRTF FILE(LIB/PRTF) FRONTMGN(0.17 0.25) UOM(*INCH)
e siete a posto!


PS: per chi  non lo conoscesse, l' AFPDS è il formato grafico messo a disposizione da IBM, integrato nel sistema operativo.
Permette di fare tante belle robe tipo cambiare font, inserire barcode, imprimere loghi e grafiche alle stampe, il tutto utilizzando apposite keyword da mettere nel Printer File (ho detto che era integrato?).

http://afpcinc.org/
 (Esiste un consorzio che lo promuove.)

(ahahahah, questa l'ho trovata su Google Immagini e porta qui, non so perché)