1
votes

There is a problem that I use vba to print word document to pdf file but the pdf files sometimes are not same as word.

Example.

1.The pdf file page is not same as word document page.

The Word Document is 10 pages.

The PDF file is 9 pages.

2.Word Document will just print the half to pdf.

The last page of word document maybe is 200 words but the pdf file only have 120 words.

I have a way to check this problem.

1.Check the page.

2.Check the last ten word is the same or not.

But there is a problem that the special symbol like "≦" can't be read by vba and can't be read by Acrobat API.

Any idea can handle it?

1

1 Answers

1
votes

Instead of "≦" use "<=". If you have Acrobat.tlb reference than the number of pages is something like

Dim oPapp As Acrobat.AcroApp
Dim oPDDoc As Acrobat.AcroPDDoc
Dim docPages as Long
Set oPapp = CreateObject("AcroExch.App")
Set oPDDoc = CreateObject("AcroExch.PDDoc")
oPDDoc.Open ("C:\test.pdf")
docPages = oPDDoc.numPages