本文整理汇总了C#中PdfWriter.BeginCopiedPartialPage方法的典型用法代码示例。如果您正苦于以下问题:C# PdfWriter.BeginCopiedPartialPage方法的具体用法?C# PdfWriter.BeginCopiedPartialPage怎么用?C# PdfWriter.BeginCopiedPartialPage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PdfWriter
的用法示例。
在下文中一共展示了PdfWriter.BeginCopiedPartialPage方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateOnePdfFile
// Create a single PDF file
void CreateOnePdfFile(string fileName, IEnumerable<CourseDesignator> courseDesignators)
{
List<CoursePage> pages = LayoutPages(courseDesignators);
PdfWriter pdfWriter = new PdfWriter(Path.GetFileNameWithoutExtension(fileName), coursePdfSettings.ColorModel == ColorModel.CMYK);
foreach (CoursePage page in pages) {
CoursePage pageToDraw = page;
SizeF paperSize = new SizeF(pageToDraw.paperSize.Width / 100F, pageToDraw.paperSize.Height / 100F);
if (pageToDraw.landscape)
paperSize = new SizeF(paperSize.Height, paperSize.Width);
if (controller.UpdateProgressDialog(string.Format(MiscText.CreatingFile, Path.GetFileName(fileName)), (double)currentPage / (double)totalPages))
throw new Exception(MiscText.CancelledByUser);
IGraphicsTarget grTarget;
if (IsPdfMap) {
float scaleRatio = CourseView.CreatePrintingCourseView(eventDB, page.courseDesignator).ScaleRatio;
if (scaleRatio == 1.0) {
// If we're doing a PDF at scale 1, we just copy the page directly.
grTarget = pdfWriter.BeginCopiedPage(pdfMapPage);
pageToDraw = PdfNonScaledPage(page.courseDesignator);
}
else {
using (XForm xForm = pdfImporter.GetXForm(0)) {
RectangleF pageArea;
if (page.landscape)
pageArea = new RectangleF(0, 0, Geometry.HundredthsInchesFromMm(mapBounds.Height), Geometry.HundredthsInchesFromMm(mapBounds.Width));
else
pageArea = new RectangleF(0, 0, Geometry.HundredthsInchesFromMm(mapBounds.Width), Geometry.HundredthsInchesFromMm(mapBounds.Height));
Matrix transform = Geometry.CreateInvertedRectangleTransform(page.printRectangle, page.mapRectangle);
RectangleF printedPortionInMapCoords = Geometry.TransformRectangle(transform, pageArea);
Matrix mapToPortraitPage = Geometry.CreateInvertedRectangleTransform(mapBounds, new RectangleF(0, 0, page.paperSize.Width / 100F, page.paperSize.Height / 100F));
RectangleF sourcePartialRectInInches = Geometry.TransformRectangle(mapToPortraitPage, printedPortionInMapCoords);
grTarget = pdfWriter.BeginCopiedPartialPage(xForm, paperSize, sourcePartialRectInInches);
}
}
// Don't draw the map normally.
mapDisplay.SetMapFile(MapType.None, null);
}
else {
grTarget = pdfWriter.BeginPage(paperSize);
}
DrawPage(grTarget, pageToDraw);
pdfWriter.EndPage(grTarget);
grTarget.Dispose();
currentPage += 1;
}
pdfWriter.Save(fileName);
}