Guest User

Untitled

a guest
Jan 16th, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.58 KB | None | 0 0
  1. protected void PrintAll_Click(object sender, EventArgs e)
  2. {
  3. // number of frames
  4. int number = _FaxPages.Count;
  5.  
  6.  
  7. // for loop to iterate through each frame
  8. for (int i = 0; i < number; i++)
  9. {
  10. // fax ID
  11. string _FaxId = Page.Request["FaxId"];
  12.  
  13. //string _Frame = Page.Request["Frame"];
  14.  
  15. // current frame
  16. _PageIndex = i;
  17.  
  18. // IMG URL
  19. imgFax.ImageUrl = "ShowFax.ashx?n=" + _FaxId + "&f=" + _PageIndex + "&mw=750";
  20.  
  21.  
  22.  
  23. PrintDocument pd = new PrintDocument();
  24.  
  25. pd.PrintPage += PrintPage;
  26. pd.Print();
  27.  
  28. }
  29.  
  30. private void PrintPage(object o, PrintPageEventArgs e)
  31. {
  32. System.Drawing.Image img = System.Drawing.Image.FromFile(imgFax.ImageUrl);
  33. Point loc = new Point(100, 100);
  34. e.Graphics.DrawImage(img, loc);
  35. }
  36.  
  37. static String[] SplitFile(String file_name)
  38. {
  39. System.Drawing.Image imageFile = System.Drawing.Image.FromFile(file_name);
  40. System.Drawing.Imaging.FrameDimension frameDimensions = new System.Drawing.Imaging.FrameDimension(imageFile.FrameDimensionsList[0]);
  41. int NumberOfFrames = imageFile.GetFrameCount(frameDimensions);
  42. string[] paths = new string[NumberOfFrames];
  43. for (int intFrame = 0; intFrame < NumberOfFrames; ++intFrame)
  44. {
  45. imageFile.SelectActiveFrame(frameDimensions, intFrame);
  46. Bitmap bmp = new Bitmap(imageFile);
  47. paths[intFrame] = System.IO.Path.GetDirectoryName(Application.ExecutablePath) + @"" + intFrame.ToString() + ".tif";
  48. bmp.Save(paths[intFrame], System.Drawing.Imaging.ImageFormat.Tiff);
  49. bmp.Dispose();
  50. }
  51. imageFile.Dispose();
  52. return paths;
  53. }
Add Comment
Please, Sign In to add comment