Bug with duplex printing

Vitaly Perov vitperov at etersoft.ru
Tue Apr 15 07:54:45 CDT 2008

Hi all,

I'm sorry. My English is not so good.

There is a bug. I have some idia how to solve it. I'm sure it's not good way 
to solve this problem.

The bug is the following:
You print one page with duplex printing, and the number of copies is 2.
The second page must be printed on the next page, but it is printed on the 
another side of this page.
This bug appears if an application is responsible for printing (almost always)
I have tried to print the following documents (duplex printing) into the file:
1) Document consists of 1 page, number of copies is 2;
2) Document consist of 2 pages, number of copies is 1;
Then I have compared theese documents with diff.
The documens differ only in some strings (date of creation)!

I have tried the same test in OpenOffice.
The results is the same!

I want to try this in Windows, but i can find a printer which can generate 
PostScript and supports Duplex mode.

The is several ways to solve it.
Application is responsible for printing. We print 2 copies and the number of 
pages is 1, 3, 5... etc. So after sending the first copy of document it 
must "tell" to the Windows/Wine, that new page must start from the new sheet 
of paper.
I think the are 2 ways:
1) The is special WINAPI function, that application call
2) The empty page after each copy of the document. It can be inserted by 
application or Windows/Wine.

I find out that there is no special WINAPI, so this bug can be solved only by 
inserting of empty page.

I have ascertained that the application a'm testing never asks whether printer 
support duplex. So I have decided, that Windows/Wine must insert empty page.

But the Windows/Wine can't get to know the number of pages, that application 
is going to print.

So I think, its only one way to add an empty page:
We must catch EndDoc, then scan the PostScript and count number of pages it is 
going to print. Then we devide number of pages over number of copies, and 
determine number of pages in one copy of the document. Then, if number of 
pages is 1, 3, 5 .. etc. we rescan the PostScript document, and insert empty 
page after last page of each copy.
I'm sure it's not good way to solve this problem.

So, if anybody have something to say, I would be appreciate.

Thank you.

Best wishes,
Vitaly Perov
Russia, Saint-Petersburg. www.etersoft.ru

More information about the wine-devel mailing list