problem with changing printer-prefs

This forum is for general developer support questions.

problem with changing printer-prefs

Postby turbo4.1 » Sun Oct 08, 2017 7:58 pm

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.
Amiga user since 1987
Sam440Flex 666Mhz, Radeon 9250, 1GB RAM
User avatar
turbo4.1
 
Posts: 15
Joined: Sat Jul 02, 2011 1:14 pm

Re: problem with changing printer-prefs

Postby tonyw » Mon Oct 09, 2017 1:05 am

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.
cheers
tony
User avatar
tonyw
AmigaOS Core Developer
AmigaOS Core Developer
 
Posts: 1260
Joined: Wed Mar 09, 2011 2:36 pm
Location: Sydney, Australia

Re: problem with changing printer-prefs

Postby broadblues » Mon Oct 09, 2017 2:49 pm

@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?
User avatar
broadblues
AmigaOS Core Developer
AmigaOS Core Developer
 
Posts: 484
Joined: Sat Jun 18, 2011 3:40 am
Location: Portsmouth, UK

Re: problem with changing printer-prefs

Postby xenic » Mon Oct 09, 2017 4:54 pm

@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??
AmigaOne X1000 with 2GB memory - OS4.1 FE
xenic
 
Posts: 1057
Joined: Sun Jun 19, 2011 1:06 am

Re: problem with changing printer-prefs

Postby turbo4.1 » Mon Oct 09, 2017 5:37 pm

@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 :-)
Amiga user since 1987
Sam440Flex 666Mhz, Radeon 9250, 1GB RAM
User avatar
turbo4.1
 
Posts: 15
Joined: Sat Jul 02, 2011 1:14 pm


Return to General Developer Support

Who is online

Users browsing this forum: No registered users and 3 guests