How to print an image with vb.net 2006
-
- Posts: 3
- Joined: Tue Sep 04, 2007 10:54 pm
How to print an image with vb.net 2006
Hi all
I am just new to the forum, bought the pro viewer yesterday
Special thanks to Loic for all her help getting me off the ground.
I am searching for some examples of how to print an image from the pro viewer. I have a vb.net 2006 windows project, and a windows form has an image already loaded in the GD image control with the zoom to fit option.
I would like to add a button that would allow me to request which printer to use, set the printer margins and print the image on a fit to page basis initially, subsequently would lke to print just some heading text on the page and then the image in a slightly smaller size than the page.
Any samples out there.
Thanks
Ivan Rodriguez (Miami Florida)
I am just new to the forum, bought the pro viewer yesterday
Special thanks to Loic for all her help getting me off the ground.
I am searching for some examples of how to print an image from the pro viewer. I have a vb.net 2006 windows project, and a windows form has an image already loaded in the GD image control with the zoom to fit option.
I would like to add a button that would allow me to request which printer to use, set the printer margins and print the image on a fit to page basis initially, subsequently would lke to print just some heading text on the page and then the image in a slightly smaller size than the page.
Any samples out there.
Thanks
Ivan Rodriguez (Miami Florida)
Ivan, let me one day. Today I formatted my development computer.
Tomorow I will install the vb.net 2005 express and I will tell you few steps.
Best regards,
Loïc
Tomorow I will install the vb.net 2005 express and I will tell you few steps.
Best regards,
Loïc
Last edited by Loïc on Thu Oct 04, 2007 4:59 pm, edited 1 time in total.
Hi,
To me, you have 3 solutions with the .NET framework:
First:
You can try to interact with the PrintDialog class of the .net framework.
It is a bit dificult because you need to catch all the user options selected by the user in order to report it into the GdViewer Printing configuration.
I give you a start point (vb.net):
Second:
You can use only the .net framework classes like:
PrintDialog
PrintDocument
PrintPreviewControl
PrintPreviewDialog
I think this is the hardest method but to my mind, its offers to you many extended possibility. I can't give you a sample using this method because I never learned these classes. However I think that Google & MSDN can be a good guides
PS: you can export an Image from the GdViewer object to the .net framework using the GetHBitmap() method:
Then, it will be easy with a documentation to see how to print an Image in .NET.
Third:
You can build your own printing dialog using the Print methods of the GdViewer classe...
I think there are many other solutions but they are the only ones which I found.
Best regards,
Loïc
To me, you have 3 solutions with the .NET framework:
First:
You can try to interact with the PrintDialog class of the .net framework.
It is a bit dificult because you need to catch all the user options selected by the user in order to report it into the GdViewer Printing configuration.
I give you a start point (vb.net):
Code: Select all
Dim PrintDialog As New PrintDialog
PrintDialog.AllowPrintToFile = False
PrintDialog.AllowCurrentPage = True
PrintDialog.AllowSelection = False
PrintDialog.AllowSomePages = True
PrintDialog.PrinterSettings.MaximumPage = AxGdViewer1.NumPages
PrintDialog.PrinterSettings.FromPage = 1
PrintDialog.PrinterSettings.ToPage = AxGdViewer1.NumPages
If PrintDialog.ShowDialog() Then
AxGdViewer1.PrintSetActivePrinter(PrintDialog.PrinterSettings.PrinterName)
AxGdViewer1.PrintSetFromToPage(PrintDialog.PrinterSettings.FromPage, PrintDialog.PrinterSettings.ToPage)
AxGdViewer1.PrintSetCopies(PrintDialog.PrinterSettings.Copies)
AxGdViewer1.PrintImage()
End If
Second:
You can use only the .net framework classes like:
PrintDialog
PrintDocument
PrintPreviewControl
PrintPreviewDialog
I think this is the hardest method but to my mind, its offers to you many extended possibility. I can't give you a sample using this method because I never learned these classes. However I think that Google & MSDN can be a good guides
PS: you can export an Image from the GdViewer object to the .net framework using the GetHBitmap() method:
Code: Select all
Dim Image As System.Drawing.Bitmap
Image.FromHbitmap(AxGdViewer1.GetHBitmap())
Third:
You can build your own printing dialog using the Print methods of the GdViewer classe...
I think there are many other solutions but they are the only ones which I found.
Best regards,
Loïc
-
- Posts: 3
- Joined: Tue Sep 04, 2007 10:54 pm
-
- Posts: 3
- Joined: Tue Sep 04, 2007 10:54 pm
Who is online
Users browsing this forum: No registered users and 0 guests