html打印分页线怎么设置
请问怎样让网页不分页,在一个界面上展示所有内容?
请问怎样让网页不分页,在一个界面上展示所有内容?
网页分页是网页代码决定的不是浏览器自动分的,浏览器只是按代码将页面展示出来,如果网站本身不提供展示所有内容的页面链接,那没办法实现。
C#HTML转PDF页面内容太大怎么分页?
public void writeLog(string sMessage)
{
//FileStream fs new FileStream((), );
try
{
StreamWriter swriter (());
swriter.WriteLine(sMessage);
();
}
catch
{ }
}
private bitmap;
private string url;
private int w 760, h 900;
public void setBitmap()
{
using (WebBrowser wb new WebBrowser())
{
wb.Width w;
wb.Height h;
false;
(url);
//确保页面被解析完全
while ( ! )
{
();
}
bitmap new (w, h);
wb.DrawToBitmap(bitmap, new (0, 0, w, h));
wb.Dispose();
}
}
private void CreatPdf()
{
Document doc new Document(PageSize.A4, 9, 18, 36, 36);//左右上下
MemoryStream ms new MemoryStream();
try
{
PdfWriter writer (doc, ms);
false;
();
url ();
Thread thread new Thread(new ThreadStart(setBitmap));
();
();
while ()
(100);
(());
img (bitmap, );
(75);//560 630
(img);
}
catch (Exception err)
{
throw new Exception();
}
finally
{
();
using (FileStream fs new FileStream((pagetohtml.pdf), ))
{
ms.Position 0;
byte[] bit new byte[ms.Length];
(bit, 0, (int)ms.Length);
fs.Write(bit, 0, bit.Length);
}
ViewPdf(ms);
}
}
private void ViewPdf(Stream fs)
{
();
//中文名的话
(Content-Disposition, attachment;filename
// HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8) ;charsetGB2312);
(Content-Disposition, attachment;FileNamepagetohtml.pdf);
(Content-Length, ());
application/pdf;
long fileLength fs.Length;
int size 10240;
byte[] readData new byte[size];
if (size fileLength)
size (fileLength);
long fPos 0;
bool isEnd false;
while (!isEnd)
{
if ((fPos size) fileLength)
{
size (fileLength - fPos);
isEnd true;
}
readData new byte[size];
fs.Position fPos;
(readData, 0, size);
(readData);
Response.OutputStream.Flush();
fPos size;
}
();
();
Response.End();
();
}