0

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

Hakan Fıstık
  • 16,800
  • 14
  • 110
  • 131

1 Answers1

0

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.

Hakan Fıstık
  • 16,800
  • 14
  • 110
  • 131
  • It is good that you solved your problem, but you should put an answer that will help others if they have the same problem. “double-checking your code” does not do that. – Dour High Arch Sep 10 '15 at 16:04
  • I solved this from long time, I really hope to write the code which solved my problem, and you are right 100%, this could be more useful for other. – Hakan Fıstık Sep 10 '15 at 16:27