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

Free Support Forum - aspose.com

Header/Footer - - How to differ between first page/last page? XML

I am styling a pdf-Order paper and it is demanded that there should be different headers and footers on first page/last page/following pages

It is easy to create this with older versions - like this:
[XML]
<?xml version="1.0" encoding="utf-8" ?>


But how can I do this differentiations with new aspose Version (17 /<?xml version="1.0" encoding="utf-8"?> ) ??

I can’t find siutable documentation and need your help - thanks for answering. Greetings Mele

I just saw , that the old parameters are missing: I want to know how to use this parameters while using the new Aspose.Pdf-version :
IsFirstPageOnly=“true”
IsLastPageOnly=“true”
IsSubsequentPagesOnly=“true”
IsFirstParagraph=“true”> ec.

Greetings MeLe

@MeLe

Thanks for contacting support.

We have logged an investigation ticket as PDFNET-43093 in our issue tracking system for missing parameters. Product team will further look into the details and as soon as we receive some updates in this regard, we will update you. Meanwhile, would you please share your sample XML Template which targets to old version of Aspose.Pdf. It will help us in investigating the scenario accordingly.

We are sorry for the inconvenience.

Hi, here is a snippet from a coding that works (old version) - please find out, how I could do this in new Aspose Release - New Aspose only produces 1 header (the last in row: “even header for subsequent pages”) and only 1 page. G.MeLe

<?xml version="1.0" encoding="utf-8" ?>
<Pdf xmlns="Aspose.Pdf">
<Section >
<Header IsFirstPageOnly="true">
     <Text>
           <Segment>header for first page</Segment>
    </Text>
</Header>
<Header Type="odd" IsSubsequentPagesOnly="true">
    <Text>
            <Segment>odd header for subsequent pages</Segment>
    </Text>
</Header>
<Header Type="even" IsSubsequentPagesOnly="true">
     <Text>
            <Segment>even header for subsequent pages</Segment>
     </Text>
</Header>
    <Text IsFirstParagraph="true"> 
            <Segment>page1</Segment> 
    </Text>    
    <Text IsFirstParagraph="true"> 
           <Segment>page2</Segment> 
    </Text>    
     <Text IsFirstParagraph="true"> 
            <Segment>page3</Segment> 
     </Text>    
      <Text IsFirstParagraph="true"> 
            <Segment>page4</Segment> 
     </Text>    
     <Text IsFirstParagraph="true"> 
             <Segment>page5</Segment> 
    </Text>    
     <Text IsFirstParagraph="true"> 
            <Segment>page6</Segment> 
     </Text>    
</Section>
</Pdf>

@MeLe

Thanks for sharing sample XML.

I have tried to modify shared XML as per DOM based structure, but did not get much success. There was only one header on the first page inside the generated PDF. Please check following XML which I have tried to generate PDF.

<?xml version="1.0" encoding="utf-8"?>
<Document xmlns="Aspose.Pdf">
  <Page>
    <PageInfo Height="792" Width="612" IsLandscape="false"></PageInfo>
    <Header IsFirstPageOnly="true">
         <TextFragment>
               <TextSegment>header for first page</TextSegment>
        </TextFragment>
    </Header>
    <Header Type="odd" IsSubsequentPagesOnly="true">
        <TextFragment>
                <TextSegment>odd header for subsequent pages</TextSegment>
        </TextFragment>
    </Header>
    <Header Type="even" IsSubsequentPagesOnly="true">
         <TextFragment>
                <TextSegment>even header for subsequent pages</TextSegment>
         </TextFragment>
    </Header>
    <TextFragment>
      <TextSegment>Hello World! This is XML</TextSegment>
      <TextState FontSize="18"></TextState>
    </TextFragment>
  </Page>
  <Page>
  <TextFragment>
        <TextSegment>Hello World! This is XML</TextSegment>
        <TextState FontSize="18"></TextState>
      </TextFragment>
  </Page>
</Document>

I have provided the details to relevant team along with the generated files as well. As soon as we receive some significant updates about resolution of the issue, we will inform you. Please spare us little time.

We are sorry for the inconvenience.