Visualizzazione post con etichetta programming. Mostra tutti i post
Visualizzazione post con etichetta programming. Mostra tutti i post

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.


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.)