本文整理匯總了C#中iTextSharp.text.pdf.PdfWriter.GetImportedPage方法的典型用法代碼示例。如果您正苦於以下問題:C# PdfWriter.GetImportedPage方法的具體用法?C# PdfWriter.GetImportedPage怎麽用?C# PdfWriter.GetImportedPage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類iTextSharp.text.pdf.PdfWriter
的用法示例。
在下文中一共展示了PdfWriter.GetImportedPage方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: EmbedeIntroPage
private static void EmbedeIntroPage(Document pdfDoc, PdfWriter writer)
{
pdfDoc.NewPage();
PdfReader reader = new PdfReader(Resources.Intro);
PdfContentByte cb = writer.DirectContent;
PdfImportedPage page = writer.GetImportedPage(reader, 1); ;
//cb.AddTemplate(page, 0, -1f, 1f, 0, 0, reader.GetPageSizeWithRotation(1).Height);
cb.AddTemplate(page, 0, 0);
}
示例2: OnOpenDocument
public void OnOpenDocument(PdfWriter writer, Document document)
{
_baseFont = BaseFont.CreateFont(BaseFont.HELVETICA, BaseFont.CP1252, BaseFont.EMBEDDED);
_frontPageFont = BaseFont.CreateFont(BaseFont.HELVETICA_BOLD, BaseFont.CP1252, BaseFont.EMBEDDED);
_content = writer.DirectContent;
if (!string.IsNullOrEmpty(_settings.PageTemplate))
{
var reader = new PdfReader(_settings.PageTemplate);
_template = writer.GetImportedPage(reader, 1);
}
WriteFrontPage(writer, document);
}
示例3: GenerateDocument
protected override void GenerateDocument(Document doc, DocumentType docType, string addSheet, PdfWriter writer)
{
DepartmentOrderDocTableAdapters.DocumentContentTableAdapter ta = new DepartmentOrderDocTableAdapters.DocumentContentTableAdapter();
IEnumerator iEnum = ta.GetDocumentContentById(docType.DocId, docType.CoId, docType.DeptId).GetEnumerator();
if (iEnum.MoveNext())
{
DepartmentOrderDoc.DocumentContentEntityRow docContent = (DepartmentOrderDoc.DocumentContentEntityRow)iEnum.Current;
if (docContent.file_contents != null && docContent.file_contents.Length > 0)
{
PdfContentByte pdfContentByte = writer.DirectContent;
PdfReader reader = new PdfReader(docContent.file_contents);
for (int page = 1; page <= reader.NumberOfPages; page++)
{
doc.NewPage();
PdfImportedPage importedPage = writer.GetImportedPage(reader, page);
pdfContentByte.AddTemplate(importedPage, 0, 0);
}
}
}
}
示例4: WriteFrontPage
private void WriteFrontPage(PdfWriter writer, Document document)
{
if (!string.IsNullOrEmpty(_settings.FrontPageTemplate))
{
document.NewPage();
// Write Generated On
string title = _settings.GetDocumentTitle();
_content.BeginText();
_content.SetFontAndSize(_frontPageFont, HeadingFontSize);
_content.SetTextMatrix(GetFrontPageTextXPosition(title, writer), GetFrontPageTextYPosition(writer));
_content.ShowText(title);
_content.EndText();
var reader = new PdfReader(_settings.FrontPageTemplate);
writer.DirectContentUnder.AddTemplate(writer.GetImportedPage(reader, 1), 0, 0);
_skipPageFooter = true;
}
}
示例5: UseStationary
/**
* Initialize the imported page.
* @param writer The PdfWriter
*/
public void UseStationary(PdfWriter writer, byte[] stationary) {
writer.PageEvent = new TemplateHelper(this);
PdfReader reader = new PdfReader(stationary);
page = writer.GetImportedPage(reader, 1);
}
示例6: BuildFile
protected override void BuildFile()
{
if (TemplateStream != null)
{
readerFileTemplate = new PdfReader(TemplateStream);
document = new Document(readerFileTemplate.GetPageSize(1));
writer = PdfWriter.GetInstance(document, BufferStream);
document.Open();
var page = writer.GetImportedPage(readerFileTemplate, 1);
Template = page;
writer.DirectContent.AddTemplate(page, 0, 0);
}
else
{
var size = IPageSize.GetRectangle(DocumentPageSize.ToString());
if (IsPageRotate) size = size.Rotate();
document = DocumentMargin == Margin.Empty ? new Document(size) :
new Document(size, DocumentMargin.Left, DocumentMargin.Right, DocumentMargin.Top, DocumentMargin.Bottom);
writer = PdfWriter.GetInstance(document, BufferStream);
document.Open();
AddEmpty();
}
Height = document.PageSize.Height;
Width = document.PageSize.Width;
}
示例7: GetImage
public Image GetImage(PdfWriter writer)
{
var reader = new PdfReader(source);
var pdfImportedPage = writer.GetImportedPage(reader, 1);
return Image.GetInstance(pdfImportedPage);
}