problem with changing printer-prefs

This forum is for general developer support questions.
Post Reply
User avatar
turbo4.1
Posts: 18
Joined: Sat Jul 02, 2011 12:14 pm

problem with changing printer-prefs

Post 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.
Amiga user since 1987
Sam440Flex 666Mhz, Radeon 9250, 1GB RAM
User avatar
tonyw
AmigaOS Core Developer
AmigaOS Core Developer
Posts: 1479
Joined: Wed Mar 09, 2011 1:36 pm
Location: Sydney, Australia

Re: problem with changing printer-prefs

Post 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.
cheers
tony
User avatar
broadblues
AmigaOS Core Developer
AmigaOS Core Developer
Posts: 600
Joined: Sat Jun 18, 2011 2:40 am
Location: Portsmouth, UK
Contact:

Re: problem with changing printer-prefs

Post 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?
xenic
Posts: 1185
Joined: Sun Jun 19, 2011 12:06 am

Re: problem with changing printer-prefs

Post 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??
AmigaOne X1000 with 2GB memory - OS4.1 FE
User avatar
turbo4.1
Posts: 18
Joined: Sat Jul 02, 2011 12:14 pm

Re: problem with changing printer-prefs

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

next problem with changing printer-prefs

Post by turbo4.1 »

because nobody has a hint for me, i found another solution for changing the printer-prefs, before i open the device. i changed the prefs-file in env:.
it works fine for the postscript-printers, but now i have a problem with the other one.
i use the printer-gfx-prefs element "pg_PrintXOffset" for the left-margin and it works fine.
but the offset for the topedge "pg_PrintYOffset" will be ignored!
i tested this all with printing in a file/image.
how i can i create a top margin?
it is also very interesting, that now input-gadget exist in the prefs-dialog for a top offset, only for the left margin.
Amiga user since 1987
Sam440Flex 666Mhz, Radeon 9250, 1GB RAM
xenic
Posts: 1185
Joined: Sun Jun 19, 2011 12:06 am

Re: next problem with changing printer-prefs

Post by xenic »

turbo4.1 wrote: but the offset for the topedge "pg_PrintYOffset" will be ignored!
i tested this all with printing in a file/image.
how i can i create a top margin?
I don't know if it's the same problem as yours but I've always had a top margin issue with my HP Photosmart printer. I don't know if its a driver issue or the printer itself. When printing a multi-page text file, the top margin on the first page is larger (approx 1 inch) than the subsequent pages (approx 1/2 inch). I've worked around that problem by adding a blank page to the beginning of multi-page text files that gets ejected before printing starts. It's as though the driver or printer forgets the top margin setting between pages.
AmigaOne X1000 with 2GB memory - OS4.1 FE
Post Reply