Section Paging Issues

Hi

I am using the Aspose PDF generator 8.5, using the XML method. I am also using Visual Studio 2010, and .NET 4.0.
I am experiencing some problems with the use of multiple sections, and paging.
The contributing factors seem to be:
  1. Create a section with headers and/or footers, and some text. It need only be a single page.
  2. Create a second section with different headers and/or footers, and several Text elements.
  3. Set the IsOnOddPage and MarginTop attributes of the first Text element in the second section.
When the PDF is rendered, the following problems are evident:
  1. The blank (even) page between the end of the first section, and the start of the second section contains the header and footer from the second section (when it really should be either the first section’s or blank)
  2. The first Text paragraph actually appears below the second (and some of the others). This seems to depend on the size of the MarginTop attribute. If you remove that, this doesn’t occur.
Maybe I’m doing something wrong, but this doesn’t seem like correct behaviour to me.
I have attached a sample XML source file to illustrate the problem.

Thanks
Chris Fairall
Hi Chris,

Thanks for your inquiry.

ChrisFairall:

  1. The blank (even) page between the end of the first section, and the start of the second section contains the header and footer from the second section (when it really should be either the first section's or blank)

First point shows expected behavior as new section(section 2) starts from new page and text moves to third page due to IsOnOddPage property of first element of second section, leaving second page empty.

ChrisFairall:

2. The first Text paragraph actually appears below the second (and some of the others).
This seems to depend on the size of the MarginTop attribute. If you remove that, this
doesn't occur.

After investigation, we've logged second point as PDFNEWNET-35974 in our issue tracking system for further investigation and resolution. We will keep you updated about the issue progress via this forum thread.

We are sorry for the inconvenience caused.

Best Regards,


Thanks for the quick reply.

With regards to point 1, while I expected the page to be blank (that’s the correct behaviour), it’s the presence of the header and footer from section 2 that is of concern. Even though the blank page technically belongs to the second section, from a reader’s standpoint, it belongs with the first.
Is there any way I can either turn off the headers and footers for this blank page (whilst retaining them if the page is not blank), or force it to use the headers and footers from the first section?

Thanks
Chris Fairall.

I have discovered an additional problem, relating to this one.

If, in the second section, you have IsFirstPageOnly header and footer, and IsSubsequentPagesOnly header and footer, the first page header/footer appears on the blank page, and the subsequent page header/footer appears on the “real” first page (ie the one with the actual text).

Updated sample attached to illustrate the problem.

Can you advise on a way to avoid this?

Thanks
Chris Fairall.

Hi Chris,


Thanks for sharing additional information. Header footer issue relates to the empty page issue that reported initially. We’ve requested our development team to look into the issue and suggest solution accordingly. As soon as we get a feedback we will update you.

We are sorry for the inconvenience caused.

Best Regards,
ChrisFairall:
I have discovered an additional problem, relating to this one.
If, in the second section, you have IsFirstPageOnly header and footer, and IsSubsequentPagesOnly header and footer, the first page header/footer appears on the blank page, and the subsequent page header/footer appears on the "real" first page (ie the one with the actual text).
Hi Chris,

Thanks for sharing the details and resource file.

I have tested the scenario and as per my observations, the problem that you are facing is that Text elements for Section-2 are appearing on Subsequent page, rather than first page of Section-2. Please acknowledge so that we are certain that we are on the same page.

For your reference, I have also attached the resultant PDF file generated with Aspose.Pdf for .NET 8.5.0. We are sorry for your inconvenience.

Hi

Actually, the problem is the opposite. The text elements are appearing on the correct page, it is the header and footer that are appearing on the wrong page.
Basically, when you have a section that ends on an odd page, and the first text element of the next section has the IsOnOddPage attribute set to true, the text appears on the correct page, but the blank “even” page between the two contains the header & footer that were defined for the first page of the second section.
I can kind of understand how this is happening - the blank “even” page is still technically part of the second section, but from a document standpoint it is still part of the preceding section.
Perhaps a way to get around this problem would be to introduce an IsOnOddPage (or something similar) attribute for the Section?

I do have another method of working around this problem, though it is not the best.
I am generating a larger document from a collection of individual chapters, which are defined in our database using our own XML format, and then transformed into the Aspose XML format, and finally bound into a PDF document using the Pdf generator object. Our requirements dictate that our users be able to download individual chapters, or the entire document as a single PDF.
Since I am composing the full document from individual chapters, I have been checking after the addition of each chapter how many pages are in the document and, if the number is odd, adding a blank section in between sections. This has the effect of inserting a blank page, and restoring everything to its rightful places (including the header positioning issue discussed above).
This method is problematic, however, because I have to generate the PDF document over and over again during the process to determine the running page count.
This makes the entire process more time consuming, but it works. Anything you could provide that would streamline this process would be appreciated.

Thanks
Chris Fairall.

Hi Chris,


Thanks you very much for sharing your process flow and suggestion for the solution. We’ve have noted the suggestion and shared with respective developer. We will update you as soon as we make some significant improvement towards this feature implementation.

We are sorry for the inconvenience caused.

Best Regards,

Hi

Could you please provide an update as to the progress of this issue? It has been more than 18 months since I lodged it.

Also, could you look into another issue for me. It was assigned the code PDFNEWNET-35964, but the url for the forum (www.aspose.com/community/forums/2/582381/paragraph-indenting-with-isfirstparagraph-and-iskeptwithnext/showthread.aspx) topic doesn’t seem to be working. I get the message “Access Denied. You do not have permissions to perform the requested action”. This issue has not been resolved yet.

Thanks
Chris Fairall

ChrisFairall:
Hi
Could you please provide an update as to the progress of this issue? It has been more than 18 months since I lodged it.
Hi Chris,

I have requested the development team to share the possible ETA as the issue PDFNEWNET-35974 is not yet resolved. As soon as we have some further updates, we will let you know.

ChrisFairall:
Also, could you look into another issue for me. It was assigned the code PDFNEWNET-35964, but the url for the forum (www.aspose.com/community/forums/2/582381/paragraph-indenting-with-isfirstparagraph-and-iskeptwithnext/showthread.aspx) topic doesn't seem to be working. I get the message "Access Denied. You do not have permissions to perform the requested action". This issue has not been resolved yet.
You should be able to access the other thread using this link.