Mah*_*dra 6 export-to-pdf kendo-ui spring-boot
HTML表格,图表,图像可以是报告内容.用户可以下载看到的报告,或者他可以安排这些报告以恢复电子邮件.在客户端和服务器端需要引擎以PDF和Excel格式发出.使用Angular 5前端和Spring Boot支持.
尝试过Kendo UI ..它做客户端PDF生成但不确定如何使用kendo在Spring启动调度程序中执行此操作
我已经多次遇到过这个问题,在 JavaScript、C# 或 Java 中都是如此,通常要求是相同的。为了允许创建报告,其中一些报告仅基于文本,但其他报告似乎更复杂,具有格式化文本、表格、图像甚至图表。众所周知,有很多报告工具,例如 DevExpress XtraReports、Crystal Reports、Jasper Reports、MS Reporting Services,甚至更多用于创建 Docx / PDF 自定义报告的MS Word Interop 、 MS Excel Interop,但这些技术都没有与iText(对于 Java)或iTextSharp (对于 .Net)一样简单而强大。该库允许您创建功能强大的 PDF 文档、报告、书籍等。查看《iText in Action》一书,了解可以使用 iText 执行的所有操作。将 PDF 下载到客户端只需使用适当的MIME 类型“ application/pdf ”刷新 PDF 流即可。
public Image CreateNewLogo()
{
string imageURL = HttpContext.Current.Server.MapPath(PDFResources.ImagesPath) + "/Logo.png";
Image img = Image.GetInstance(imageURL);
img.ScaleToFit(270f, 90f);
img.SpacingBefore = 5f;
img.SpacingAfter = 5f;
img.Alignment = Element.ALIGN_LEFT;
return img;
}
public void CreateHeader()
{
string div = Resources.OFR_Resources.h1_div + " " + data.DescDivision;
string zona = Resources.OFR_Resources.h1_zona + " " + data.DescZona;
Image logo = CreateNewLogo();
PdfPTable table = new PdfPTable(2); table.DefaultCell.Border = Rectangle.NO_BORDER;
PdfPCell cellDZ = new PdfPCell(); cellDZ.Border = Rectangle.NO_BORDER;
Paragraph pd = NewParagraphHeader(div); pd.Alignment = Element.ALIGN_RIGHT;
Paragraph pz = NewParagraphHeader(zona); pz.Alignment = Element.ALIGN_RIGHT;
cellDZ.AddElement(pd); cellDZ.AddElement(pz);
table.AddCell(logo); table.AddCell(cellDZ);
document.Add(table);
}
public void CreateContent()
{
string s1_p1 = Resources.OFR_Resources.s1_p1.Replace("[FECHA_SOLICITUD]", string.Format("{0: dd MM yyyy}", data.Solicitud.fechaAlta));
s1_p1 = s1_p1.Replace("[RAZON_SOCIAL]", data.Solicitud.dsNombreDenRS);
s1_p1 = s1_p1.Replace("[DIRECCION_SOLICITANTE]", data.DireccionSolicitante);
PdfPTable table = new PdfPTable(2); table.DefaultCell.Border = Rectangle.NO_BORDER;
Paragraph p_fecha = NewParagraphN(Resources.OFR_Resources.s1_fecha.Replace("[FECHA_ACTUAL]", DateTime.Now.ToLongDateString()));
Paragraph p_oficio = NewParagraphN(Resources.OFR_Resources.s1_oficio);
Paragraph p_asunto = NewParagraphN(Resources.OFR_Resources.s1_asunto);
PdfPCell cellRigth = new PdfPCell();
cellRigth.AddElement(p_fecha);
cellRigth.AddElement(p_asunto);
cellRigth.Border = Rectangle.NO_BORDER;
table.AddCell("");
table.AddCell(cellRigth);
document.Add(table);
}
Run Code Online (Sandbox Code Playgroud)
请参阅: https: //itextpdf.com/
| 归档时间: |
|
| 查看次数: |
315 次 |
| 最近记录: |