Re: Page Orientation capability in Unidrv? Reverse Print direction



Dave,

Unfortunatelly it is pretty hard to troubleshoot printer driver/print
processor installation issues.

Here are few of things you could try:

- Enable the Device Installation Logging - check out the following White
Paper from Microsoft:
http://www.microsoft.com/whdc/driver/install/setupapilog.mspx

- Instrument the code to output debug messages and capture them during the
installation process.

- Prior to the driver installation attach the debuger to the Spoolsv.exe
process and set breakpoints in the Print Processor and Printer Driver.

- Try to install the Print Processor using a small test application that
calls the AddPrintProcessor Win32 API.

I can try to install your driver but I really don't have the bandwith to do
more with it.
(dnegrescuAThotmailDOTcom)

Dan.


"DaveK" wrote:

Thanks Dan,

I copied and pasted your inf file and gave it a try, unfortunately I still
get the same error message.
When I comment out
;PrintProcessor = %Processor%
the printer driver will install and print, just without the print processor.

It seems there is something about the print processor dll or the
PrintProcessor inf statement that the Add Printer wizard does not like. Is
there a way to find out what this error is?

If I sent you a zip of the files could you try to install it as a sanity
check for me?

Thanks

DaveK


"Dan Negrescu" wrote:

Dave,

I've modified your inf file to look like the one I'm using to install our
Driver and Print Processor.

I hope this works,
Dan.

Start Telpar.inf >>>>>>>>>>>
; Copyright (c) 2006 by Telpar - All rights reserved.
;
; Printer Installation File
;


[Version]
Signature="$Windows NT$"
Provider=%TP%
ClassGUID={4D36E979-E325-11CE-BFC1-08002BE10318}
Class=Printer
DriverVer=03/16/2006, 1.0
CatalogFile=MTP-2242PP.cat

;
; Manufacturer section.
;
; This section lists all of the manufacturers
; that we will display in the Dialog box
;

[Manufacturer]
"Telpar"

;
; Model Specifications Section
;

[Telpar]
"MTP-2242PP" = TELPAR_MTP_2242PP
;;; If the printer has a PnP hw-id it should be specifed on the above line


[TELPAR_MTP_2242PP]
CopyFiles = TELPAR_DRV, TELPAR_PRN_PROCESSOR
DataSection = TELPAR_DATA
DataFile = MTP-2242PP.GPD
Include = NTPRINT.INF
Needs = UNIDRV.OEM

[TELPAR_DATA]
DriverFile = UNIDRV.dll
ConfigFile = UNIDRVUI.dll
PrintProcessor = %Processor%

[TELPAR_DRV]
MTP-2242PP.GPD,MTP-2242PP.GPD,,0x00000020
MTP-22X2.Dll,MTP-22X2.Dll,,0x00000020

[TELPAR_PRN_PROCESSOR]
MTP22PP.dll,MTP22PP.dll,,0x00000020

[DestinationDirs]
DefaultDestDir = 66000
TELPAR_PRN_PROCESSOR = 66001

[SourceDisksNames.x86]
1 = %disk1%,,,""

[SourceDisksFiles.x86]
MTP-2242PP.GPD = 1
MTP-22X2.Dll = 1
MTP22PP.dll = 1

[Strings]
TP="Telpar"
disk1="Telpar Printer Driver Setup Disk"
Processor = "MTP-22PP, MTP22PP.dll"

<<<<<<<<<< End Telpar.inf <<<<<<<<<<<



"DaveK" wrote:

Hi Dan,

Here is my INF file:
------------------------------------------------------
;
; Printer Installation File
;
; List of supported printers, manufacturers
;

[Version]
Signature="$Windows NT$"
Provider=%TP%
ClassGUID={4D36E979-E325-11CE-BFC1-08002BE10318}
Class=Printer

[ClassInstall32.NT]
AddReg=printer_class_addreg

[printer_class_addreg]
HKR,,,,%PrinterClassName%
HKR,,Icon,,"-4"
HKR,,Installer32,,"ntprint.dll,ClassInstall32"
HKR,,NoDisplayClass,,1
HKR,,EnumPropPages32,,"printui.dll,PrinterPropPageProvider"

;
; Manufacturer section.
;
; This section lists all of the manufacturers
; that we will display in the Dialog box
;

[Manufacturer]
"Telpar"

;
; Model Specifications Section
;

[Telpar]
"MTP-2242PP" = MTP-2242PP.GPD

;
; Installer section(s) referenced above.
;

[MTP-2242PP.GPD]
CopyFiles=@xxxxxxxxxxxx,@MTP22PP.DLL,@MTP-2242PP.GPD
DataSection=UNIDRV_DATA
DataFile=MTP-2242PP.GPD
Include=NTPRINT.INF
PrintProcessor="MTP-22PP, MTP22PP.dll"
Needs=UNIDRV.OEM

[DestinationDirs]
DefaultDestDir=66000
MTP22PP.DLL=66001 ; print processor directory

[SourceDisksNames.x86]
1 = %disk1%,,,\i386

[SourceDisksFiles]
MTP-22X2.Dll = 1
MTP-2242PP.GPD = 1
MTP22PP.dll = 1

[Strings]
PrinterClassName="Printers"
TP="Telpar"
disk1="Telpar Printer Driver Setup Disk"


If I comment out the PrintProcessor= line, the printer driver will install
but without the print processor of course. The dll is getting copied to the
print processor directory.

Thanks
DaveK



"Dan Negrescu" wrote:

Dave,

Can you show your INF file ?

Dan

"DaveK" wrote:

Thanks for all you insight on this.

Regarding the use of a print processor, I am having difficulty installing it
with the INF file and the Add Printer Wizard using the statement
PrintProcessor="PrintProcessorName, PrintProcessorDLLName"
in the INF file. I get the following error:
'Printer driver not installed, operation could not be completed'

If I manually install the PrintProcessor by copying the dll to the
appropriate print processor directory and update the registry to include the
print processor, I can select it and debug it with the debugger. And it
behaves as I desire.
Do you have any ideas on what I could be doing wrong or missing?

Thanks
DaveK


"Dan Negrescu" wrote:

Dave,

The print processor has access to the DEVMODE structure that was used to
create the print job in the OpenPrintProcessor() function (within the
PPRINTPROCESSOROPENDATA parameter).
The content of the DEVMODE can be saved and used in the
PrintDocumentOnPrintProcessor() function to decide if the page reversal has
to be performed or not.

Regarding OEMStartBanding()/OEMNextBand() not being called:
If the entire page can fit into the max memory buffer size defined by the
Unidrv (AFAIK it is about 6 Mb) then no banding is done. You mentioned that
your printer is thermal printer so (my guess that) it's page size is at most
Letter/A4 size (FAX or POS printer), black and white and a resolution between
150 and 300 dpi, so it would need about 1 Mb/per page. In this case the
Unidrv will allocate memory for the whole page and
OEMStartBanding()/OEMNextBand() are not called. In order to perform your page
reversal you could hook the OEMSendPage() and flip the entire page.

Hope this helps,
Dan.

"DaveK" wrote:

Thanks for all the info. You’re overwhelming me with info,
but I sure am not complaining. Its been helping me understand
all the pieces to the printer driver puzzle.

I was able to successfully implement the print processor suggestion
using the print processor sample and modifying emf.c to call
SetWorldTransform() with a Xform matrix set to reflect about
the vertical and horizontal and adjust the origin to place the
print within the page rect before calling GDIPlayPageEmf().

However, I noticed that other features of this sample involved
with orientation such as Landscape mode or NUp printing do
not get executed when the printer settings are selected. I tested
NUp with MS Word and get the desired NUp printed output, but
following the code in the debugger the NUp routines are bypassed
due to dwTotalNumberOfPages always equals 1, even when
printing multiple pages. Is there an explanation for this?

The reason for the above concern is that I would like to
make the page rotation a selectable feature. Can printer
settings/configurations be retrieved from within the print
processor with a call such as GetPrinter()? Or is there
another method for this type of request? Such as within
PPRINTPROCESSOROPENDATA passed to OpenPrintProcessor()
and the GetKeyValue() routine to look for keys within the
pParameters of the PPRINTPROCESSOROPENDATA?

Thanks Dan for the DrvStartBanding and DrvNextBand
suggestion. I would like to look at this idea further as
some of our customers prefer to print direct, no spooling,
thus raw data and no emf data type. I am developing
this driver for a family of our thermal printers which use
an ESC/POS printer language, basically printing raster
scan lines. Therefore this option looks like it has potential.
However I need to understand how the POINTL and
SURFOBJ variables operate within the Banding routines
to understand how to set the starting scan line and the
direction.

I built and installed the watermarkuni sample to follow
through the code in the debugger of Visual Studio 2005,
could hit break points in OEMEnablePDEV, OEMStartDoc,
OemEndDoc. But could not hit break points in the
OEMStartBanding and OEMNextBand routines.
Is there something else needed to enable these routines?

Thanks for all your assistance.
DaveK


"Dan Negrescu" wrote:

Not sure to fully understand what are you saying here?
If you meant to say that my solution applies if the device is a raster
printer and the driver on host should perform the rasterization then yes that
is correct.
My reading of the OP was about achieving bottom-up page orientation for a
printer using a driver based on the Unidrv, and the printer doesn’t have the
.



Relevant Pages