Hello
I want to print list of images from list as shown below,
I have tried,
On button click,
- int currentPage;
- ArrayList ListViewItemsData = new ArrayList() { };
- private void btn_click(object sender, MouseButtonEvertArgs e)
- {
- PrintDocument pd = new PrintDocument();
- pd.PrintPage += new PrintPageEventHandler(PrintImageHandler);
- System.Windows.Forms.PrintDialog pdi = new System.Windows.Forms.PrintDialog();
- pdi.Document = pd;
- if (pdi.ShowDialog() == System.Windows.Forms.DialogResult.OK)
- {
- pd.Print();
- }
- }
- private void PrintImageHandler(object sender, PrintPageEventArgs ppeArgs)
- {
- Graphics g = ppeArgs.Graphics;
- System.Drawing.Image objimage = System.Drawing.Image.FromFile(ListViewItemsData[currentPage].ToString());
- g.DrawImage(objimage, 50, 50, objimage.Width, objimage.Height);
- currentPage++;
- if (currentPage < ListViewItemsData.Count)
- {
- objimage = System.Drawing.Image.FromFile(ListViewItemsData[currentPage].ToString());
- g.DrawImage(objimage, 100, 300, objimage.Width, objimage.Height);
- currentPage++;
- }
- ppeArgs.HasMorePages = currentPage < ListViewItemsData.Count;
- }


Amit GuptaRank #190 · 12.8K reputationPosted Jan 8, 2017, 2:27 AM EST
Amit GuptaRank #190 · 12.8K reputationPosted Jan 7, 2017, 8:09 AM EST
Amit GuptaRank #190 · 12.8K reputationPosted Jan 8, 2017, 5:11 AM EST
Amit GuptaRank #190 · 12.8K reputationPosted Jan 7, 2017, 7:48 AM EST
Abhilash J ARank #1,243 · 1.4K reputationPosted Jan 7, 2017, 7:58 AM EST
Abhilash J ARank #1,243 · 1.4K reputationPosted Jan 7, 2017, 9:02 AM EST
Abhilash J ARank #1,243 · 1.4K reputationPosted Jan 8, 2017, 1:24 AM EST
Abhilash J ARank #1,243 · 1.4K reputationPosted Jan 8, 2017, 2:33 AM EST
Abhilash J ARank #1,243 · 1.4K reputationPosted Jan 8, 2017, 5:00 AM EST
Abhilash J ARank #1,243 · 1.4K reputationPosted Jan 8, 2017, 5:29 AM EST