문제

인쇄 할 때 180도를 뒤집거나 회전하고 싶은 문서가 있습니다. (이것은 프린터의 레이블 스톡 방향 때문입니다).

재산이 있습니다 PrintDocument.PrinterSettings.LandscapeAngle 그러나 읽습니다.

이 속성은 프린터 드라이버의 영향을 받기 때문에 '정착성'이 아니라고 생각합니다.

너무 불쾌한 일을하지 않고 인쇄물을 180도 회전 할 수있는 좋은 방법이 있습니까?

도움이 되었습니까?

해결책

나는 그것이 당신이 "너무 불쾌한"것으로 정의하는 것에 달려 있다고 생각합니다. :-)

그만큼 인쇄 문서 클래스는 a 제도법 당신이 이것에 사용할 수있는 객체는 TranslateTransform 그리고 rotatetransform 필요한 곳에 물건을 얻을 수있는 방법.

그래픽 객체를 조작하기 전에 그래픽 객체의 사본을 복용 할 가치가있어서 완료되면 다시 복원 할 수 있습니다.

다른 팁

양식을 인쇄하고 vb.net에서 인쇄 문서를 뒤집고 회전하고 기본 페이지 세팅을 조경으로 설정하십시오.

Dim WithEvents mPrintDocument As New PrintDocument
Dim mPrintBitMap As Bitmap
Private Sub m_PrintDocument_PrintPage(ByVal sender As Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles mPrintDocument.PrintPage
    mPrintBitMap.RotateFlip(RotateFlipType.Rotate90FlipNone)
    mPrintDocument.PrinterSettings.DefaultPageSettings.Landscape = True
    ' Draw the image centered.     
    Dim lWidth As Integer = e.MarginBounds.X + (e.MarginBounds.Width - mPrintBitMap.Width) \ 2
    Dim lHeight As Integer = e.MarginBounds.Y + (e.MarginBounds.Height - mPrintBitMap.Height) \ 2

    e.Graphics.DrawImage(mPrintBitMap, lWidth, lHeight)
    ' There's only one page.   
    e.HasMorePages = False
End Sub
Private Sub B_print_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles B_print.Click
    ' Copy the form image into a bitmap.    
    mPrintBitMap = New Bitmap(Me.Width, Me.Height)
    Dim lRect As System.Drawing.Rectangle
    lRect.Width = Me.Width
    lRect.Height = Me.Height
    Me.DrawToBitmap(mPrintBitMap, lRect)
    ' Make a PrintDocument and print.    
    mPrintDocument = New PrintDocument

    mPrintDocument.Print()

End Sub

프린터 GDI에 할당하기 전에 시도해 보셨습니까? 그게 내가 한 일 :

                _currentPage = Image.FromStream((MemoryStream)_queue.Dequeue());
                pageHeight = _currentPage.Height;
                pageWidth = _currentPage.Width;

                if (pageHeight < pageWidth)
                {
                    _currentPage.RotateFlip(RotateFlipType.Rotate90FlipNone);
                    pageHeight = _currentPage.Height;
                    pageWidth = _currentPage.Width;                      

                }
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top