简体   繁体   中英

White spaces appear around the document to preview

I have WPF Application which use printing. I have class inherite from "DocumentPaginator"

class ReportPaginator : DocumentPaginator
{
    private Size pageSize;

    public override IDocumentPaginatorSource Source
    {
        get { return null; }
    }

    public override bool IsPageCountValid
    {
        get { return true; }
    }

    public override int PageCount
    {
        get { return pageCount; }
    }

    public override Size PageSize
    {
        get { return pageSize; }
        set
        {
            if (value != null)
            {
                pageSize = value;
                CalculatesPage();
            }
        }
    }

    public override DocumentPage GetPage(int pageNumber)
    {
       // some code.
    }  
}

When I get FixedDocumentSequence from this paginator to preview the document before printing. the "pageSize" property did NOT applied for this DocumentPage, and there is white spaces around the pages How can I solve this problem

Just for the case if some one had the same problem of this.
My problem was in the my own code [specifically the part that generate the Page in the GetPage() method], I was generating white spaces around the page itself when implement GetPage method.

if you are having same problem, may be double-checking GetPage method may be helpful.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM