本文整理汇总了C#中iTextSharp.text.pdf.PdfTemplate.GetMcElements方法的典型用法代码示例。如果您正苦于以下问题:C# PdfTemplate.GetMcElements方法的具体用法?C# PdfTemplate.GetMcElements怎么用?C# PdfTemplate.GetMcElements使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类iTextSharp.text.pdf.PdfTemplate
的用法示例。
在下文中一共展示了PdfTemplate.GetMcElements方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddTemplate
/**
* Adds a template to this content.
*
* @param template the template
* @param a an element of the transformation matrix
* @param b an element of the transformation matrix
* @param c an element of the transformation matrix
* @param d an element of the transformation matrix
* @param e an element of the transformation matrix
* @param f an element of the transformation matrix
* @param tagContent <code>true</code> - template content will be tagged(all that will be added after), <code>false</code> - only a Do operator will be tagged.
* taken into account only if <code>isTagged()</code> - <code>true</code>.
*/
public void AddTemplate(PdfTemplate template, float a, float b, float c, float d, float e, float f, bool tagContent) {
CheckWriter();
CheckNoPattern(template);
PdfWriter.CheckPdfIsoConformance(writer, PdfIsoKeys.PDFISOKEY_FORM_XOBJ, template);
PdfName name = writer.AddDirectTemplateSimple(template, null);
PageResources prs = PageResources;
name = prs.AddXObject(name, template.IndirectReference);
if (IsTagged()) {
if (inText)
EndText();
if (template.ContentTagged || (template.PageReference != null && tagContent)) {
throw new InvalidOperationException(MessageLocalization.GetComposedMessage("template.with.tagged.could.not.be.used.more.than.once"));
}
template.PageReference = writer.CurrentPage;
if (tagContent) {
template.ContentTagged = true;
IList<IAccessibleElement> allMcElements = GetMcElements();
if (allMcElements != null && allMcElements.Count > 0)
template.GetMcElements().Add(allMcElements[allMcElements.Count - 1]);
} else {
OpenMCBlock(template);
}
}
content.Append("q ");
content.Append(a).Append(' ');
content.Append(b).Append(' ');
content.Append(c).Append(' ');
content.Append(d).Append(' ');
content.Append(e).Append(' ');
content.Append(f).Append(" cm ");
content.Append(name.GetBytes()).Append(" Do Q").Append_i(separator);
if (IsTagged() && !tagContent) {
CloseMCBlock(template);
template.ID = null;
}
}
示例2: CreateTemplate
internal PdfTemplate CreateTemplate(float width, float height, PdfName forcedName) {
CheckWriter();
PdfTemplate template = new PdfTemplate(writer);
IList<IAccessibleElement> allMcElements = GetMcElements();
if(allMcElements != null && allMcElements.Count > 0)
template.GetMcElements().Add(allMcElements[allMcElements.Count - 1]);
template.Width = width;
template.Height = height;
writer.AddDirectTemplateSimple(template, forcedName);
return template;
}