asp.netabcpdf

ABCpdf, ASP.net - Paged HTML with dynamically generated .aspx page


I am trying to use ABCpdf (version 11) to create a pdf from an .aspx page that I am generating. I am following their sample code from https://www.websupergoo.com/helppdfnet/default.htm?page=source%2F5-abcpdf%2Fdoc%2F1-methods%2Fchainable.htm and that works perfect.

The .aspx page that I am generating, has a table with variable number of rows with other things. It works great when the table has only a few rows and as a result, the page is short and the pdf has only one page, but when the page is long with a large number of rows in the table, it just saves the first page as the pdf. I tried to debug the code and saw that the line where it should add a page never executes because theDoc.Chainable(theID) is always returned as false.

    Dim theID As Integer
    theID = theDoc.AddImageUrl(HttpContext.Current.Request.Url.AbsoluteUri)
    'Chain
    While True
        theDoc.FrameRect() ' add a black border
        If Not theDoc.Chainable(theID) Then
            Exit While
        End If
        theDoc.Page = theDoc.AddPage()
        theID = theDoc.AddImageToChain(theID)
    End While

Why is .Chainable always false? What sets it to be true or false? If I forcefully make it true, then I get a blank page as the second page, so I need to know why that property is returned as false.

Has any of you come across this issue? Any help is appreciated.


Solution

  • I found the problem. And the way to resolve it!

    The problem had nothing to do with ABCpdf, it is the way the page (.aspx) prints. I hit Ctrl+P to launch the print preview to see if that renders all the pages and saw that the page got cut off after the first page. That might also be the reason why .Chainable was always false. So, I added the following css and voila! It is working as expected.

    @media print {
       #form1 { overflow:visible !important;}
    }
    

    where form1 is the ID of the main form.