本文整理匯總了C#中iTextSharp.text.pdf.PdfReader.GetCropBox方法的典型用法代碼示例。如果您正苦於以下問題:C# PdfReader.GetCropBox方法的具體用法?C# PdfReader.GetCropBox怎麽用?C# PdfReader.GetCropBox使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類iTextSharp.text.pdf.PdfReader
的用法示例。
在下文中一共展示了PdfReader.GetCropBox方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: GetPdfSignatureAppearance
private static PdfSignatureAppearance GetPdfSignatureAppearance(SigningCertificates signingCertificates, PdfStamper stamper, PdfReader reader, PdfSignatureParameters parameters)
{
PdfSignatureAppearance appearance = stamper.SignatureAppearance;
appearance.Reason = "";
appearance.LocationCaption = "";
appearance.Location = "";
appearance.Layer4Text = "";
appearance.Layer2Text = GetSignatureText(signingCertificates.X509Certificate, parameters);
appearance.Acro6Layers = true;
Rectangle cropBox = reader.GetCropBox(parameters.SignaturePageNumber);
Rectangle rectangle = GetSignatureLocation(cropBox, parameters);
appearance.SetVisibleSignature(rectangle, parameters.SignaturePageNumber, parameters.SignatureName);
return appearance;
}
示例2: ConcatenateEvaluations
// This class uses an open-source PDF engine to concatenate multiple PDFs into one organized by bookmarks
public static bool ConcatenateEvaluations(string destination, String[] args)
{
try
{
int f = 0; // index of current document
int i = 0; // current page of the current document
int n = 0; // total pages for current document
int j = 0; // counter used to display two portrait pages on one landscape page
float width = PageSize.LETTER.Width; //PageSize.LETTER.Height;
float height = PageSize.LETTER.Height; //PageSize.LETTER.Width;
// we create a reader for a certain document
PdfReader reader;
// step 1: creation of a document-object with portrait orientation
Document document = new Document(PageSize.LETTER, 0, 0, 0, 0);
// step 2: we create a writer that listens to the document
PdfWriter writer = PdfWriter.GetInstance(document, new FileStream(destination, FileMode.Create));
writer.ViewerPreferences = PdfWriter.PageModeUseOutlines;
// step 3: we open the document
document.Open();
PdfContentByte cb = writer.DirectContent;
PdfImportedPage page;
int rotation;
// step 4: we add the content
while (f < args.Length)
{
i = 0;
if (args[f] != "")
{
reader = new PdfReader(args[f]);
// we retrieve the total number of pages
n = reader.NumberOfPages;
while (i < n)
{
i++;
page = writer.GetImportedPage(reader, i);
rotation = reader.GetPageRotation(i);
//portrait - default
document.SetPageSize(PageSize.LETTER);
float pageHeight = reader.GetCropBox(i).Height;
float bottom = reader.GetCropBox(i).Bottom;
document.NewPage();
cb.AddTemplate(page, 0, 0);
}
// free up memory
writer.FreeReader(reader);
}
f++;
}
// step 5: we close the document
document.Close();
}
catch (Exception e)
{
return false;
}
return true;
}