We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Code to start page number as one in PDF using aspose.pdf


There is one requirement to convert uploaded word document into PDF.

I have implemented PDF conversion. But the page number is getting displayed from page number TWO. The Page number ONE is not displaying.

Could you please suggest me the property to start page number dispaly from page number ONE.

Thanks and Regards,


Hello Manohar,

Thanks for using our products.

Can you please share the source word document and the code snippet that you are using, so that we can test the scenario at our end.

We apologize for your inconvenience.

Please find the requested code below.

docAgenda = New Document

Total number of document
intCount = dataTbl.Rows.Count - 1
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

'To append all content

For i = 0 To intCount

'Separate function to get docunment heading
docGray = Utils.GetGrayDocTemp(ConfigurationManager.AppSettings("LicenseFilepath"), dataTbl.Rows(i)

If Not IsDBNull(dataTbl.Rows(i)("docContent")) Then

To start new page number for each ne document.
pdf.IsPageNumberRestarted() = True

'separate function To get the File content
docDocument = Utils.GetDocument(dataTbl.Rows(i)("docContent"), refNum)

If Not IsNothing(docDocument) Then
'Separate function to append the every document heading with content
Utils.AppendContent(docGray, docDocument)
Dim paragraphColl As NodeCollection = docGray.GetChildNodes(NodeType.Paragraph, True)
For Each par As Paragraph In paragraphColl
par.ParagraphFormat.KeepWithNext = False

'Apend the document
Utils.AppendDoc(docAgenda, docGray)
End If
docDocument = Nothing
End If
docGray = Nothing
docAgenda.Save(tempLoc, SaveFormat.AsposePdf)
Dim xmlDoc As XmlDocument = New XmlDocument
pdf.IsImagesInXmlDeleteNeeded = True
pdf.BindXML(xmlDoc, Nothing)
pdf.IsTruetypeFontMapCached = False

docDocument = Nothing
docGray = Nothing

strPdfloc = ConfigurationManager.AppSettings("CompileFileFolder")
strPdfloc = strPdfloc & "PDF\\" & refNum & ".pdf"
docAgenda = Nothing
PDFFlag = "Y"

Return PDFFlag


Thanks for sharing the code snippet.

Can you please save the copy of word document before its contents are saved in XML format. i.e. before the following code line is executed docAgenda.Save(tempLoc, SaveFormat.AsposePdf) and share that word document, so that we can try the conversion process at our end.

We are sorry for your inconvenience.


Please find the requested document.

Thanks and regards,



Thanks for sharing the resource file.

As far as I can see the source word document does not contain any page number information. So after the conversion, the resultant PDF document does not contain any page number information. Can you please take a look over this matter.