使用asp.net和C#在Web应用程序中进行逐页文本呈现

时间:2023-01-15 11:13:57

HI, I have a large html formatted text. I want to display the text in pages ( as in MS Word ). Is there any way to do this?

嗨,我有一个大的HTML格式文本。我想在页面中显示文本(如在MS Word中)。有没有办法做到这一点?

1 个解决方案

#1


Best way would be rendering it in a PDF with component (Can be ABCPdf from WebSuperGoo or other solution)

最好的方法是将其呈现为带有组件的PDF(可以是来自WebSuperGoo的ABCPdf或其他解决方案)

Doc theDoc = new Doc();
theDoc.Rect.Inset(72, 144);
theDoc.Page = theDoc.AddPage();
int theID;
theID = theDoc.AddImageUrl("http://www.yahoo.com/"); 
while (true) {
  theDoc.FrameRect(); // add a black border
  if (!theDoc.Chainable(theID))
    break;
  theDoc.Page = theDoc.AddPage();
  theID = theDoc.AddImageToChain(theID);
} 

for (int i = 1; i <= theDoc.PageCount; i++) {
  theDoc.PageNumber = i;
  theDoc.Flatten();
}

theDoc.Save(Server.MapPath("pagedhtml.pdf"));
theDoc.Clear(); 

#1


Best way would be rendering it in a PDF with component (Can be ABCPdf from WebSuperGoo or other solution)

最好的方法是将其呈现为带有组件的PDF(可以是来自WebSuperGoo的ABCPdf或其他解决方案)

Doc theDoc = new Doc();
theDoc.Rect.Inset(72, 144);
theDoc.Page = theDoc.AddPage();
int theID;
theID = theDoc.AddImageUrl("http://www.yahoo.com/"); 
while (true) {
  theDoc.FrameRect(); // add a black border
  if (!theDoc.Chainable(theID))
    break;
  theDoc.Page = theDoc.AddPage();
  theID = theDoc.AddImageToChain(theID);
} 

for (int i = 1; i <= theDoc.PageCount; i++) {
  theDoc.PageNumber = i;
  theDoc.Flatten();
}

theDoc.Save(Server.MapPath("pagedhtml.pdf"));
theDoc.Clear();