本文整理匯總了C#中iTextSharp.text.pdf.PdfReader.GetPdfReaderInstance方法的典型用法代碼示例。如果您正苦於以下問題:C# PdfReader.GetPdfReaderInstance方法的具體用法?C# PdfReader.GetPdfReaderInstance怎麽用?C# PdfReader.GetPdfReaderInstance使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類iTextSharp.text.pdf.PdfReader
的用法示例。
在下文中一共展示了PdfReader.GetPdfReaderInstance方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: GetImportedPage
/** Gets a page from other PDF document. The page can be used as
* any other PdfTemplate. Note that calling this method more than
* once with the same parameters will retrieve the same object.
* @param reader the PDF document where the page is
* @param pageNumber the page number. The first page is 1
* @return the template representing the imported page
*/
public virtual PdfImportedPage GetImportedPage(PdfReader reader, int pageNumber)
{
PdfReaderInstance inst = (PdfReaderInstance)importedPages[reader];
if (inst == null) {
inst = reader.GetPdfReaderInstance(this);
importedPages[reader] = inst;
}
return inst.GetImportedPage(pageNumber);
}
示例2: GetPdfReaderInstance
/**
* Returns the PdfReaderInstance associated with the specified reader.
* Multiple calls with the same reader object will return the same
* PdfReaderInstance.
* @param reader the PDF reader that you want an instance for
* @return the instance for the provided reader
* @since 5.0.3
*/
protected virtual PdfReaderInstance GetPdfReaderInstance(PdfReader reader){
PdfReaderInstance inst;
readerInstances.TryGetValue(reader, out inst);
if (inst == null) {
inst = reader.GetPdfReaderInstance(this);
readerInstances[reader] = inst;
}
return inst;
}
示例3: GetImportedPage
/**
* Grabs a page from the input document
* @param reader the reader of the document
* @param pageNumber which page to get
* @return the page
*/
public override PdfImportedPage GetImportedPage(PdfReader reader, int pageNumber) {
if (currentPdfReaderInstance != null) {
if (currentPdfReaderInstance.Reader != reader) {
try {
currentPdfReaderInstance.Reader.Close();
currentPdfReaderInstance.ReaderFile.Close();
}
catch (IOException) {
// empty on purpose
}
currentPdfReaderInstance = reader.GetPdfReaderInstance(this);
}
}
else {
currentPdfReaderInstance = reader.GetPdfReaderInstance(this);
}
return currentPdfReaderInstance.GetImportedPage(pageNumber);
}