Displays Page X of X insted of Page X of Y

The Amyuni PDF Converter is our Printer Driver that enables you to convert any documents to PDF format. If you have any questions about installing and using the Amyuni PDF Converter please post them here.
Post Reply
Sanjay
Posts: 2
Joined: Thu Aug 30 2012

Displays Page X of X insted of Page X of Y

Post by Sanjay »

We are using Amyuni Document Converter 450 (Amyuni 4.5.2.3) to convert word document to pdf. In the word document, we have page numbers in footers in the format of Page X of Y. However when it is converted to pdf, the pagination gets messed up for some documents (not all documents). Instead of showing Page X of Y, it shows Page X of X, Page Y of Y. So for 3 pages documents, it shows Page 1 of 1, 2 of 2, 3 of 3 instead of 1 of 3, 2 of 3, 3 of 3.

I even tried converting the word document to pdf using a vb script code as outlined in the post http://www.amyuni.com/forum/viewtopic.php?f=2&t=2832 and still get the same result.
But if I try to save the same word document to pdf using MS Word's Save As feature, the converted pdf has correct pagination.
Is there anything Amyuni Document Converter is not setting correctly?

Amyuni Printer is installed on Windows 2008 R2 OS and MS Office used is 2010
Any help would be appreciated.

Thanks.
Jose
Amyuni Team
Posts: 553
Joined: Tue Oct 01 2002
Contact:

Re: Displays Page X of X insted of Page X of Y

Post by Jose »

Hello,

I’m not sure if this is being caused by the PDF Converter? The PDF Converter basically prints out what the printing application sends to it.
Have you tried printing to another printer?

Thanks
Get PDF Suite, the expert .NET developer toolkit for PDF conversion, creation and editing - www.amyuni.com/pdfsuite
Sanjay
Posts: 2
Joined: Thu Aug 30 2012

Re: Displays Page X of X insted of Page X of Y

Post by Sanjay »

Jose wrote:Hello,

I’m not sure if this is being caused by the PDF Converter? The PDF Converter basically prints out what the printing application sends to it.
Have you tried printing to another printer?

Thanks
Jose,
Thanks for the reply. When printing with another printer, it shows the correct pagination. The issue occurs only when printing with Amyuni PDF Converter.

Thanks,
Devteam
Posts: 119
Joined: Fri Oct 14 2005
Location: Montreal
Contact:

Re: Displays Page X of X insted of Page X of Y

Post by Devteam »

After further investigation, we determined that this issue happens with all printers. When the active printer is changed before printing, MS Word will correctly pint "Page X of Y". Here are two scenarios, one will work and the other will not:

Not Working scenario:
- System default printer set to "Printer A"
- The user or developer calls a macro to print the document on "Printer A", e.g. of such a macro:

Code: Select all

Set objWord = CreateObject("Word.Application") 
set docWord = objWord.Documents.Open(strFileName) 

objWord.ActivePrinter = "Printer A"
docWord.Printout(0) 
docWord.Close (0)
objWord.Quit 
- This case will not work because the instruction objWord.ActivePrinter = "Printer A" will not do anything, "Printer A" being already the active printer

Working scenario:
- System default printer set to "Printer B"
- The user or developer calls a macro to print the document on "Printer A", e.g. of such a macro:

Code: Select all

Set objWord = CreateObject("Word.Application") 
set docWord = objWord.Documents.Open(strFileName) 

objWord.ActivePrinter = "Printer A"
docWord.Printout(0) 
docWord.Close (0)
objWord.Quit 
- This case will work because the instruction objWord.ActivePrinter = "Printer A" will change the active printer from "Printer B" to "Printer A".

To resolve the issue and make sure you obtain "Page X of Y" when automating the printout to any printer, follow these steps:
- Set the system default printer to any printer other than the one you are printing to
- Within your macro, save the active printer, print to your destination printer, then restore the previous active printer. E.g. of working code:

Code: Select all

Set objWord = CreateObject("Word.Application") 
Set docWord = objWord.Documents.Open(strFileName) 

' if the active printer is already set to Printer A, warn the user that the printout will be wrong
if objWord.ActivePrinter = "Printer A" then
    MsgBox "Change system default printer to a printer other than Print A and retry"
    exit
end if

saveActivePrinter = objWord.ActivePrinter    ' store current active printer
objWord.ActivePrinter = "Printer A"
docWord.Printout(0)
objWord.ActivePrinter  = saveActivePrinter    ' restore previous active printer
docWord.Close (0)
objWord.Quit 

Set objWord = Nothing
Set docWord = Nothing
Amyuni Development Team

Efficient and accurate conversion to PDF, XPS, PDF/A and more. Free trials at - https://www.amyuni.com
Post Reply