how to print .doc and pdf using printdialog?

  • Thread starter Thread starter jabslim via DotNetMonster.com
  • Start date Start date
J

jabslim via DotNetMonster.com

excuse me guys, i need your help once again...

i just recently tried to learn printdialog(code below) , but it prints the
strings( Dim text As String = "the string goes here.") you type only, and it
also sets the font type, size and the likes.

my question is, how can i print a .doc and pdf using printdialog? and when i
print it, i want it to be the same format as it is in the file(.doc or pdf).
i also want to be able to alter the settings of the printer to make it print
using black ink only. can anyone help me? thanks!


' Declare the PrintDocument object.
Private WithEvents docToPrint As New Printing.PrintDocument

' This method will set properties on the PrintDialog object and
' then display the dialog.
Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click

' Allow the user to choose the page range he or she would
' like to print.
PrintDialog1.AllowSomePages = True

' Show the help button.
PrintDialog1.ShowHelp = True

' Set the Document property to the PrintDocument for
' which the PrintPage Event has been handled. To display the
' dialog, either this property or the PrinterSettings property
' must be set
PrintDialog1.Document = docToPrint

Dim result As DialogResult = PrintDialog1.ShowDialog()

' If the result is OK then print the document.
If (result = DialogResult.OK) Then
docToPrint.Print()
End If

End Sub

' The PrintDialog will print the document
' by handling the document's PrintPage event.
Private Sub document_PrintPage(ByVal sender As Object, _
ByVal e As System.Drawing.Printing.PrintPageEventArgs) _
Handles docToPrint.PrintPage

' Insert code to render the page here.
' This code will be called when the control is drawn.

' The following code will render a simple
' message on the printed document.
Dim text As String = "string goes here"
Dim printFont As New System.Drawing.Font _
("Arial", 35, System.Drawing.FontStyle.Regular)

' Draw the content.
e.Graphics.DrawString(text, printFont, _
System.Drawing.Brushes.Black, 10, 10)
End Sub
 
jabslim via DotNetMonster.com said:
excuse me guys, i need your help once again...

i just recently tried to learn printdialog(code below) , but it
prints the strings( Dim text As String = "the string goes here.")
you type only, and it also sets the font type, size and the likes.

my question is, how can i print a .doc and pdf using printdialog?
and when i print it, i want it to be the same format as it is in the
file(.doc or pdf). i also want to be able to alter the settings of
the printer to make it print using black ink only. can anyone help
me? thanks!


I don't think there will be different answers than the ones you've
already gotten in your previous posts.

- You can not print using the printdialog.

- You can not print .doc files using the PrintDocument. Well, maybe
after asking Microsoft for the file format specifications and paying the
licence fee. (probably) I don't know if it's free; well, I didn't find
them...

- Have a look at "CMoya"'s reply about Word automation in one of your
previous posts.

- The PrintDialog, AFAIK, is there to change settings for your
application (process) only. If you use Word, it won't take your printer
settings. However, I'm not sure if printer settings are inherited by
processes started by your process. (anybody knows?)

- Have you searched for "DMCOLOR_MONOCHROME" as suggested by myself
in a previous thread?


Armin
 
Armin said:
excuse me guys, i need your help once again...
[quoted text clipped - 7 lines]
the printer to make it print using black ink only. can anyone help
me? thanks!

I don't think there will be different answers than the ones you've
already gotten in your previous posts.

- You can not print using the printdialog.

- You can not print .doc files using the PrintDocument. Well, maybe
after asking Microsoft for the file format specifications and paying the
licence fee. (probably) I don't know if it's free; well, I didn't find
them...

- Have a look at "CMoya"'s reply about Word automation in one of your
previous posts.

- The PrintDialog, AFAIK, is there to change settings for your
application (process) only. If you use Word, it won't take your printer
settings. However, I'm not sure if printer settings are inherited by
processes started by your process. (anybody knows?)

- Have you searched for "DMCOLOR_MONOCHROME" as suggested by myself
in a previous thread?

Armin


oh.. ok! sori for my stubborness..hehe
yeah, i tried googling "DMCOLOR_MONOCHROME" but there really isnt much
information about it. so i dont have a clue on how to use it.
well, thanks again for taking time to reply to my questions!! thank you!!
 
Back
Top