我试图进行预览,因为没有标准程序。如何才能做到这一点?
我试图将其保存为PDF。但首先,浏览器不遵循设定的边距,其次,我需要动态更改打印边距。我尝试创建浏览器的新组件,但只将内存中的链接传输到新实例。
我将非常感谢你的帮助!
答案 0 :(得分:0)
我将vb .net的此代码发送给您 我用cefsharp打开一个新表格 我用空白保存pdf 在打印此pdf
之后browser.PrintToPdfAsync(RisultatiPath & "Temp\out.pdf", New PdfPrintSettings With {
.BackgroundsEnabled = True,
.HeaderFooterEnabled = False,
.Landscape = False,
.MarginType = CefPdfPrintMarginType.Custom,
.MarginBottom = 0,
.MarginTop = 0,
.MarginLeft = 0.2,
.MarginRight = 0,
.PageWidth = 210000,
.PageHeight = 297000
})
Threading.Thread.Sleep(2000)
Dim PrintPDF As New ProcessStartInfo
PrintPDF.UseShellExecute = True
PrintPDF.Verb = "print"
PrintPDF.WindowStyle = ProcessWindowStyle.Hidden
PrintPDF.FileName = RisultatiPath & "Temp\out.pdf"
Process.Start(PrintPDF)
Threading.Thread.Sleep(3000)
Me.Close()