Print mixed page size documents
Currently SumatraPDF either gets the page size from the print-options or from the PDF file's first page. However, this means that documents with mixed page sizes cannot be printed properly to the appropriate page sizes (e.g. when using a printer with multiple bins and DMBIN_FORMSOURCE (15) as the bin id). It seems this could be fixed by rearranging some code so that dmPaperSize could be updated before each page is printed using ResetDC to update the HDC inside the PrintToDevice function. I could be wrong on exactly how to do this but I'm told by my printer expert that some software is able to print mixed page sizes without resorting to scaling all pages to one page size.
Here are the steps in a nutshell that I came up with:
- Remove
devMode->dmPaperSize = GetPaperSize(engine);from PrintFile funciton - Add a
pageNoparameter to GetPaperSize function - Add equivalent of
devMode->dmPaperSize = GetPaperSize(engine, pageNo)inside for loops in PrintToDevice - Rearrange some of the page scaling code in PrintToDevice to inside the for loop so the scaling is recalculated per page.
- Use
ResetDC(hdc)to update HDC after updating paper size in step 3 and beforeStartPage(hdc). (this is allowed according to docs )
What do you think, any chance documents with mixed page sizes is a feature you could support?
It might work but currently I don't have the bandwidth to investigate this.
Hello kjk,
Any news about this topic? We are facing the same problem...
Thanks.
Alexis