Hi,
I have been attempting to learn how to set up document sections in order to have different templates and to specify different templates for different pages. In looking at your online help I attempted to run the example outlined on page:
http://www.DynamicPDF.com/Support/NET_Help_Library_07_01/Document%20Sectioning.html
The following code doesnt appear to work properly in that only pages 3-5 are numbered (numbered 1of3, 2of3, 3of3 etc). Whats wrong with this? Any pointers much appreciated:
[Visual Basic]
Dim MyDocument As Document = New Document()
' Create a template object and add a page numbering label
Dim MyTemplate As Template = New Template()
MyTemplate.Elements.Add( New PageNumberingLabel( "%%SP%% of %%ST%%", 0, 680, 512, 12, Font.Helvetica, 12, TextAlign.Center ) )
' Begin the first section
MyDocument.Sections.Begin( NumberingStyle.RomanLowerCase )
' Add two pages
MyDocument.Pages.Add( new Page() ) 'Page 1
MyDocument.Pages.Add( new Page() ) 'Page 2
' Begin the second section
MyDocument.Sections.Begin( NumberingStyle.Numeric, MyTemplate )
' Add three pages
MyDocument.Pages.Add( new Page() ) 'Page 3
MyDocument.Pages.Add( new Page() ) 'page 4
MyDocument.Pages.Add( new Page() ) 'page 5
' Begin the third section specifying a section prefix
MyDocument.Sections.Begin( NumberingStyle.RomanLowerCase, "Appendix A - " )
' Add two pages
MyDocument.Pages.Add( new Page() ) 'page 6
MyDocument.Pages.Add( new Page() ) 'page 7
' Save the PDF
MyDocument.Draw("C:\MyDocument.pdf")
Document sections and templates
Re: Document sections and templates
Support · Jan 19, 2007Hello,
The reason you do not see the page numbers being added to pages 1-2 and page 6-7 is because you are not adding the template to the Begin method of the Section.
' For first section
MyDocument.Sections.Begin( NumberingStyle.RomanLowerCase, MyTemplate )
' For last section
MyDocument.Sections.Begin( NumberingStyle.RomanLowerCase, "Appendix A - ", MyTemplate )
Thanks,
ceTe Software Support Team
Re: Document sections and templates
Forum member · Jan 19, 2007Thanks very much - I have literally just given this a go!
Cheers
Re: Document sections and templates
Forum member · Jan 22, 2007I have a similar problem. I have privatetemplate which is empty and onetemplate with the header and footer/pageNumber I need.
I am trying to get the first 4 pages without Header/footer and start counting from page 5 as page 1. What I get is page 4 on page 5 instead of Page 1. (One of the calls does the job the other dotn't)
This is the code:
SetprivateTemplate(document);
document.Sections.Begin(NumberingStyle.None, privatetemplate);
AddCoverPage(document);
document.Sections.Begin(NumberingStyle.None, privatetemplate);
AddIntroPage(document);
document.Sections.Begin(NumberingStyle.None, privatetemplate);
AddOrgChartsPage(document);
SetoneTemplate(document);
document.Sections.Begin(NumberingStyle.Numeric, "Services", onetemplate);
// Adds Chapters to the document using onetemplate
AddChapter(document, @"C:\TelDir\!REAL FILES\IDB\ServicesAndOrganizations\Buildings.html", "1", "Chapter 1", Services);
AddChapter(document, @"C:\TelDir\!REAL FILES\IDB\ServicesAndOrganizations\EmergencyNumbers.html", "2", "Chapter 2", Services);
Thanks!
Re: Document sections and templates
Support · Jan 22, 2007The above post was actually an issue with the PageNumberingLabel defined in the template (the code was not shown). A "%%CP%%" for current page was used instead of "%%SP%%" for section page in the PageNumberingLabel text. Making this change resolved the issue.
Thanks,
ceTe Software Support Team