Page spacing too big

Feb 2, 2011 at 8:59 AM


I'm having some strange behavior with the spacing between pages in the document viewer and wonder if you have any idea what is the cause. The problem appears in two cases but I hope a single fix is possible. When I open a document where some of the pages are in landscape mode, it appears as though the page is allocated space enough for a page in portrait mode. The extra margin is not present at first, though, as I can see it being added, just as the page is scrolled into view. The other issue is a bit less predictable. I use the Aspose.Words library to join two documents together and for a small amount of the documents, a top/bottom margin of just under an inch is added to each page (again, just as you scroll the page into view). I don't expect help with the concrete problem introduced by the Aspose component, but is there a general way to fix/control the amount of spacing between documents?


-Morten Christiansen

Feb 2, 2011 at 10:41 AM

Hi Morten,

The actual width and height of page is only known when a fixed page is actually loaded. The XPS specification does allow for storing page size info without having fixed pages to be loaded, but I've never seen a document use this. If the size info is unknown, Document Toolkit simply assumes that each page has the same size as the first page unless proven otherwise. This causes the page being assigned a correct size only after it is first loaded (which happens while you are scrolling).

The second issue might be related, are the pages of both documents of exactly the same size? If possible, send me a copy of your XPS so I can take look.

Hope this helps,

- Koen

Feb 2, 2011 at 11:58 AM

It turns out that the second problem is a non-issue as I wont need to render the documents I join. But the other thing does the opposite of what you say. It starts out with the correct space between pages and as soon as they scroll into view, the excess space is added. But just to make sure we agree, it is not the actual size of the page that is the problem, only the space between them. Why would the space between documents ever need to be anything but a fixed value?

Feb 2, 2011 at 2:46 PM

Looks like a bug. It only happens when a new document is loaded and the view mode is set to fit-page/widht or height. Once you change the viewmode after the pages have been loaded it looks fine. I'll look into it.

Feb 3, 2011 at 11:37 AM

Thanks, that sounds great.