Click here to Skip to main content
15,887,175 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Hello,

I have a list of image from database with imagename and imagepath.
How can I print each image through showing Print Dialog ?

Please help me...

What I have tried:

C#
if (objTble_Documents.Count() != 0)
            {
                PrintDocument pd = new PrintDocument();
                pd.PrintPage += new PrintPageEventHandler(PrintPage);
                System.Windows.Forms.PrintDialog pdi = new System.Windows.Forms.PrintDialog();
                pdi.Document = pd;
                if (pdi.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    pd.Print();
                }
                else
                {
                    MessageBox.Show("Print Cancelled");
                }
            }


C#
private void PrintPage(object o, PrintPageEventArgs e)
        {
            foreach (var i in objTble_Documents)
            {
                objListViewItemsData.Add(new ListViewItemsData()
                {
                    GridViewColumnName_ImageSource = (Convert.ToString(i.FilePath) + Convert.ToString(i.Parent_File_Name) + "_" + Convert.ToString(i.Child_File_Name)),
                });
            }
            System.Drawing.Image img = System.Drawing.Image.FromFile("?");/*Here How can I add all images from 'objListViewItemsData' list*/
            System.Drawing.Point loc = new System.Drawing.Point(100, 100);
            e.Graphics.DrawImage(img, loc);
        }
Posted
Updated 26-Dec-16 1:07am
v2
Comments
Suvendu Shekhar Giri 26-Dec-16 6:37am    
getting any issue with the tried code?
Rajesh Kumar 2013 26-Dec-16 6:46am    
Hello Suvendu Shekhar: Not happening printing here. How can I print all images ?

1 solution

You already posted this question at How can I open printer window in WPF c#.net?[^], and it is still not clear what your problem is.
 
Share this answer
 
Comments
Rajesh Kumar 2013 26-Dec-16 7:28am    
That for open printer window view. Now showing all images. But this question for print all images.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900