Page 1 of 1

problem with changing printer-prefs

PostPosted: Sun Oct 08, 2017 7:58 pm
by turbo4.1
i am working on a printing-routine of a program and want to implement the page-format-data of this program. the program makes a
rasterport dump to the printer.
the following is the implementation of the left border, like i found them in the rkrm-devices or on the wiki-page from amiga-documentation.

if (!OpenDevice("printer.device", unit, (struct IORequest *)pio, 0))
{
pd = (struct PrinterData *)pio->iodrp.io_Device;
ped = (struct PrinterExtendedData *)&pd->pd_SegmentData->ps_PED;

/* MERKER to be implemented: printer-prefs ├╝bernehmen */

//Set preferences with pageformat
pd->pd_Preferences.XOffset = (BYTE)((mp->mp_BorderLeft / 1024) / 2.54);
pd->pd_Preferences.PrintXOffset = (BYTE)((mp->mp_BorderLeft / 1024) / 2.54);
pd->pd_Preferences.PrintLeftMargin = (BYTE)((mp->mp_BorderLeft / 1024) / 2.54);
pio->ios.io_Command = CMD_WRITE;
pio->ios.io_Data = "\033#1";
pio->ios.io_Length = -1L;
DoIO((struct IORequest *)pio);
//starting graphicdump
pio->iodrp.io_Command = PRD_DUMPRPORT;
...

the problem is, it does not work. the printer always uses the settings from prefs-dialogs and not my changed one. (i test it with a usbprinter and the print to postscript)
what do i wrong?
i use 4.1FE an the sdk 53.29.

Re: problem with changing printer-prefs

PostPosted: Mon Oct 09, 2017 1:05 am
by tonyw
You have the command CMD_WRITE in the request. That should cause the device driver to write the contents of the data ("\033#1") directly to the printer transparently. It will not affect the driver's stored preferences.

I don't know how to change the stored preferences from outside the driver. Can you provide a link to the Wiki entry? I can't find it to check.

Re: problem with changing printer-prefs

PostPosted: Mon Oct 09, 2017 2:49 pm
by broadblues
@Tony

The wiki stuff is here:

http://wiki.amigaos.net/wiki/Printer_Device

@turbo4.1

Some questions and observations:

what is the range and type of the value in the is expression?

(BYTE)(mp->mp_BorderLeft / 1024) / 2.54);

PrintLeftMargin is for text only only, ie its a value in characters, so likely will have no effect for graphics settings.
XOffset is related to the mouse pointer and so not relavant to printing

PrintXOffset would seem to be the one you want but it's in 10ths onf an inch, hence my question about range and type of the values above.

Lastly what printer driver are you using with which printer?

Re: problem with changing printer-prefs

PostPosted: Mon Oct 09, 2017 4:54 pm
by xenic
@broadblues & Tony
turbo4.1 made these statements:
the program makes a rasterport dump to the printer.
i test it with a usbprinter and the print to postscript

I'm not sure the WIKI printer docs even apply to Postscript. Can the Amiga printer.device or drivers convert a rasterport dump to postscript??

Re: problem with changing printer-prefs

PostPosted: Mon Oct 09, 2017 5:37 pm
by turbo4.1
@tonyw
i am too slow, broadblues already posted the proper link. same listing a find in the RKRM-Devices.

@broadblues
i also think that the PrintXOffset is the correct entry, but i want to be sure, not to change the wrong one ;-)
the formula after the variable calculates the correct value from the intern border-value of the ignition pageformat-dialog.

i test it with "print to postscript" feature of aos4.1FE and with usbprinter.device with the HP_Photosmart driver.

@xenic
yes, it works. i test the printing-routine with this feature to save paper and ink. ;-)

thanks to all for your help, i hope this accelerate the develop of ign b5 :-)