Welcome Guest! You need to login or register to make posts.



Go to last post Go to first unread
#1 Posted : Monday, June 6, 2005 11:54:00 PM(UTC)

Rank: Member

Groups: Member
Joined: 3/2/2005(UTC)
Posts: 13


I'm having real problems changing to a custom page size, or any size when printing. This is the code how I think it should be;

        Dim MyPlaceholder As New Aurigma.GraphicsMill.WinControls.PrintPlaceholder
        MyPlaceholder.Image = New Bitmap("C:\Documents and Settings\keith\Desktop\epson\tiff\14801768f6_g.tif")
        MyPlaceholder.Footer = "test footer"

        printDoc.PlacementMode = PlacementMode.MultipleImages
        printDoc.PrintOptions.ImageAutoRotate = True
        printDoc.PrintOptions.PlaceholderAutoRotate = True
        printDoc.PrintOptions.FooterEnabled = True
        printDoc.PrintOptions.VerticalSpacing = 10
        printDoc.PrintOptions.HorizontalSpacing = 10

        Dim mypapersize As New System.Drawing.Printing.PaperSize("Custom Size", 2000, 500)
        printDoc.DefaultPageSettings.PaperSize = mypapersize

        printDoc.Source = MyPlaceholder

What would be the correct method for changing the paper size? At the moment it always comes out Letter size.

Edited by user Sunday, December 23, 2007 4:55:28 PM(UTC)  | Reason: Not specified

Alex Kon  
#2 Posted : Tuesday, June 7, 2005 7:57:00 PM(UTC)
Alex Kon

Rank: Advanced Member

Groups: Member
Joined: 1/31/2005(UTC)
Posts: 458

Was thanked: 5 time(s) in 5 post(s)

There are some troubles with custom paper size in .NET Framework. And unfortunately at this moment I have no idea about the solution. Here is some discussion, but without positive results: http://www.dotnet247.com/247reference/msgs/31/157092.aspx.

But with standard paper sizes I haven't found any problems - are you sure that paper size which you try to specify is supported by your printer? It should be member of PrinterSettings.PaperSizes collection. If it doesn't work - please send us code sample.

#3 Posted : Monday, November 14, 2005 5:05:07 AM(UTC)

Rank: Member

Groups: Member
Joined: 8/30/2005(UTC)
Posts: 5

Hi all,

I have been having so much trouble with printing a simple image on a sheet of paper in a specific location, my hair is falling out. I searched here and found that many were having printing issues as well. I tried many of the solutions and still continued to have problems. Then I fell upon an awsome discovery. Here was my problem.

(VB 6.0)

1. The page size that i needed to use was 9.5" X 7.125" which as you can see is a custom size

2. I needed to print 2 images in a specific location landscape.

3. It was no problem setting my printer to handle the custom size and it appeared to be simple.

4. I made a form the same size as my printer.object width,height,scalewidth,scaleheight and made sure that it was the same scalemode.

5. I put 2 picture boxes on the form. positioned them and removed the border and called the form.printform method.

6. It worked great but i had forgotten to make the form a white background.

7. When I made the form1.background white, and printed it (printform) the pictures moved all the way to the left side of the page. No matter what x,y coords i gave it, it continued to print far left. When I made the form.back grey again, it worked fine. I fought with this for a couple days and came up with no solution.

Today i discovered the solution by accident. Instead of using the picture control, I tried the image control and it worked great even with the form.back white. The only reason I can figure is that, as you probably know the image control has no Hdc property where the Picture control does.

So if you are having problems printing a picture on a form in a specific location, try loading the image into an image control, placing it on the form using the move method, removing the border and then printing using the printform method

Here is some code i use for moving the image around on the screen with the arrow keys before i call printform

                    'The forms key preview is set to true
                    'chng is a text box to enter the increments to move
                    'x1 is a textbox for the x coords for pic 1
                    'y1 is a textbox for the y coords for pic 1
                    ' remember to make all the controls invisible before calling printform
                    INC = CLng(chng) ' the incremants in the change
                    Select Case KeyCode
                    Case 37 ' move it left
                            X1 = CInt(X1) - INC: DoEvents
                            'prntfrm.PaintPicture Clipboard.GetData, CInt(X1), CInt(Y1) 
                            'The above can be used if the image is in the clipboard remember form1.cls after a change
                            pic.Move X1, Y1
                    Case 40 ' movce it down
                            Y1 = CInt(Y1) + INC: DoEvents
                            'prntfrm.PaintPicture Clipboard.GetData, CInt(X1), CInt(Y1)
                            pic.Move X1, Y1
                    Case 38 ' move it up
                            Y1 = CInt(Y1) - INC: DoEvents
                            'prntfrm.PaintPicture Clipboard.GetData, CInt(X1), CInt(Y1)
                            pic.Move X1, Y1
                    Case 39 'move it down
                            X1 = CInt(X1) + INC: DoEvents
                            'prntfrm.PaintPicture Clipboard.GetData, CInt(X1), CInt(Y1)
                            pic.Move X1, Y1
                    End Select

I then save the coords in the win registry so that they are there the next time the program runs without re-designating them.

SaveSetting "PhotoProcessor", "Coords", "pic1x", X1.Text
SaveSetting "PhotoProcessor", "Coords", "pic1y", Y1.Text
SaveSetting "PhotoProcessor", "Coords", "pic2x", X2.Text
SaveSetting "PhotoProcessor", "Coords", "pic2y", Y2.Text

I hope this help someone..



printing images,printer,printform

Edited by user Sunday, December 23, 2007 4:55:56 PM(UTC)  | Reason: Not specified

Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.