Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Im looking for a formula or math calculation of ms publisher pages

The default paper size is 8.5 x 11[in] or A4 (the paper to use in printing)

**I'm finding a way to retrieved how many papers to be used during printing with Microsoft publisher pages.**

if the pagesize is tabloid(11x17[in]), what is the formula to result a**4pieces** of default paper

if the pagesize is banner(60x8.5[in]), what is the formula to result a**6pieces** of default paper

I have solve that but using different formulas, of which the code grows longer.

i got this for banner(60x8.5[in]), of which I'm not sure for other banner width and height to come

i got this for banner (24x72[in]), the result is 20 pages, which is 21pages(the correct)with A4

The default paper size is 8.5 x 11[in] or A4 (the paper to use in printing)

if the pagesize is tabloid(11x17[in]), what is the formula to result a

if the pagesize is banner(60x8.5[in]), what is the formula to result a

I have solve that but using different formulas, of which the code grows longer.

i got this for banner(60x8.5[in]), of which I'm not sure for other banner width and height to come

```
pagenum = Convert.ToDecimal(aDoc.PageSetup.PageWidth) / (Convert.ToDecimal(aDoc.PageSetup.PageHeight) - Convert.ToDecimal(aDoc.PageSetup.TopMargin))
pagenum = Math.Floor(pagenum)
If pagenum = 0 Then pagenum = 1
pagenum = pagenum * adocPageCount
```

i got this for banner (24x72[in]), the result is 20 pages, which is 21pages(the correct)with A4

```
Dim formula1 As Integer = Convert.ToUInt32(aDoc.PageSetup.PageSize.PageWidth) + Convert.ToUInt32(aDoc.PageSetup.PageSize.PageHeight)
Dim formula2 As Integer = formula1 / 792
Dim formula3 As Integer = formula1 / 612
Dim formula4 As Integer = formula2 + formula3
pagenum = formula4
```

Experts Exchange Solution brought to you by

Enjoy your complimentary solution view.

Get every solution instantly with premium.
Start your 7-day free trial.

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

PagesUsed = PageHeight * PageWidth * aDoc.PageCount

No, but I can determine the page setting if is portrait or landscape

```
Dim PubApp As New Publisher.Application
Dim aDoc As New Publisher.Document
aDoc = PubApp.Open(PathnFileName, True, False, Publisher.PbSaveOptions.pbDoNotSaveChanges)
aDoc.ActiveWindow.Visible = False
''//This only counts the page number, But not the real count of pages to be printed
Dim pagenum as Integer = aDoc.Pages.Count
If aDoc.PageSetup.PageSize.Name.Contains("Portrait") Then
''//
ElseIf aDoc.PageSetup.PageSize.Name.Contains("Landscape") Then
''//
End If
```

>>In other words, an 11x17 tabloid will be 2 pages if it's printed on 11x8.5 pages, but it'll be 4 pages if it's on 8.5x11 pages.

Ok, here's some image,

>>Assuming you can get printer output dimensions, which I'll call PrinterHeight and PrinterWidth

I'll try

thANKS, ill be back

```
Dim ps As Publisher.Printer
Dim printh As Integer = ps.PaperHeight
Dim printw As Integer = ps.PaperWidth
```

No, I can't get the printer height and widthit say's object not instance

```
Dim adocPageCount As Integer = aDoc.Pages.Count
Dim formula2 As Integer = CInt((Convert.ToUInt32(aDoc.PageSetup.PageSize.PageHeight) / 792) + 0.999)
Dim formula3 As Integer = CInt((Convert.ToUInt32(aDoc.PageSetup.PageSize.PageWidth) / 612) + 0.999)
Dim formula4 As Integer = formula2 * formula3 * adocPageCount
pagenum = formula4
```

Still it says 6 pages, even its 4 actually

with this mm to inches of 0.999mm is 0.0393307087 inches

```
Dim formula2 As Integer = CInt(Convert.ToDouble(Convert.ToUInt32(aDoc.PageSetup.PageSize.PageHeight) / 792) + 0.0393307087)
Dim formula3 As Integer = CInt(Convert.ToDouble(Convert.ToUInt32(aDoc.PageSetup.PageSize.PageWidth) / 612) + 0.0393307087)
Dim formula4 As Integer = (formula2 * formula3) * adocPageCount
pagenum = formula4
```

it says 2 pages

Ok,

this is what I got:

aDoc.PageSetup.PageSize.Pa

aDoc.PageSetup.PageSize.Pa

The aDoc.Pages.Count is 1(cause it's only 1 page of tabloid), if its 2 then we have to multiply it by 2

>>Where do 792 and 612 come from?

Ok,

http://hplipopensource.com

792in came from the default paper height of Letter or(as our default paper use)

612in is from the default paper width

Since you gave idea about print height and print width, then I used that for

thanks

Also, I was mistaken in using CInt. CInt rounds on conversion; I meant to truncate the results of the calculation. It should be Int() instead. The purpose of adding .999 and then truncating is to make sure that the results are always rounded up to the next whole number. (We still need CInt, though, to convert to Integer form.)

With a document size of 1224 x 792, the formulas should be:

formula2 = 1224 / 792: round up to 2

formula3 = 792 / 612: round up to 2

1224 / 792 = 1.55; we added .999, which gave us 2.54. With proper truncation, the result is 2. Using CInt, which rounds, the result is 3, which multipled by formula3 (value: 2) gives us 6.

Note that if the page is reoriented in landscape mode, output should fit on two pages.

So the corrected formulas should be:

```
Dim adocPageCount As Integer = aDoc.Pages.Count
Dim formula2 As Integer = CInt(Int(aDoc.PageSetup.PageSize.PageHeight / 792 + 0.999))
Dim formula3 As Integer = CInt(Int(aDoc.PageSetup.PageSize.PageWidth / 612 + 0.999))
Dim formula4 As Integer = formula2 * formula3 * adocPageCount
pagenum = formula4
```

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Visual Basic.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Experts Exchange Solution brought to you by

Enjoy your complimentary solution view.

Get every solution instantly with premium.
Start your 7-day free trial.

Can you determine whether the printer is set for portrait or landscape mode? In other words, an 11x17 tabloid will be 2 pages if it's printed on 11x8.5 pages, but it'll be 4 pages if it's on 8.5x11 pages.

Assuming you can get printer output dimensions, which I'll call PrinterHeight and PrinterWidth, your formula would be:

PageHeight = Math.Int(aDoc.PageSetup.Pa

PageWidth = Math.Int(aDoc.PageSetup.Pa

PagesUsed = PageHeight * PageWidth