简体   繁体   English

ABCpdf,ASP.net-具有动态生成的.aspx页的分页HTML

[英]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. 我正在尝试使用ABCpdf(版本11)从我生成的.aspx页面创建pdf。 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. 我正在按照https://www.websupergoo.com/helppdfnet/default.htm?page=source%2F5-abcpdf%2Fdoc%2F1-methods%2Fchainable.htm的示例代码进行操作,效果很好。

The .aspx page that I am generating, has a table with variable number of rows with other things. 我正在生成的.aspx页面有一个表,其中包含可变行数和其他内容。 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. 当表只有几行并且结果是页面很短并且pdf只有一页时,它的效果很好,但是当页面很长且表中有很多行时,它只会保存第一页作为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. 我试图调试代码并看到它应该添加页面的行永远不会执行,因为theDoc.Chainable(theID)总是返回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? 为什么.Chainable总是假的? 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. 如果我强制将其设置为true,则将获得空白页作为第二页,因此我需要知道为什么将该属性返回为false。

Has any of you come across this issue? 你们中有人遇到过这个问题吗? Any help is appreciated. 任何帮助表示赞赏。

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. 这个问题与ABCpdf无关,它是页面(.aspx)打印的方式。 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. 我按Ctrl + P启动打印预览以查看是否呈现所有页面并看到页面在第一页之后被切断。 That might also be the reason why .Chainable was always false. 这也可能就是.Chainable始终为假的原因。 So, I added the following css and voila! 因此,我添加了以下CSS和voila! It is working as expected. 它按预期工作。

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

where form1 is the ID of the main form. 其中form1是主窗体的ID。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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