Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. tif img print preview

tif img print preview

Scheduled Pinned Locked Moved Visual Basic
help
8 Posts 4 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    drago11
    wrote on last edited by
    #1

    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

    D 1 Reply Last reply
    0
    • D drago11

      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

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      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

      D 1 Reply Last reply
      0
      • D 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 Kreskowiak

        D Offline
        D Offline
        drago11
        wrote on last edited by
        #3

        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

        L D 2 Replies Last reply
        0
        • D drago11

          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

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          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[^]

          1 Reply Last reply
          0
          • D drago11

            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

            D Offline
            D Offline
            Dave Kreskowiak
            wrote on last edited by
            #5

            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

            D J 2 Replies Last reply
            0
            • D 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

              D Offline
              D Offline
              drago11
              wrote on last edited by
              #6

              Thanks Dave, Eddy Do you have any ideas how I can do that...

              L 1 Reply Last reply
              0
              • D drago11

                Thanks Dave, Eddy Do you have any ideas how I can do that...

                L Offline
                L Offline
                Lost User
                wrote on last edited by
                #7

                Answered here[^] by the topicstarter. I upvoted the answer since he took the time to share it.

                Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^]

                1 Reply Last reply
                0
                • D 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

                  J Offline
                  J Offline
                  James Cook20
                  wrote on last edited by
                  #8

                  I'm wondering if this is a post-secondary assignment for credit.

                  http://www.falgames.com/

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups