tif img print preview
-
Good day, I have a tiff img (img is including pic and text ) Tiff is bigger than 1print page, so I assuming when I call framecount should put 2 pages, but not, always show 1p Page is not completed it showes2/3 1/3 it should go to other page but doesn't show. Sorry I read most of codes what people wrote, but they are not working for me. If somebody can help will be greatefull Regards Drago
-
Good day, I have a tiff img (img is including pic and text ) Tiff is bigger than 1print page, so I assuming when I call framecount should put 2 pages, but not, always show 1p Page is not completed it showes2/3 1/3 it should go to other page but doesn't show. Sorry I read most of codes what people wrote, but they are not working for me. If somebody can help will be greatefull Regards Drago
drago11 wrote:
when I call framecount
Framecount? On what? The image? It'll always be 1 since it know nothing of the printer that is going to print the image. The rest of your post is unintelligible. You're going to have to provide quite a bit more detail to your question to get a clear answer.
A guide to posting questions on CodeProject
Click this: Asking questions is a skill. Seriously, do it.
Dave Kreskowiak -
drago11 wrote:
when I call framecount
Framecount? On what? The image? It'll always be 1 since it know nothing of the printer that is going to print the image. The rest of your post is unintelligible. You're going to have to provide quite a bit more detail to your question to get a clear answer.
A guide to posting questions on CodeProject
Click this: Asking questions is a skill. Seriously, do it.
Dave KreskowiakVb net 2010 Tif img I would like to print that image by calling print preview Image is larger than one print page. I cannot get another (second) page where it should be rest of that img. I'm using Img.framecount(framedimension .page) where count is always 1, but should be 2. (To divide 1 tiff img to 2 print pages) Thanks Imports System.Drawing.Printing Imports System.Drawing.Imaging Imports System.Drawing Imports System.IO Public Class Form2 Private fileCount As Integer = 0 Private currPage As Integer = 0 Private pCount As Integer = 0 Private currImage As Image Private Sub vPrintDocument() Dim vPrintDoc As New PrintDocument vPrintDoc.DefaultPageSettings.Landscape = False AddHandler vPrintDoc.PrintPage, AddressOf docPrintPage AddHandler vPrintDoc.BeginPrint, AddressOf docBeginPrint Dim i As PrintPreviewDialog = New PrintPreviewDialog i.Document = vPrintDoc i.ShowDialog() End Sub Private Sub docBeginPrint(ByVal sender As Object, ByVal e As PrintEventArgs) currPage = 0 currImage = Image.FromFile("C:\out.tif") pCount = currImage.GetFrameCount(Imaging.FrameDimension.Page) ‘MsgBox(pCount) End Sub Private Sub docPrintPage(ByVal sender As Object, ByVal e As PrintPageEventArgs) currImage.SelectActiveFrame(Imaging.FrameDimension.Page, currPage) e.Graphics.DrawImage(currImage, 20, 20) currPage = currPage + 1 If currPage < pCount Then e.HasMorePages = True Else e.HasMorePages = False End If End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Call vPrintDocument() End Sub End Class
-
Vb net 2010 Tif img I would like to print that image by calling print preview Image is larger than one print page. I cannot get another (second) page where it should be rest of that img. I'm using Img.framecount(framedimension .page) where count is always 1, but should be 2. (To divide 1 tiff img to 2 print pages) Thanks Imports System.Drawing.Printing Imports System.Drawing.Imaging Imports System.Drawing Imports System.IO Public Class Form2 Private fileCount As Integer = 0 Private currPage As Integer = 0 Private pCount As Integer = 0 Private currImage As Image Private Sub vPrintDocument() Dim vPrintDoc As New PrintDocument vPrintDoc.DefaultPageSettings.Landscape = False AddHandler vPrintDoc.PrintPage, AddressOf docPrintPage AddHandler vPrintDoc.BeginPrint, AddressOf docBeginPrint Dim i As PrintPreviewDialog = New PrintPreviewDialog i.Document = vPrintDoc i.ShowDialog() End Sub Private Sub docBeginPrint(ByVal sender As Object, ByVal e As PrintEventArgs) currPage = 0 currImage = Image.FromFile("C:\out.tif") pCount = currImage.GetFrameCount(Imaging.FrameDimension.Page) ‘MsgBox(pCount) End Sub Private Sub docPrintPage(ByVal sender As Object, ByVal e As PrintPageEventArgs) currImage.SelectActiveFrame(Imaging.FrameDimension.Page, currPage) e.Graphics.DrawImage(currImage, 20, 20) currPage = currPage + 1 If currPage < pCount Then e.HasMorePages = True Else e.HasMorePages = False End If End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Call vPrintDocument() End Sub End Class
That method does not return the amount of pages that the image is printed on; it returns the amount of frames[^] (total images in an animation) in there. If you want to know how many pages are needed to print something, then you'd have to create a print-preview using the printer-driver.
Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^]
-
Vb net 2010 Tif img I would like to print that image by calling print preview Image is larger than one print page. I cannot get another (second) page where it should be rest of that img. I'm using Img.framecount(framedimension .page) where count is always 1, but should be 2. (To divide 1 tiff img to 2 print pages) Thanks Imports System.Drawing.Printing Imports System.Drawing.Imaging Imports System.Drawing Imports System.IO Public Class Form2 Private fileCount As Integer = 0 Private currPage As Integer = 0 Private pCount As Integer = 0 Private currImage As Image Private Sub vPrintDocument() Dim vPrintDoc As New PrintDocument vPrintDoc.DefaultPageSettings.Landscape = False AddHandler vPrintDoc.PrintPage, AddressOf docPrintPage AddHandler vPrintDoc.BeginPrint, AddressOf docBeginPrint Dim i As PrintPreviewDialog = New PrintPreviewDialog i.Document = vPrintDoc i.ShowDialog() End Sub Private Sub docBeginPrint(ByVal sender As Object, ByVal e As PrintEventArgs) currPage = 0 currImage = Image.FromFile("C:\out.tif") pCount = currImage.GetFrameCount(Imaging.FrameDimension.Page) ‘MsgBox(pCount) End Sub Private Sub docPrintPage(ByVal sender As Object, ByVal e As PrintPageEventArgs) currImage.SelectActiveFrame(Imaging.FrameDimension.Page, currPage) e.Graphics.DrawImage(currImage, 20, 20) currPage = currPage + 1 If currPage < pCount Then e.HasMorePages = True Else e.HasMorePages = False End If End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Call vPrintDocument() End Sub End Class
Again, FrameCount should return 1, unless this is a multiframe, "animated" image. The image knows NOTHING about what you're displaying the image on or printing it on. How could it possibly know?? If you need to print the entire image on multiple pages, YOU have to write the code that breaks the image up into multiple images and figures out exactly what dimensions each sub-image has to be based on the printable area of the selected printer page.
A guide to posting questions on CodeProject
Click this: Asking questions is a skill. Seriously, do it.
Dave Kreskowiak -
Again, FrameCount should return 1, unless this is a multiframe, "animated" image. The image knows NOTHING about what you're displaying the image on or printing it on. How could it possibly know?? If you need to print the entire image on multiple pages, YOU have to write the code that breaks the image up into multiple images and figures out exactly what dimensions each sub-image has to be based on the printable area of the selected printer page.
A guide to posting questions on CodeProject
Click this: Asking questions is a skill. Seriously, do it.
Dave Kreskowiak -
Again, FrameCount should return 1, unless this is a multiframe, "animated" image. The image knows NOTHING about what you're displaying the image on or printing it on. How could it possibly know?? If you need to print the entire image on multiple pages, YOU have to write the code that breaks the image up into multiple images and figures out exactly what dimensions each sub-image has to be based on the printable area of the selected printer page.
A guide to posting questions on CodeProject
Click this: Asking questions is a skill. Seriously, do it.
Dave KreskowiakI'm wondering if this is a post-secondary assignment for credit.