RSS Forums RSS

not properly printing RTF document

Please support our VB.NET advertiser: DiscountASP.NET – 3 Months Free on VB.NET Web Hosting
Reply
Posts: 1
Reputation: neslihan is an unknown quantity at this point 
Solved Threads: 0
neslihan neslihan is offline Offline
Newbie Poster

not properly printing RTF document

  #1  
Sep 11th, 2008
printing RTF document in VB was OK. After converting to VB.NET, the RTF file being printed is placed wrongly on the paper and there is next page problem
the code is like that
Public Function Yaz(ByRef argFileName As String, ByRef argValues As Dictionary(Of String, String), Optional ByRef argPreview As Boolean = True, Optional ByRef argFormCaption As String = "Yazdırma Ekranı", Optional ByRef argDeviceName As String = "", Optional ByRef argReadOnly As Boolean = False) As Boolean
Dim lcRTFText As String
Dim lcTextFile As Boolean
Dim lcPrinter As String

Yaz = False

Try
mErrorCode = 0
mReason = ""
'ali-
mPrinted = False

If Not argDeviceName = String.Empty Then
mPreviewForm.PrintDocument1.PrinterSettings.PrinterName = String.Empty
End If

If Not argDeviceName = String.Empty Then
For Each lcPrinter In PrinterSettings.InstalledPrinters
If lcPrinter.ToLower = argDeviceName.ToLower Or _
lcPrinter.ToLower.IndexOf(argDeviceName.ToLower) > 0 Then
mPreviewForm.PrintDocument1.PrinterSettings.PrinterName = lcPrinter
Exit For
End If
Next
End If

If mPreviewForm.PrintDocument1.PrinterSettings.PrinterName = String.Empty Then
mErrorCode = -2
mReason = "Uygun yazıcı bulunamadı! (Aranılan Yazıcı Adı = " + argDeviceName + ")" + Environment.NewLine + "Lütfen yazıcınızı kontrol edip tekrar deneyiniz..."
Exit Function
End If

lcTextFile = argFileName.Substring(argFileName.Length - 3, 3).ToLower = "log" Or argFileName.Substring(argFileName.Length - 3, 3).ToLower = "txt"
If File.Exists(argFileName) Then
lcRTFText = File.ReadAllText(argFileName) 'open rtf file
Else
lcRTFText = File.ReadAllText(argFileName.Substring(0, argFileName.Length - 3) & "txt")
End If

If lcTextFile Then
lcRTFText = mConvertKeys(lcRTFText, argValues, False) 'convert
If argPreview Then
'ali-
If argReadOnly Then
mPreviewForm.cmdPrint.Enabled = False
Else
mPreviewForm.cmdPrint.Enabled = True
End If
'form gösterilecek
mPreviewForm.Text = argFormCaption
mPreviewForm.rtxt.Rtf = lcRTFText
mPreviewForm.ShowDialog()
Else
mPreviewForm.rtxt.Rtf = lcRTFText
mPreviewForm.PrintDocument1.Print()
End If
Else
mFontOnEk = mFind_FontOnek(lcRTFText) 'font oneklerini bulur
lcRTFText = mConvertKeys(lcRTFText, argValues) 'convert
If argPreview Then
'ali-
If argReadOnly Then
mPreviewForm.cmdPrint.Enabled = False
Else
mPreviewForm.cmdPrint.Enabled = True
End If
'form gösterilecek
mPreviewForm.Text = argFormCaption
mPreviewForm.rtxt.Rtf = lcRTFText
mPreviewForm.ShowDialog()
Else
mPreviewForm.rtxt.Rtf = lcRTFText
mPreviewForm.PrintDocument1.Print()
End If

End If

Yaz = True

Catch ex As Exception
mErrorCode = -1
mReason = ex.Message()
End Try
End Function

help me !!!!!
AddThis Social Bookmark Button
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.



Other Threads in the VB.NET Forum
Views: 548 | Replies: 0 | Currently Viewing: 1 (0 members and 1 guests)

 

Thread Tools Display Modes
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 2:57 pm.
Newsletter Archive - Sitemap - Privacy Statement - Acceptable Use Policy - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC