PDFsharp - How to create a 2nd page

前端 未结 4 796
悲哀的现实
悲哀的现实 2020-12-06 13:58

I can\'t find documentation in PDFsharp to show how to add a 2nd page using C#!

As an example, over in VB6 I use a PDF creation method called mjwPDF. To indicate th

4条回答
  •  失恋的感觉
    2020-12-06 14:15

    Do not forget to update your "canvas" or "graphics" object variable to the new page:

    You may be doing something like this:

    // First time:
    this.page = document.AddPage();
    this.gfx = XGraphics.FromPdfPage(page);
    
    ...
    
    // next time (forgot to update graphics or canvas variable):
    this.page = document.AddPage();
    

    And, it should be something like:

    // First time:
    this.page = document.AddPage();
    this.gfx = XGraphics.FromPdfPage(page);
    
    ...
    
    // next time:
    this.page = document.AddPage();
    // update graphics object, also
    this.gfx = XGraphics.FromPdfPage(page);
    

    I also made that mistake.

提交回复
热议问题