欢迎您访问 最编程 本站为您分享编程语言代码,编程技术文章!
您现在的位置是: 首页

Spire.PDF for .NET [页面设置]演示:PDF 文档分页 - C#

最编程 2024-09-30 07:06:22
...
//cover
PdfBrush brush3 = PdfBrushes.Black;
PdfBrush brush4 = new PdfSolidBrush(new PdfRGBColor(0xf9, 0xf9, 0xf9));
PdfImage image
= PdfImage.FromFile(@"..\potala palace1.jpg");
String text = paginate_PDF.Properties.Resources.ImageDescription;
float r = image.PhysicalDimension.Height / image.Height;
PdfPen pen = new PdfPen(brush1, r);
SizeF size = font1.MeasureString(text, image.PhysicalDimension.Width - 2);
PdfTemplate template
= new PdfTemplate(image.PhysicalDimension.Width + 4 * r + 4,
image.PhysicalDimension.Height + 4 * r + 7 + size.Height);
template.Graphics.DrawRectangle(pen, brush4, 0, 0, template.Width, template.Height);