Planet PDF Forum Archive

Planet PDF ForumWowsers! This is page is old, head to the LIVE Planet PDF Forum. It features more than 10 conferences, covering everything from beginner to in-depth developer and pre-press discussions. If you wish to continue... one & two archive covers 1999-2011 (160,000 pages).

New Forum | Previous | Next | (P-PDF) Developers

Topic: Page Number Field Added via VB.NET Not Printing on Landscape page, 1 Attachments
Conf: (P-PDF) Developers, Msg: 78313
From: ao730
Date: 12/17/2002 10:50 PM

I compile a weekly report for the managers in MNT from approximately 15 other reports all in pdf format. The report is then page numbered using a routine I wrote in VB6, but have since ported to VB.NET. Regardless of which version I use the fields added have some strange behaviors, On the portrait pages the field works as expected, however on the landscape pages the field will always look okay on screen, however when I print it out the field will sometimes be a mirror image, ie "Page 18 of 22" will be "22 fo 10 egaP" (actually the letters will be mirrored as well), or the field will not print at all.

I took care of the first problem by having the code locate the field more to the left and up then originally coded.

The not printing has me baffled, I've attached a copy of a page that does not print the field. The visible property is True

The work around I use is to open the document, and use the form tool to move the field and then it prints.

I suspect the picture on the page is in front of the page number field, but not that knowledgeable of the Acrobat underlying structure to be sure.

Oh yeah, I'm using Acrobat 4 still, our IT group won't upgrade to 5 till version 6 is on the street, that what all the bugs have been worked out of 5 (Go figure).

Anyway, if anyone has seen this behaviour or has a work around I'd appreciate your feedback.

Here's the code I'm using with the errorhandling removed (

Public Function Numberpdf()
Dim Exch As Acrobat.CAcroApp
Dim PDDoc As Acrobat.CAcroPDDoc
Dim AVDoc As Acrobat.CAcroAVDoc
Dim PDPageView As Acrobat.CAcroAVPageView
Dim PDPage As Acrobat.CAcroPDPage
Dim Points As Acrobat.CAcroPoint
Dim Field As AFORMAUTLib.Field
Dim Fields As AFORMAUTLib.Fields
Dim AFormAut As AFORMAUTLib.AFormApp
Dim filename As String
Dim strFieldName As String
Dim strFieldValue As String
Dim firstPage As Integer
Dim Page As String
Dim Top As Integer
Dim Right As Integer
Dim left As Integer
Dim Bottom As Integer

Dim Loopy As Short
Const PDSaveIncremental = 0
Const PDSaveFull = 1
Const PDSaveCopy = 2
Const PDSaveLinearized = 4
Const PDSaveBinaryOK = 10
Const PDSaveCollectGarbage = 20
Dim bOk As Boolean
'On Error Resume Next

Select Case cbFirst.CheckState
Case CheckState.Checked
firstPage = 0
Case CheckState.Unchecked
firstPage = 1
Case CheckState.Indeterminate
firstPage = 1
End Select

OpenFileDialog1.Filter = "Adobe (*.pdf) | *.pdf"
filename = OpenFileDialog1.FileName

Exch = CreateObject("AcroExch.App")
AVDoc = CreateObject("AcroExch.AVDoc")
PDDoc = CreateObject("AcroExch.PDDoc")


AVDoc.Open(filename, "")

AFormAut = New AFORMAUTLib.AFormApp()

Fields = AFormAut.Fields
PDDoc = AVDoc.GetPDDoc
PDPageView = AVDoc.GetAVPageView
Dim myField As AFORMAUTLib.Field

For Loopy = firstPage To (PDDoc.GetNumPages - 1)
PDPageView = AVDoc.GetAVPageView
PDPage = PDPageView.GetPage
Points = PDPage.GetSize
Page = "Page" & Loopy
left = Points.x - 150
Top = 35
Right = Points.x - 75
Bottom = 10
myField = Fields.Add(Page, "text", Loopy, left, Top, Right, Bottom)
myField.TextSize = 10
myField.Value = "Page " & (Loopy + 1) & " of " & PDDoc.GetNumPages
Next Loopy

SaveFileDialog1.FileName = filename
SaveFileDialog1.Filter = "Adobe (*.pdf) | *.pdf"
filename = SaveFileDialog1.FileName

PDDoc = AVDoc.GetPDDoc
PDDoc.Save(PDSaveFull + PDSaveCollectGarbage, filename)
PDDoc = Nothing
AVDoc = Nothing
Exch = Nothing

Click to open!Pages from Weekly Report 021202.pdf
Page Number won't print (16,082 bytes)

PDF In-Depth Free Product Trials Ubiquitous PDF

Debenu Aerialist

The ultimate plug-in for Adobe Acrobat. Advanced splitting, merging, stamping, bookmarking, and link...

Download free demo

Debenu PDF Tools Pro

It's simple to use and will let you preview and edit PDF files, it's a Windows application that makes...

Download free demo

Five visions of a PDF Day

In the world of PDFs or as we like to say Planet (of) PDF, a year isn't a real PDF year without an intense few days of industry knowledge sharing.

May 15, 2018
Platinum Sponsor

Search Planet PDF
more searching options...
Planet PDF Newsletter
Most Popular Articles
Featured Product

Debenu PDF Aerialist

The ultimate plug-in for Adobe Acrobat. Advanced splitting, merging, stamping, bookmarking, and link control. Take Acrobat to the next level.


Adding a PDF Stamp Comment

OK, so you want to stamp your document. Maybe you need to give reviewers some advice about the document's status or sensitivity. This tip from author Ted Padova demonstrates how to add stamps with the Stamp Tool along with related comments.