Results 1 to 6 of 6

Thread: Printer.print total Page number without repeating the whole printing function

  1. #1

    Thread Starter
    Registered User
    Join Date
    Nov 2022
    Posts
    3

    Smile Printer.print total Page number without repeating the whole printing function

    hi all,
    I have browsed westconn1's suggestion on getting total print page no.
    but my print function is quite complicated and would request several user input by prompt(i.e. : select picture for each list item/ select printer...)
    part of my print function looks like:
    Code:
     '============ if have picture in X drive
                If Dir(picpath, vbDirectory) <> "" Then
                    Picture1.Picture = LoadPicture(picpath)
                    isPrintPicture = True
                End If
                '============== if cant auto map picture in share drive
                If Dir(picpath, vbDirectory) = "" Then
                    isPrintPicture = False '//--------------- set flag to false in each loop ---------------------
                    '//------------------------------- ask user if want add picture to print -------------------------------
                    answer = MsgBox("Do you want to add Photo for  : " & vbCrLf & datapool.TextMatrix(i, 3) & vbCrLf & RTrim(datapool.TextMatrix(i, 4)) & " ?", vbExclamation + vbYesNo, "Add Photo")
            
                    If answer = vbYes Then
                    isPrintPicture = True
                         '//------------------------ open select picture pop up ------------------------
                            With CommonDialog1
                                .DialogTitle = datapool.TextMatrix(i, 3) + "  " + RTrim(datapool.TextMatrix(i, 4))
                                .Filter = "Image files (*.jpg, *.jpeg, *.gif, *.bmp)|*.jpg;*.jpeg; *.gif; *.bmp"
                                .ShowOpen
                                If CommonDialog1.FileName <> "" Then
                                   Picture1.Picture = LoadPicture(CommonDialog1.FileName)
                                End If
                            End With
                        
                    End If
                    If answer = vbNo Then
                        isPrintPicture = False
                    End If
                End If
    So repeating the whole progress just to get the total page no. would not be feasible for my case
    I wonder if there is any way to get the total page no. and then go back to previous printer page to fill it in?

    Regards

    R1RMYJJ

  2. #2
    PowerPoster Arnoutdv's Avatar
    Join Date
    Oct 2013
    Posts
    5,904

    Re: Printer.print total Page number without repeating the whole printing function

    You can also first collect the filenames of the images the user wants to print and then start the printing process.
    For each picture ask whether the user wants to print it, if yes then add the filename to a list (collection or array).
    After collecting the filenames you know the number of files (and pages I assume) and start the printing.

  3. #3

    Thread Starter
    Registered User
    Join Date
    Nov 2022
    Posts
    3

    Re: Printer.print total Page number without repeating the whole printing function

    I did think of this approach of calculating the page no. by item/picture count, but the document has other variables like 0-10 lines of "Remarks" text etc...
    So the lazy me would very much like to use the "Printer.page" of the last page for it
    Thanks

  4. #4

    Thread Starter
    Registered User
    Join Date
    Nov 2022
    Posts
    3

    Re: Printer.print total Page number without repeating the whole printing function

    I am afraid there is more variables in the document then just the items and pictures, like 0-10 lines of texts, So calculated page no. would not be too accurate.
    So I would really like to get the printer.page value from the last page of document and apply it back to all pages.
    But VB6 doesn't seem to allow that.

  5. #5
    PowerPoster
    Join Date
    Feb 2017
    Posts
    5,064

    Re: Printer.print total Page number without repeating the whole printing function

    You could use BSPrinter.

  6. #6
    Frenzied Member
    Join Date
    May 2014
    Location
    Kallithea Attikis, Greece
    Posts
    1,289

    Re: Printer.print total Page number without repeating the whole printing function

    Create a EMF for each page, then print emf from page plus whatever you like.

    You can create EMF from other EMF, so for each page you get the original page and make a new EMF with new data (page/total.pages)
    Last edited by georgekar; Nov 16th, 2022 at 09:18 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width