Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- protected void PrintAll_Click(object sender, EventArgs e)
- {
- // number of frames
- int number = _FaxPages.Count;
- // for loop to iterate through each frame
- for (int i = 0; i < number; i++)
- {
- // fax ID
- string _FaxId = Page.Request["FaxId"];
- //string _Frame = Page.Request["Frame"];
- // current frame
- _PageIndex = i;
- // IMG URL
- imgFax.ImageUrl = "ShowFax.ashx?n=" + _FaxId + "&f=" + _PageIndex + "&mw=750";
- PrintDocument pd = new PrintDocument();
- pd.PrintPage += PrintPage;
- pd.Print();
- }
- private void PrintPage(object o, PrintPageEventArgs e)
- {
- System.Drawing.Image img = System.Drawing.Image.FromFile(imgFax.ImageUrl);
- Point loc = new Point(100, 100);
- e.Graphics.DrawImage(img, loc);
- }
- static String[] SplitFile(String file_name)
- {
- System.Drawing.Image imageFile = System.Drawing.Image.FromFile(file_name);
- System.Drawing.Imaging.FrameDimension frameDimensions = new System.Drawing.Imaging.FrameDimension(imageFile.FrameDimensionsList[0]);
- int NumberOfFrames = imageFile.GetFrameCount(frameDimensions);
- string[] paths = new string[NumberOfFrames];
- for (int intFrame = 0; intFrame < NumberOfFrames; ++intFrame)
- {
- imageFile.SelectActiveFrame(frameDimensions, intFrame);
- Bitmap bmp = new Bitmap(imageFile);
- paths[intFrame] = System.IO.Path.GetDirectoryName(Application.ExecutablePath) + @"" + intFrame.ToString() + ".tif";
- bmp.Save(paths[intFrame], System.Drawing.Imaging.ImageFormat.Tiff);
- bmp.Dispose();
- }
- imageFile.Dispose();
- return paths;
- }
Add Comment
Please, Sign In to add comment