Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Command Bars
  New Posts New Posts RSS Feed - PrintPreview Notes
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

PrintPreview Notes

 Post Reply Post Reply
Author
Message
Krog View Drop Down
Groupie
Groupie


Joined: 06 February 2008
Status: Offline
Points: 100
Post Options Post Options   Thanks (0) Thanks(0)   Quote Krog Quote  Post ReplyReply Direct Link To This Post Topic: PrintPreview Notes
    Posted: 22 January 2009 at 1:12am

Hera are some PrintPreview notes and tips:

-> When the page is zoomed and we are viewing the bottom of it,  if we change the zoom the visible portion becomes the top of the page. It would be good if the visible part could be the center of the previous viewed portion.

Simplifying: The control could to get the vertical and horizontal center of the viewed page and after the zooming (increasing or decreasing) the vertical and horizontal center would be the same, if possible. And if not possible (in the case of decreasing zoom) to use the nearest point.

-> The mouse scroll wheel is not working with it.

-> The mouse right button could be used to reduce the zoom, the
inverse of the left button.


Question or suggestion 1:

Is there a way to put a header and a footer in each page?
It could be great. And it could be implemented using markup.

Here are some ways it could to work:

A. Fixed header and footer for all pages, when the content will be the same for all pages.

B. The control could to fire an event to get the header and the footer for each page. This could be used to put the page number, etc. Or to use different colors or image for each page footer. And maybe to put no header and/or no footer on some pages.

C. The program could supply a fixed markup with variables to the control, and the control could to replace them by the page number being printed (var 1) and the total number of pages (var 2). Something like <%PageNumber%> and <%TotalNumOfPages%>. In this way the header and footer would to be printed in all the pages, and the special pages (as a cover page) would to be printed separately.

Or the control could to use a mix of B and C. In the cases that will be used the same markuk pattern for all the pages we pass to the control the markup with variables only once (it is better to code), and when there is needed we can use the event to change or remove the header and footer markup.

When the program specify a header and/or a footer, the control calculates the vertical space remaining on the page and will use only that space to render the main content, being markup or RTF.

We would be able to make great reports with this feature. Cause header and footer are essential in these cases.



Question or suggestion 2:

Is there a way to show different pages on one print preview?

We could use <Page></Page> tags to separate the content of different pages, sending the markup of different pages only once to the control, but in this case the control would to fire a event to allow the program to add/remove/edit the header/footer markup for each MarkupPage (that is different of the printed page number) that could be passed as a argument:

Sub GetHeaderFooterMarkup(ByVal MarkupPage As Integer, ByVal PageNumber As Integer, ByVal TotalNumOfPages As Integer, HeaderMarkupString As String, FooterMarkupString As String)

  HeaderMarkupString = "..."
  FooterMarkupString = "..."

End Sub


But there is a problem, cause using the event we cannot to calculate the TotalNumOfPages cause the user could to remove or make great changes in the header/ footer markup, making it to occupy a different vertical size of the page.

Then the program could pass the header and footer markups to the control using properties before the rendering is started, allowing the control to calculate the TotalNumOfPages, cause it will change only the variables that will occupy the same vertical space.

Then the use would be:

  With PrintPreview
    .HeaderMarkupString(1) = Header1
    .FooterMarkupString(1) = Footer1
    .HeaderMarkupString(2) =
Header2
    .FooterMarkupString(2) = Footer2
   
MarkupText = "<Page>markup code here on page 1</Page>" & _
    "<Page>markup code here on page 2</Page>"

    .PrintView = .CreateMarkupPrintView(MarkupText)
  End With

The first argument (within parentesis) being the MarkupPage and the second (after the equal sign) the markup code.


Another idea for different pages:
the control could have a AddPrintView command. With it it could be possible to print a cover page, then set the header and footer properties and use the AddPrintView command again with the main content, then use the command again to add new contents. In this way we can have a print preview with different content on each group of pages. We can use RTF on the first page group, markup on the next, etc. And that is not so much difficult to implement (I hope).

 
  With PrintPreview
    .HeaderMarkupString = Header1
    .FooterMarkupString = Footer1
    .AddPrintView = .CreateMarkupPrintView(MarkupText)

    .HeaderMarkupString = Header2
    .FooterMarkupString = Footer2
    .AddPrintView = .CreateRichEditPrintView(RTFText)

    .HeaderMarkupString = ""
    .FooterMarkupString = ""
    .AddPrintView = .CreateMarkupPrintView(MarkupFinalText)
  End With


Or something like this... I don't know how the classes work.

Well, if you think this is difficult to implement, adding only the header and footer functionality would yet be great.



Question or suggestion 3:

Usually the VB programmers doesn't know how to print directly in device contexts, most of us use the Print, Line, Circle functions that can be used in pictureboxes, forms and in the Printer object. Is there a way to copy the content of a picturebox to the hDC in the PrintPage event? Or can we use this funcions in the control?


Question or suggestion 4:

Can we print HTML from the WebBrowser control?


Finally: Sorry by my bad english.

And thank you by your work! It is very valuable.

Product: Xtreme SuitePro (ActiveX) version 15.2.1
Platform: Windows XP SP2
Language: Visual Basic 6 SP6
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.141 seconds.