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
Next
'Apend the document
Utils.AppendDoc(docAgenda, docGray)
End If
docDocument = Nothing
End If
docGray = Nothing
Next
docAgenda.FirstSection.Remove()
docAgenda.Save(tempLoc, SaveFormat.AsposePdf)
Dim xmlDoc As XmlDocument = New XmlDocument
xmlDoc.Load(tempLoc)
pdf.IsImagesInXmlDeleteNeeded = True
pdf.BindXML(xmlDoc, Nothing)
pdf.IsTruetypeFontMapCached = False
docDocument = Nothing
docGray = Nothing
strPdfloc = ConfigurationManager.AppSettings("CompileFileFolder")
strPdfloc = strPdfloc & "PDF\\" & refNum & ".pdf"
pdf.Save(strPdfloc)
docAgenda = Nothing
PDFFlag = "Y"
File.Delete(tempLoc)
Return PDFFlag