From: Arjen M. <arj...@wl...> - 2004-02-18 11:20:54
|
"Alan W. Irwin" wrote: > > On 2004-02-17 12:04+0100 Arjen Markus wrote: > > (Hm, no libpaper on my RedHat Linux system) > > Somebody suggested trying rpmfind, but generally, I find that you get more > complete results from RPM Search (http://rpm.pbone.net/). There, if you > search for libpaper.so, you will find libpaper Mandrake rpms. If libpaper > is really simple with no dependencies these rpms might work well on all > rpm-based systems. > > Somebody in the thread suggested using -geometry as an interim measure. I > doubt that is honored by all devices. Perhaps an even better interim option > to try would be the -a option (aspect ratio). I believe that option is > honored by all devices. It's only drawback is you would have to get out > your calculator to figure out the aspect ratio of a4. > I am not sure that these interim solutions are worth the effort. It seems to me that a limited version is quite feasible (recognise the most common types and allow arbitrary sizes via detailed options). Besides, you can not chose the paper size with all drivers - some are simply stuck with the physical properties of the device. I have written a short description of how I would like to solve this. See below. Comments are quite welcome. I will try to come up with a first solution today or tomorrow. Regards, Arjen ----- Description of the interface to set paper sizes: ------------------------------------------------ The paper size is defined by three quantities: 1. The shorter side of the paper, the "width" 2. The longer side of the paper, the "height" 3. The margin to use from the physical edges on all sides These quantities do not depend on the orientation of the paper. They can also define a completely arbitrary plotting surface (for instance to define an image in a PostScript file that can be embedded in a document without resizing). The useable surface extends from x=margin to x=width-margin, y=margin to y=height-margin. The following command-line arguments are defined: -papersize name -paperwidth width-in-mm -paperheight height-in-mm -papermargin margin-in-mm Use the plsetopt() interface to set these values programmatically. The name is a name like "A4", "a4" or "legal" to indicate a common paper size. Using the -papersize option means that default values for width, height and margin are set. These can be overwritten by later command-line options. If no paper size is set, the default is dependent on the driver. Note that not all drivers allow the paper size to be set. For the PostScript driver this is 8.5x11 inches, the ANSI A size. The paper size must be set to a specific choice before plinit() is called. Otherwise it will have no effect. The C API to query the size is: PLFLT plPaperHeight( int unit ) ; PLFLT plPaperWidth( int unit ) ; PLFLT plPaperMargin( int unit ) ; For flexibility, the unit argument can be used to specify that the unit for the paper size is to be: mm - unit = UNIT_MM inch - unit = UNIT_INCH points - unit = UNIT_POINTS Notes on libpaper: ----------------- The Debian library libpaper can be a good resource for the actual implementation. Right now, this is not done, because it will require a twofold solution: - if libpaper is available, then we should use it - if it is not available on the system, then we need an alternative Also, libpaper does not handle margins, so that something extra is still needed (though we could say the default margin is 0) |