Paper Size

Stimulsoft Reports.NET discussion
Post Reply
jing
Posts: 50
Joined: Fri Jan 26, 2007 12:47 am
Location: New Zealand

Paper Size

Post by jing »

In one of the old forum
shmuly wrote:
Is there a way to create my own paper sizes?

Vital wrote:
You can change page width and page height with propeties grid. You can't change list with predefault page sizes.


shmuly wrote:
Is there a way to specify which tray in the printer each page should print from?

Vital wrote:
At this moment no. We planning release this feature in next version.

Thanks you.
I have a few questions

1) Can you change page width and page height via code (vb. net) ? How?
2) How do you set a printer for the report via code?
2) Can you change the predefault page sizes based on the printer you selected via code?

thanks
Vital
Posts: 1278
Joined: Fri Jun 09, 2006 4:04 am

Paper Size

Post by Vital »

1) Can you change page width and page height via code (vb. net) ? How?
For example:

Code: Select all

Dim Page As StiPage = report.Pages.Item(0)
Page.PageWidth = 21
Page.PageHeight = 29,7
2) How do you set a printer for the report via code?
1. You can use following code:

Code: Select all

report.Print(PrinterSettings)
In PrinterSettings you can specify printer name.

2. You can use property

report.PrinterSettings.PrinterName
3) Can you change the predefault page sizes based on the printer you selected via code?
Can you explain what you mean "predefault page size"?

Thank you.
jing
Posts: 50
Joined: Fri Jan 26, 2007 12:47 am
Location: New Zealand

Paper Size

Post by jing »

Can you explain what you mean "predefault page size"?
I mean the drop down list in the page setup when you are in the Designer. It populates with things like A4, Letter etc.

The reason I ask is because I am trying to set the default printer to a label printer. I can setup the paper sizes via the label printer, so I am wondering whether I can populate that "predefault page size" list in the Designer, with the setup from the label printer...


thanks
Vital
Posts: 1278
Joined: Fri Jun 09, 2006 4:04 am

Paper Size

Post by Vital »

We use following code for fill list of page sizes:

Code: Select all

PrinterSettings printerSetting = new PrinterSettings();

foreach (PaperSize ps in printerSetting.PaperSizes)
...
So you see list of page sizes from default printer.
We have added new static property StiOptions.Print.CustomPaperSizes. You can assign your own collection of paper sizes to this property.
New property will be available in build from 12 Feb. For also you can request latest version at support [at] stimulsoft [dot] com.

Thank you.
jing
Posts: 50
Joined: Fri Jan 26, 2007 12:47 am
Location: New Zealand

Paper Size

Post by jing »

I have tried the following code when making the designer "report"

Code: Select all

    Dim Page As StiPage = report.Pages.Item(0)


            Dim printerSetting As New PrinterSettings()
            printerSetting.PrinterName = "Datamax E-4203"

            StiOptions.Print.CustomPaperSizes = printerSetting.PaperSizes


            For Each ps As PaperSize In printerSetting.PaperSizes
                Page.PageWidth = ps.Width
                Page.PageHeight = ps.Height

                Dim margin As New StiMargins(printerSetting.DefaultPageSettings.Margins.Left, printerSetting.DefaultPageSettings.Margins.Right, printerSetting.DefaultPageSettings.Margins.Top, printerSetting.DefaultPageSettings.Margins.Bottom)

                Page.Margins = margin
            Next

The designer runs fine and the "Predefault page size" were listed, but when I try to change the predefault page size using the drop down box, an error occured
"Index was outside the bounds of the array"

Any help please?

thanks
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

Paper Size

Post by Edward »

The designer runs fine and the "Predefault page size" were listed, but when I try to change the predefault page size using the drop down box, an error occured
"Index was outside the bounds of the array"
Fixed.

Please take the build from the February, 12.

Please use appropriate unit conversion in the following string:

Code: Select all

Page.PageWidth = ps.Width
So if the report unit is inches you need transform your code as following:

Code: Select all

Page.PageWidth = ps.Width/100
Thank you.
jing
Posts: 50
Joined: Fri Jan 26, 2007 12:47 am
Location: New Zealand

Paper Size

Post by jing »

Quote:
The designer runs fine and the "Predefault page size" were listed, but when I try to change the predefault page size using the drop down box, an error occured
"Index was outside the bounds of the array"

Fixed.
I have took the build from Feb 12 and copied the files and recompiled my program... Still the same error message when I use the drop down box ....??



Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

Paper Size

Post by Edward »

Please send an example Application to Image

We still not able to reproduce error after fix.

Thank you.
Vital
Posts: 1278
Joined: Fri Jun 09, 2006 4:04 am

Paper Size

Post by Vital »

Please check build from 15 Feb.
Thank you.
Post Reply