Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Problem With Print, Page Setup, And Print Preview In A Text Editor...


Yes, I have another question.

When I use these exact same functions (with WebBrowser.ExecWB in place of txtScrapbook.Text) in my web browser, it works perfectly. But when I use them in reference to a text box, it doesn't.

Can you tell me where the problem lies, or give me an alternative method? I have a common dialog box already for other functions, so feel free to make use of it if you need to. Thanks.

Code:Private Sub PageSetup_Click()
txtScrapbook.Text OLECMDID_PAGESETUP, OLECMDEXECOPT_DODEFAULT
'opens page setup dialog
End Sub

Private Sub Print_Click()
txtScrapbook.Text OLECMDID_PRINT, OLECMDEXECOPT_PROMPTUSER
'opens common dialog box prompting user to print current web page/parts of current web page
End Sub

Private Sub PrintPreview_Click()
txtScrapbook.Text OLECMDID_PRINTPREVIEW, OLECMDEXECOPT_DODEFAULT
'opens print preview dialog
End Sub




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Printing Using Rich-text Editor With Page Ejects In A Single Print Job
Hi everybody,
I have made a print utility using the Rich text editor control. The output to be printed is first displayed on a rich text editor control and on clicking the print command button, it is printed using the SelPrint method. To have page eject, I used the SelPrint method for every page. But the drawback of this method is that for every page a seperate print job is generated. Is there any way I can print all the pages in a single print job and also have page ejects between pages ?

Multiple Page Print Preview
when i use report.show it only shows one page instead of the many that should be their. how do i get itto show multiple pages


thanks

Loading A Doc To Show Up In Print Preview Page
Hi All,

My little project reads in a word doc. I want to know how I can have that doc viewed as a print preview page and have all the options that a print preview page would. any help would be most gratefull.

Kind Regards

Loftty.

Loading A Doc To Show Up In Print Preview Page
Hi all,

I have posted about how have a print preview on my project, I have another problem if you have a look at my project you will see that I choose a doc to load in but when I preview the doc I get no page to preview, could someone help me so I can combine the 2 so that the page I load up will show in the print prview page.

Thanks for any help

Loftty

HOWTO : Print Preview - RTF File With Page Layout
Hi,

I have a RTF File .. Before I send it to the Printer . I want to show it for Print Preview with Page Layout .. How can I simualate this facility in my application..

Let me Know ASAP

Regards

Prasad
(kpra24@hotmail.com)

How Can I Setup Print Page To Half Of A4 Page With Datareport?
I would like to print selling bill ,and the size of page is half of A4 pagesize,
How do coding with datareport?
Thanks in advance..

Page Setup In Printer.print
hi nid help on the page setup in printer.? how will i set the printing of text in a landscape paper setup? thanks

Print Preview - How To Get The Real Print Size In Picture Box???
im previewing the print area in a picture box, but picture box
is little , How can I fit the page I want to print into the visible picture in picture box?
Im using a .bmp file as pic.

JCI

Scaling Text In A Print Preview
Either way Peet, I just want the text to scale down according to the scale percent.

Jeff

Print Preview From Textbox And Print Function
I would like to add print button in my application so that user can print from information they enter in the textbox but then user also can view it first before it will print out. Can anyone give me an example regarding this, coz i sort of blur how to do this

Print Preview, Resizing Text In Picturebox
I'm trying to produce a print preview using a picturebox control

The text to be printed is sent to a picturebox control rather than the printer.

The picturebox control dimensions are the same as for the printer page size.

That all works, the problem i have is that I don't know how to resize the picturebox in a way that will also resize the text on it.

The paintpicture method only seems to work for image files
I think there is a way to do this or is there?

Print Preview Many Pages Text In Picturebox With AutoRedraw = False
I'm using a the picture box method to preview and print text reports because Crystal Reports and data designer will not do what I need.

I created a control array and set the visible property to false
before incrementing the Index for each new page keeping only the current page visible.

This works fine with just a few pages, but when I hit about 60 pages I run out of memory with an autoredraw error. So I set the Autoredraw = false, low and behold a blank page.

Two questions:

1) the method of setting the visible property to view or hide pages may actually clear the page since the autoredraw = false.

AutoRedraw property is False.

visual basic code:--------------------------------------------------------------------------------
With Picture1
.Visible = False
.Visible = True
End With

doesn't that clear picture1?

2) how do I repaint or redraw the page that is currently visible when the autoredraw = false?

Thanks for any input.

maybe this method will not work....

Print, Print Preview...[RESOVLED]
Hello,

I have a main form that has two buttons. One is a "Print Setup" button that uses a commonDialog on the main form to show the printer setup. The other button, "Print Preview" shows a form with a picturebox which size is based on Printer.width and Printer.Height. It also uses it's on commonDialog to show the printer dialog before printing. Now the first button shows the printer setup and the second button shows the printer dialog.

So....before I start the program, if my printer settings are portrait then that is what my picturebox looks like on my preview form. If my printer settings are landscape then that is what it looks like.

Now to my problem.....When I run my program and click "Printer Setup" on the main form...and change the "portrait" and "landscape" settings...they do not change when I click on the "Print Preview" button. In other words, my picturebox on the Print Preview form does not change to the corresponding printer size.

I think I need to somehow load the new printer settings after I change them on the main form and before I click "Print Preview". I hope this is clear enough and I thank you for your help.

Print And Print Preview Option
hi,
Can any one tell me how can implement print and print preview option in my application.

Actually iam developing an application, in that iam opening images in picture box, so planning to give print and printview option in my application. can any one suggest me how should i implement this.

Regards
Santosh.K

Print And Print Preview The Forms
Is there a way to print and print preview the forms of a VB program from the same program ...

Print And Print Preview Option
hi,
Can any one tell me how can implement print and print preview option in my application.

Actually iam developing an application, in that iam opening images in picture box, so planning to give print and printview option in my application. can any one suggest me how should i implement this.

Regards
Santosh.K

How To Print Images That Fit To The Page Size Specified In Print Common Dialog?
i need some help in printing the whole image tat fit onto the paper size i specified in Print Common Dialog. I hav a PictureBox array & each PictureBox contains a smaller Picturebox inside. For example : Picture1(index) has a smaller Picture2(index) inside. There are vertical & horizontal scrollbars next to each Picture1(index).

i already hav the basic Print Common Dialog code below. Here's the problem -> I can print out the pictures displayed inside Picture2(index) but the printout will turn out truncated or just part of the whole picture when im printing to a 4R photo size for example and the image displayed in Picture2(index) is larger then the bounding Picture1(index) & i need to use the scrollbars to scroll and view the other portions of the image.

So how to modify the code below to print out the whole image tat fit nicely to the paper size i specified. Thanxs.


'---------------------------------------------------------------------
'CODE
'---------------------------------------------------------------------

CommonDialog1.CancelError = True
On Error Resume Next

CommonDialog1.Action = 5 ' Start the Print Common Dialog

If (Err.Number = cdlCancel) Then Exit Sub
'when Cancel is pressed, exit subroutine

'Code to print the array here

For Pics = Picture2.LBound To Picture2.UBound
If Picture2(Pics).Picture > 0 Then ' If the PictureBox is not empty
Printer.PaintPicture Picture2(Pics).Picture, 0, 0
Printer.EndDoc
End If
Next

'---------------------------------------------------------------------

Print Picture Box (print A Form That Is Too Large For The Screen Or Page)
I got a picture box (Picture1), which contain several picture box'es, labels and
Flex Grid tables, -which I would like to print. Picture1 is quite high (higher than the screen). I found some code that i modified, but the printing only get the labels proper. The Flex Grids and picture box'es only show the border, and not the contents.

Code:Private Const WM_PAINT = &HF
Private Const WM_PRINT = &H317
Private Const PRF_CLIENT = &H4& ' Draw the window's client area.
Private Const PRF_CHILDREN = &H10& ' Draw all visible child windows.
Private Const PRF_OWNED = &H20& ' Draw all owned windows.

Private Declare Function SendMessage Lib "user32" Alias _
   "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, _
   ByVal wParam As Long, ByVal lParam As Long) As Long


Private Sub Print_Click()
Dim rv As Long
   Me.ScaleMode = vbTwips ' default
   With Picture2
      .Top = Picture1.Top
      .Left = Picture1.Left
      .Width = Picture1.Width
      .Height = Picture1.Height
   End With
   Me.Visible = True
   DoEvents
   Picture1.SetFocus
   Picture2.AutoRedraw = True
   rv = SendMessage(Picture1.hwnd, WM_PAINT, Picture2.hDC, 0)
   rv = SendMessage(Picture1.hwnd, WM_PRINT, Picture2.hDC, _
   PRF_CHILDREN + PRF_CLIENT + PRF_OWNED)
   Picture2.Picture = Picture2.Image
   Picture2.AutoRedraw = False

   Printer.Print ""
   Printer.PaintPicture Picture2.Picture, 0, 0
   Printer.EndDoc
End Sub



Edited by - Zigar on 11/27/2003 3:31:21 AM

Text Box Print Setup
text box print setup ...?

Print Column Header On Each Print Out Page
I am trying to put the header of each column on each print out page.
Right now I have it only appearing on the first page of my printouts.

How do you do that in Excel 2003?

Text File Formfeed Or Print To Next Page
Hi,
I created a text file and wanted to print it. The problem is the printer does not know when to print to the next page. I tried attaching a chr(12) in my text file wishing that the printer would read it as a form feed but nothing happens, it just print the chr(12)

How To Get Text To Print In The Center Of The Page Along The X Axis.
How do I center text that is entered in a textbox, by a user, along the x axis. I can change the cursur location using currentx and currenty to center text that has known amount of characters. But I want to center the text no matter how many characters the users enters.

Here is what i have been using:
        Printer.Font.Name = "Times New Roman"
        Printer.CurrentX = 5000
        Printer.CurrentY = 5000
        Printer.Font.Size = "200"
        Printer.Print txtPrice.Text

txtPrice.Text is a price and if the user enters a large dollar amount(like $100.00), the price won't be center on the page, because of the cordinates that I have used only center prices like 1.99 or .99.
Hopefully I explained this correctly.
Any help will be greatly appreciated.

Print And Print Preview?
I create .html file from code and show it in web browser control. I'm wondering what is best way to have print preview capability in may vb application for .html files, and how to count how many pages will be print from .html file.

thanks j

Print And Print Preview With Api
Greetings,

Does anyone know how to Preview a HTML page with api and then eventualy print it ?
or just print the HTML page for that sake.

Thanks in advance!


-Lumin

Print Image Full Page With Text Overlay?
Hey all,
As a possible solution to this thread, I've decided it might be easier to make the pdf pages i need into seperate images and print the images (taking up a full sheet of paper) with a text overlay of the text i was trying to put in the pdf fields when I need to. My only problem is that I have absolutely no idea how to do that.

I need to make sure the image file stretches across an entire page, and there needs to be a way to put text on top of the image file (so it appears as if the text is actually right where someone would write information).

Any pointers? Any help would be great, I don't mind using the API at all, and I'm willing to do a hunk of this myself..I just need some direction.

HELP Print Listview Print To Many Page
HI
I am using this to print Listview
When I print 1 page then it is ok but

if data from Listview go on 3 or 4 page then fyrst page is ok
efter fyrst page I only get 1 data on on each page
so this can be many page

Can somone help me what is wrong in this ??


Printer.Font = "Tahoma"
Printer.FontBold = True
Printer.FontUnderline = False
Printer.FontSize = 10
Printer.Print "Print from listview"
Printer.FontUnderline = False
Printer.Print vbNewLine

Printer.CurrentX = 1440
Printer.CurrentY = 1440

PrintListView lvwDataCopy

Printer.EndDoc

Private Sub PrintListView(lvw As ListView)
Const Margin = 60
Const COL_MARGIN = 240

Dim ymin As Single
Dim ymax As Single
Dim xmin As Single
Dim xmax As Single
Dim num_cols As Integer
Dim column_header As ColumnHeader
Dim list_item As ListItem
Dim i As Integer
Dim num_subitems As Integer
Dim col_wid() As Single
Dim X As Single
Dim y As Single
Dim line_hgt As Single

xmin = Printer.CurrentX
ymin = Printer.CurrentY

' ******************
' Get column widths.
num_cols = lvw.ColumnHeaders.Count
ReDim col_wid(1 To num_cols)

' Check the column headers.
For i = 1 To num_cols
col_wid(i) = _
Printer.TextWidth(lvw.ColumnHeaders(i).Text)
Next i

' Check the items.
num_subitems = num_cols - 1
For Each list_item In lvw.ListItems
' Check the item.
If col_wid(1) < Printer.TextWidth(list_item.Text) _
Then _
col_wid(1) = Printer.TextWidth(list_item.Text)

' Check the subitems.
For i = 1 To num_subitems
If col_wid(i + 1) < _
Printer.TextWidth(list_item.SubItems(i)) _
Then _
col_wid(i + 1) = _
Printer.TextWidth(list_item.SubItems(i))
Next i
Next list_item

' Add a column margin.
For i = 1 To num_cols
col_wid(i) = col_wid(i) + COL_MARGIN
Next i

' *************************
' Print the column headers.
Printer.CurrentY = ymin + Margin
Printer.CurrentX = xmin + Margin
X = xmin + Margin
For i = 1 To num_cols
Printer.CurrentX = X
Printer.Print FittedText( _
lvw.ColumnHeaders(i).Text, col_wid(i));
X = X + col_wid(i)
Next i
xmax = X + Margin

Printer.Print
line_hgt = Printer.TextHeight("X")
y = Printer.CurrentY + line_hgt / 2
Printer.Line (xmin, y)-(xmax, y)
y = y + line_hgt / 2

' Print the rows.
num_subitems = num_cols - 1
For Each list_item In lvw.ListItems
X = xmin + Margin

' Print the item.
Printer.CurrentX = X
Printer.CurrentY = y
Printer.Print FittedText( _
list_item.Text, col_wid(1));
X = X + col_wid(1)

' Print the subitems.
For i = 1 To num_subitems
Printer.CurrentX = X
Printer.Print FittedText( _
list_item.SubItems(i), col_wid(i + 1));
X = X + col_wid(i + 1)
Next i

y = y + line_hgt * 1.5
Next list_item
ymax = y

' Draw lines around it all.
Printer.Line (xmin, ymin)-(xmax, ymax), , B

X = xmin + Margin / 2
For i = 1 To num_cols - 1
X = X + col_wid(i)
Printer.Line (X, ymin)-(X, ymax)
Next i
End Sub

Print A Page Without My Print Button!!!
My question concern my web page:
How can i print an html page without it's print button.

I figure out how to hide the button when pressed(with layers)
but when it's finish printing or the user cancel,
how can i make the button visible,i know how but on
what event.

some1 have an idea??

Print Preview
This below is the code I have, and I'd like to use the print preview method. But not sure how it works.

Private Sub cmdprint_Click()
Dim y As Integer
Set DatabaseWorkSheet = sheets("database")
y = bound3 + 11
DatabaseWorkSheet.Activate
Range(Cells(7, 1), Cells(y, 14)).Select
ActiveSheet.PageSetup.PrintArea = "$A$7:$N$" &amp; y
ActiveWindow.PrintPreview ----&gt; This crashes the program.
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
ActiveSheet.PageSetup.PrintArea = ""
Range("A12").Select
End Sub

Thanks,

TXK

Print Preview
Hi,

freaky one here... In Excel, when you Print Preview something and close the Print Preview, there is a line visible showing what is the "print area"... Is it possible to hide it?

Print Preview
is there anyway to make a print preview that looks exactly like the one used in notepad 5. something (the one that came with xp pro) im have a print preview but its really not that great. The print preview code i have right now is as follows;

Code:
Private Sub mnuPageSetup_Click()
On Error GoTo err
DCPrint.Flags = &H40
DCPrint.CancelError = True
DCPrint.ShowPrinter
err:
End Sub

thanks

MS Print Preview
I'm trying out this code here

http://support.microsoft.com/default...79&Product=vb6


It works and the preview looks centered in the picture box, but no matter what printer I try it on, it prints offset to the right.

Any ideas?


Thanks

Print Preview
Hi guys

I'm using some methods like:

Code:
Printer.Print "Hi !!"
Printer.CurrentX = 13
Printer.CurrentY = 12
Printer.PaintPicture Picture1.Picture, 1, 1
Printer.EndDoc

Is there a way to preview the page in a window ?
Maybe an OCX Control that takes whatever I'm sending to the spool, and show in a window or something like that ?
Just to have an idea of how it will be printed !

Thanx a lot for any help ! =D

Print Preview
Hey, I need to know how to create a print preview. I can get the text with its formatting onto the print preview form, but I need to make it change the text when the user clicks a button if there's more than 1 page's worth of text. I also don't know how to detect if there is more than 1 page's worth.

Thanks,
Kid

Print Preview?
I have a print preview function in my program and i would like it to display pictures from my richtextbox is there a way of doing this?

Print Preview
hi having problems with my print report program.. im only using the textbox to print the data. here comes the problem, want i wanted to do is to have a form that functions like a print preview in msword were i could see if the data xceeded the paper size, so i can change font size to be able to fit it to wat ever size i wanted.. is there a way to do this in VB WITHOUT using any report program such as crytal or others? ..thanks hopefully you could give me links or tutorials, THANKS again, SORRY if i missed posted just dont know were i could place this.

Print Preview..
hey all......
ive made an app in vb for accounting purposes.....using the printer object which lets me print the putput into the default printer...
is there any way i can let the user view the print preview before printing??

Print Preview
Also does anyone know how to add a print preview function in a VB App? I need to preview what the file in a Richtextbox look like when printed. Does anyone know how to add this print preview function?

Print Preview
Does anyone know how to write code in VB for a print preview button? I want the program to give me a preview of a richtextbox1, just like in Word.

Print Preview
Is there a way to make a print preview of a report in VB6...??
I use the printer object and i'd like to preview before printing...

Rufen

Print Preview
I would like to create form for preview the document before printing. My form name is "Preview". I want to show this form when I clicked command button "preview" from Form1 and will showed up the document extract from Form1 to thie form "Preview".

Ok, my Form1 have picturebox name "Picture1", How I can send the picture image to the the "Preview" form? In my preview form have picturebox also named as "Picture2"

Rtf Print Preview
Does anyone know of an accurate rtf print preview. I have tried a few, commercial and free without being accurate. When pictures are added to a mulitiple page print out the previews they are never accurate. They all print the pictures but leave half the page blank and start a new page.

Rtf Print Preview
Does anyone know of a good rtf print preview for vb6. Not looking for free

Vb6 Print Preview
i'm trying to do an application in vb 6, and what i want is, do a print preview of the form i'm gonna print.

any ideas about the code i should write?

thanks

Print Preview
Hey ,
i want to print my datareports
but before that i want to see Print Preview...
plz. help..
thanks in advance

Jicks

Print Preview
Hi All,

My little project reads in a word doc. I want to know how I can have that doc viewed as a print preview page and have all the options that a print preview page would. any help would be most gratefull.

Kind Regards

Loftty.

Print Preview
Does anyone out there know how i can get the exact print preview that is in notepad 5.1. I also have one more quick question i hope, does anyone know how i could call the notepad help topics. I really dont want to make one if i can use an already professionally made one. thanks alot

Print Preview
I was wondering, how can I call that "API" to show a print preview form?

Print Preview
quick question...

how do i show a print preview in a text box???

Print Preview
hi all,

how to print preview when using Printer.Print Object.....

Copyright © 2005-08 www.BigResource.com, All rights reserved