Setting PageSettings to set margins and landscape

DiverDan

Well-known member
Joined
Jan 16, 2003
Messages
645
Location
Sacramento, CA
User Rank
*Experts*
How do you set the default page settings to a set margin, say left 0.5, top 0.75, and to print landscape?

Thanks
 
Last edited by a moderator:
Standard PrintDialog1 with a RichTextBox object that got a little too wide for a standard margin printout on a laser printer.

I am printing through a sub that only measures the lenght of the text and graphics and sets it to the defaut page settings.
My dialog code is:

Code:
            Dim PrintResult As DialogResult
            m_PrintRichTextDocument = New RichTextPrintDocument.RichTextPrintDocument(RichTextBox1)
            m_PrintRichTextDocument.DefaultPageSettings = m_PageSettings
            With PrintDialog1
                .Document = m_PrintRichTextDocument
                If RichTextBox1.SelectionLength > 0 Then
                    .AllowSelection = True
                End If
                PrintResult = .ShowDialog
                If PrintResult = DialogResult.Cancel Then Exit Sub
                If .PrinterSettings.PrintRange.Selection = PrintRange.Selection Then
                    m_PrintRichTextDocument.PrintSelectedTextOnly = True
                End If
                m_PrintRichTextDocument.Print()
            End With

Thanks
 
Last edited by a moderator:
Code:
        Dim PageSetupDialog1 As New PageSetupDialog()

        PageSetupDialog1.PageSettings = PrintDocument1.DefaultPageSettings
        PageSetupDialog1.PageSettings.Landscape = True


        PrintDocument1.DefaultPageSettings = PageSetupDialog1.PageSettings
 
Back
Top