setting margins for printing

Hello everybody,

i have a problem with the printing framework of wpython.
I wrote a print class and now I'm having a problem setting up the desired paper size and margins correctly. My paper size and margin settings are just fully ignored.
My goal is to print on a paper without having margins.
I have no idea what I'm doing wrong :frowning:

Does anybody have an idea?

My class looks like follows:

class printing:
    def __init__(self, parent):
        #parent is of type wx.frame
        self.parent = parent
        self.printData = wx.PrintData()

    def customPageSetup(self):
        self.printData.SetDuplex(wx.DUPLEX_SIMPLEX)
        self.printData.SetOrientation(wx.PORTRAIT)
        self.printData.SetPaperSize((100, 100))

    def OnPrintSetup(self, event=None):
        self.customPageSetup()
        printDialogData = wx.PrintDialogData()
        printDialogData.SetMaxPage(1)

        printDialog = wx.PrintDialog(self.parent, data=printDialogData)
        if printDialog.ShowModal() == wx.ID_OK:
            printDialogData = printDialog.GetPrintDialogData()

        self.printData = wx.PrintData(printDialogData.GetPrintData())
        printDialog.Destroy()
        return True

    def OnPageSetup(self, event=None):
        self.customPageSetup()

        pageSetupDialogData = wx.PageSetupDialogData()
        pageSetupDialogData.SetPaperSize((100, 100))
        pageSetupDialogData.SetDefaultMinMargins(False)
        pageSetupDialogData.SetMarginTopLeft((0, 0))
        pageSetupDialogData.SetMinMarginBottomRight((0, 0))

        pageSetupDialog = wx.PageSetupDialog(self.parent, data=pageSetupDialogData)
        if pageSetupDialog.ShowModal() == wx.ID_OK:
            pageSetupDialogData = pageSetupDialog.GetPageSetupDialogData()

        self.printData = wx.PrintData(pageSetupDialogData.GetPrintData())
        pageSetupDialog.Destroy()
        return True

    def OnPrintPreview(self, event=None):
        self.customPageSetup()

        printout = MyPrintout(self.parent)
        printoutForPrinting = MyPrintout(self.parent)
        preview = wx.PrintPreview(printout, printoutForPrinting, self.printData)
        previewFrame = wx.PreviewFrame(preview, self.parent, "some title")
        previewFrame.Initialize()
        previewFrame.Show()
        return True

    def OnDoPrint(self, event=None):
        self.customPageSetup()
        printout = MyPrintout(self.parent)
        printer = wx.Printer(data=None)
        printer.Print(self.parent, printout, prompt=True)
        printout.Destroy()
        return True

cu alex

Alexander Fischer wrote:

i have a problem with the printing framework of wpython.
I wrote a print class and now I'm having a problem setting up the desired paper size and margins correctly. My paper size and margin settings are just fully ignored.
My goal is to print on a paper without having margins.
I have no idea what I'm doing wrong :frowning:
  
Most printers are physically incapable of full-bleed printing. Are you
sure your printer can do this at all?

···

--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.

Alexander Fischer wrote:

i have a problem with the printing framework of wpython.
I wrote a print class and now I'm having a problem setting up the desired paper size and margins correctly. My paper size and margin settings are just fully ignored.
My goal is to print on a paper without having margins.
I have no idea what I'm doing wrong :frowning:

Most printers are physically incapable of full-bleed printing. Are you
sure your printer can do this at all?

Hello and thanks for response.

Yes, the printer is able to do this.
In fact I'm currently more interested in the print preview and it is
possible to set up the preview explicitly to not use a margin.
But not from inside wxPython for now. The other thing is, that the
custom paper size does not work as well.
The orientation setting works, what seems pretty strange to me.

cu alex