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

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

Sorry, my mistake on the 792x612.
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

You'll need to calculate the amount for height and the amount for width separately. For example, a 3x13 print size will need two pages, while 7x9 needs just one (with 8.5x11 paper), but if you add height and width together, each of them is a total of 16 inches, with no way to distinguish them.

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:

>>Can you determine whether the printer is set for portrait or landscape mode?
No, but I can determine the page setting if is portrait or landscape

Dim PubApp As New Publisher.ApplicationDim aDoc As New Publisher.DocumentaDoc = 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 printedDim pagenum as Integer = aDoc.Pages.CountIf 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

I'm actually not surprised. The printer hasn't been selected when you open the file; you're not in the middle of a print job. So I think what you'll have to do is either set a standard page size, or allow the user to select what page size he plans to use for printout (perhaps from a PrintDialog that would be in your app), and then calculate the number of pages accordingly.

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

OK, let's troubleshoot. What are the values of PageHeight and PageWidth that you're getting? What is the value of formula2, formula3, and adocPageCount? Where do 792 and 612 come from? (That's not the correct ratio for either letter or A4, whatever the unit of measure is.)

>>What are the values of PageHeight and PageWidth that you're getting?
Ok,
this is what I got:
aDoc.PageSetup.PageSize.PageHeight is 1224
aDoc.PageSetup.PageSize.PageWidth is 792 ( I guess this is the default width of tabloid portrait)

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

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

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.

As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…

Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…