本文整理汇总了C#中iTextSharp.text.pdf.PdfGState类的典型用法代码示例。如果您正苦于以下问题:C# PdfGState类的具体用法?C# PdfGState怎么用?C# PdfGState使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PdfGState类属于iTextSharp.text.pdf命名空间,在下文中一共展示了PdfGState类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: highlightPDFAnnotation
// private void highlightPDFAnnotation(string readerPath, string outputFile, int pageno, string[] highlightText)
private void highlightPDFAnnotation(string readerPath, string outputFile, string[] highlightText)
{
PdfReader reader = new PdfReader(readerPath);
PdfContentByte canvas;
using (FileStream fs = new FileStream(outputFile, FileMode.Create, FileAccess.Write, FileShare.None))
{
using (PdfStamper stamper = new PdfStamper(reader, fs))
{
int pageCount = reader.NumberOfPages;
for (int pageno = 1; pageno <= pageCount; pageno++)
{
var strategy = new HighLightTextLocation();
strategy.UndercontentHorizontalScaling = 100;
string currentText = PdfTextExtractor.GetTextFromPage(reader, pageno, strategy);
for (int i = 0; i < highlightText.Length; i++)
{
List<Rectangle> MatchesFound = strategy.GetTextLocations(highlightText[i].Trim(), StringComparison.CurrentCultureIgnoreCase);
foreach (Rectangle rect in MatchesFound)
{
float[] quad = { rect.Left - 3.0f, rect.Bottom, rect.Right, rect.Bottom, rect.Left - 3.0f, rect.Top + 1.0f, rect.Right, rect.Top + 1.0f };
//Create our hightlight
PdfAnnotation highlight = PdfAnnotation.CreateMarkup(stamper.Writer, rect, null, PdfAnnotation.MARKUP_HIGHLIGHT, quad);
//Set the color
highlight.Color = BaseColor.YELLOW;
PdfAppearance appearance = PdfAppearance.CreateAppearance(stamper.Writer, rect.Width, rect.Height);
PdfGState state = new PdfGState();
state.BlendMode = new PdfName("Multiply");
appearance.SetGState(state);
appearance.Rectangle(0, 0, rect.Width, rect.Height);
appearance.SetColorFill(BaseColor.YELLOW);
appearance.Fill();
highlight.SetAppearance(PdfAnnotation.APPEARANCE_NORMAL, appearance);
//Add the annotation
stamper.AddAnnotation(highlight, pageno);
}
}
}
}
}
reader.Close();
}
示例2: AddWaterMarkText
private static void AddWaterMarkText(PdfContentByte directContent, string textWatermark, BaseFont font, float fontSize, float angle, BaseColor color, Rectangle realPageSize)
{
var gstate = new PdfGState { FillOpacity = 0.2f, StrokeOpacity = 0.2f };
directContent.SaveState();
directContent.SetGState(gstate);
directContent.SetColorFill(color);
directContent.BeginText();
directContent.SetFontAndSize(font, fontSize);
var x = (realPageSize.Right + realPageSize.Left) / 2;
var y = (realPageSize.Bottom + realPageSize.Top) / 2;
directContent.ShowTextAligned(Element.ALIGN_CENTER, textWatermark, x, y, angle);
directContent.EndText();
directContent.RestoreState();
}
示例3: ManipulatePdf
/// <summary>
/// Fills out and flattens a form with the name, company and country.
/// </summary>
/// <param name="src"> the path to the original form </param>
/// <param name="dest"> the path to the filled out form </param>
public void ManipulatePdf(String src, String dest)
{
PdfReader reader = new PdfReader(src);
PdfStamper stamper = new PdfStamper(reader, new FileStream(dest, FileMode.Create)); // create?
int n = reader.NumberOfPages;
Rectangle pagesize;
for (int i = 1; i <= n; i++)
{
PdfContentByte under = stamper.GetUnderContent(i);
pagesize = reader.GetPageSize(i);
float x = (pagesize.Left + pagesize.Right)/2;
float y = (pagesize.Bottom + pagesize.Top)/2;
PdfGState gs = new PdfGState();
gs.FillOpacity = 0.3f;
under.SaveState();
under.SetGState(gs);
under.SetRGBColorFill(200, 200, 0);
ColumnText.ShowTextAligned(under, Element.ALIGN_CENTER,
new Phrase("Watermark", new Font(Font.FontFamily.HELVETICA, 120)),
x, y, 45);
under.RestoreState();
}
stamper.Close();
reader.Close();
}
示例4: ManipulatePdf
/// <summary>
/// Fills out and flattens a form with the name, company and country.
/// </summary>
/// <param name="src"> the path to the original form </param>
/// <param name="dest"> the path to the filled out form </param>
public void ManipulatePdf(String src, String dest)
{
PdfReader reader = new PdfReader(src);
PdfStamper stamper = new PdfStamper(reader, new FileStream(dest, FileMode.Create));
PdfContentByte under = stamper.GetUnderContent(1);
PdfGState gs = new PdfGState();
gs.FillOpacity = 0.3f;
under.SaveState();
under.SetGState(gs);
under.SetRGBColorFill(200, 200, 0);
ColumnText.ShowTextAligned(under, Element.ALIGN_CENTER,
new Phrase("Watermark", new Font(Font.FontFamily.HELVETICA, 120)),
297, 421, 45);
under.RestoreState();
stamper.Close();
reader.Close();
}
示例5: TransparencyCheckTest1
public void TransparencyCheckTest1() {
string filename = OUT + "pdfa2TransparencyCheckTest1.pdf";
FileStream fos = new FileStream(filename, FileMode.Create);
Document document = new Document();
PdfAWriter writer = PdfAWriter.GetInstance(document, fos, PdfAConformanceLevel.PDF_A_2B);
document.Open();
PdfContentByte canvas = writer.DirectContent;
canvas.SaveState();
PdfGState gs = new PdfGState();
gs.BlendMode = PdfGState.BM_DARKEN;
canvas.SetGState(gs);
canvas.Rectangle(100, 100, 100, 100);
canvas.Fill();
canvas.RestoreState();
canvas.SaveState();
gs = new PdfGState();
gs.BlendMode = new PdfName("Lighten");
canvas.SetGState(gs);
canvas.Rectangle(200, 200, 100, 100);
canvas.Fill();
canvas.RestoreState();
bool conformanceExceptionThrown = false;
try {
canvas.SaveState();
gs = new PdfGState();
gs.BlendMode = new PdfName("UnknownBM");
canvas.SetGState(gs);
canvas.Rectangle(300, 300, 100, 100);
canvas.Fill();
canvas.RestoreState();
document.Close();
}
catch (PdfAConformanceException pdface) {
conformanceExceptionThrown = true;
}
if (!conformanceExceptionThrown)
Assert.Fail("PdfAConformance exception should be thrown on unknown blend mode.");
}
示例6: DrawUpperRectangle
public static Point DrawUpperRectangle(PdfContentByte content, Rectangle pageRect, float barSize)
{
content.SaveState();
var state = new PdfGState {FillOpacity = FillOpacity};
content.SetGState(state);
content.SetColorFill(BaseColor.BLACK);
content.SetLineWidth(0);
var result = new Point(SideBorder + BorderPage,
pageRect.Height - (BorderPage + LeaderEdge + BarHeight + 1));
content.Rectangle(result.X, result.Y, barSize, BarHeight);
content.ClosePathFillStroke();
content.RestoreState();
return result;
}
示例7: Generate
public static MemoryStream Generate(TechnicalStaffCardModel technicalStaff, string competitionImagePath, string competitionName)
{
var userImagePath =
HttpContext.Current.Server.MapPath(
"~/App_Data/TechnicalStaff_Image/" + technicalStaff.Image);
var universityLogoPath = HttpContext.Current.Server.MapPath(
"~/Content/IAU_Najafabad_Branch_logo.png");
var competitionLogoPath = HttpContext.Current.Server.MapPath(
"~/App_Data/Logo_Image/" + competitionImagePath);
var fs = new MemoryStream(); //new FileStream(HttpContext.Current.Server.MapPath("~/App_Data/Pdf/aaa.pdf"), FileMode.Create);
Document doc = new Document(new Rectangle(PageSize.A6.Rotate()));
doc.SetMargins(18f, 18f, 15f, 2f);
PdfWriter writer = PdfWriter.GetInstance(doc, fs);
writer.CloseStream = false;
doc.Open();
PdfContentByte canvas = writer.DirectContentUnder;
var logoImg = Image.GetInstance(competitionLogoPath);
logoImg.SetAbsolutePosition(0, 0);
logoImg.ScaleAbsolute(PageSize.A6.Rotate());
PdfGState graphicsState = new PdfGState();
graphicsState.FillOpacity = 0.2F; // (or whatever)
//set graphics state to pdfcontentbyte
canvas.SetGState(graphicsState);
canvas.AddImage(logoImg);
//create new graphics state and assign opacity
var table = new PdfPTable(3)
{
WidthPercentage = 100,
RunDirection = PdfWriter.RUN_DIRECTION_RTL,
ExtendLastRow = false,
};
var imgg = Image.GetInstance(universityLogoPath);
var cell1 = new PdfPCell(imgg)
{
HorizontalAlignment = 0,
Border = 0
};
imgg.ScaleAbsolute(70, 100);
table.AddCell(cell1);
var cell2 = new PdfPCell(new Phrase(string.Format("کارت {0}", competitionName), GetTahoma()))
{
RunDirection = PdfWriter.RUN_DIRECTION_RTL,
HorizontalAlignment = 1,
Border = 0
};
table.AddCell(cell2);
var imgg2 = Image.GetInstance(userImagePath);
imgg2.Border = Rectangle.TOP_BORDER | Rectangle.RIGHT_BORDER | Rectangle.BOTTOM_BORDER | Rectangle.LEFT_BORDER;
imgg2.BorderWidth = 1f;
imgg2.BorderColor = new BaseColor(ColorTranslator.FromHtml("#CCCCCC").ToArgb());
var cell3 = new PdfPCell(imgg2)
{
HorizontalAlignment = 2,
Border = 0
};
imgg2.ScaleAbsolute(70, 100);
table.AddCell(cell3);
int[] firstTablecellwidth = { 10, 20, 10 };
table.SetWidths(firstTablecellwidth);
doc.Add(table);
var table2 = new PdfPTable(4)
//.........这里部分代码省略.........
示例8: DrawDiamont
/// <summary>
/// Draws the diamont.
/// </summary>
/// <param name="content">The content.</param>
/// <param name="x">The x.</param>
/// <param name="y">The y.</param>
public static void DrawDiamont(PdfContentByte content, float x, float y)
{
content.SaveState();
var state = new PdfGState();
content.SetGState(state);
content.SetColorFill(BaseColor.BLACK);
content.MoveTo(x, y);
var sPoint = new Point(x, y);
var uMPoint = new Point(x + WPosMarkerMid, y + HPosMarkerMid);
var rPoint = new Point(uMPoint.X + WPosMarkerMid, uMPoint.Y - HPosMarkerMid);
var mPoint = new Point(rPoint.X - WPosMarkerMid, rPoint.Y - HPosMarkerMid);
DrawLines(content, uMPoint, rPoint, mPoint, sPoint);
content.ClosePathFillStroke();
content.RestoreState();
}
示例9: DrawSquare
public static void DrawSquare(PdfContentByte content, Point point, System.Data.IDataReader reader)
{
content.SaveState();
var state = new PdfGState {FillOpacity = FillOpacity};
content.SetGState(state);
var color = new CMYKColor(reader.GetFloat(1), reader.GetFloat(2), reader.GetFloat(3), reader.GetFloat(4));
content.SetColorFill(color);
content.SetLineWidth(0);
content.Rectangle(point.X, point.Y, PatchSize, PatchSize);
content.Fill();
content.RestoreState();
}
示例10: ApplyWaterMark
private static void ApplyWaterMark(string filePath)
{
Logger.LogI("ApplyWatermark -> " + filePath);
var watermarkedFile = Path.GetFileNameWithoutExtension(filePath) + "-w.pdf";
using (var reader1 = new PdfReader(filePath))
{
using (var fs = new FileStream(watermarkedFile, FileMode.Create, FileAccess.Write, FileShare.None))
using (var stamper = new PdfStamper(reader1, fs))
{
var pageCount = reader1.NumberOfPages;
var layer = new PdfLayer("WatermarkLayer", stamper.Writer);
for (var i = 1; i <= pageCount; i++)
{
var rect = reader1.GetPageSize(i);
var cb = stamper.GetUnderContent(i);
cb.BeginLayer(layer);
cb.SetFontAndSize(BaseFont.CreateFont(
BaseFont.HELVETICA, BaseFont.CP1252, BaseFont.NOT_EMBEDDED), 50);
var gState = new PdfGState {FillOpacity = 0.25f};
cb.SetGState(gState);
cb.SetColorFill(BaseColor.BLACK);
cb.BeginText();
cb.ShowTextAligned(PdfContentByte.ALIGN_CENTER,
"(c)2015 ScrapEra", rect.Width/2, rect.Height/2, 45f);
cb.EndText();
cb.EndLayer();
}
}
}
File.Delete(filePath);
}
示例11: setWatermark
/// <summary>
/// 添加倾斜水印
/// </summary>
/// <param name="inputfilepath"></param>
/// <param name="outputfilepath"></param>
/// <param name="waterMarkName"></param>
/// <param name="userPassWord"></param>
/// <param name="ownerPassWord"></param>
/// <param name="permission"></param>
public static void setWatermark(string inputfilepath, string outputfilepath, string waterMarkName, string userPassWord, string ownerPassWord, int permission)
{
PdfReader pdfReader = null;
PdfStamper pdfStamper = null;
try
{
pdfReader = new PdfReader(inputfilepath);
pdfStamper = new PdfStamper(pdfReader, new FileStream(outputfilepath, FileMode.Create));
// 设置密码
//pdfStamper.SetEncryption(false,userPassWord, ownerPassWord, permission);
int total = pdfReader.NumberOfPages + 1;
PdfContentByte content;
BaseFont font = BaseFont.CreateFont(@"C:\WINDOWS\Fonts\SIMFANG.TTF", BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
PdfGState gs = new PdfGState();
gs.FillOpacity = 0.2f;//透明度
int j = waterMarkName.Length;
char c;
int rise = 0;
for (int i = 1; i < total; i++)
{
rise = 500;
content = pdfStamper.GetOverContent(i);//在内容上方加水印
//content = pdfStamper.GetUnderContent(i);//在内容下方加水印
content.BeginText();
content.SetColorFill(BaseColor.DARK_GRAY);
content.SetFontAndSize(font, 50);
// 设置水印文字字体倾斜 开始
if (j >= 15)
{
content.SetTextMatrix(200, 120);
for (int k = 0; k < j; k++)
{
content.SetTextRise(rise);
c = waterMarkName[k];
content.ShowText(c + "");
rise -= 20;
}
}
else
{
content.SetTextMatrix(180, 100);
for (int k = 0; k < j; k++)
{
content.SetTextRise(rise);
c = waterMarkName[k];
content.ShowText(c + "");
rise -= 18;
}
}
// 字体设置结束
content.EndText();
// 画一个圆
//content.Ellipse(250, 450, 350, 550);
//content.SetLineWidth(1f);
//content.Stroke();
}
}
catch (Exception ex)
{
throw ex;
}
finally
{
if (pdfStamper != null)
pdfStamper.Close();
if (pdfReader != null)
pdfReader.Close();
}
}
示例12: EgsCheckTest3
public void EgsCheckTest3() {
Document document = new Document();
PdfAWriter writer = PdfAWriter.GetInstance(document,
new FileStream(OUT + "pdfa2EgsCheckTest3.pdf", FileMode.Create), PdfAConformanceLevel.PDF_A_2A);
writer.CreateXmpMetadata();
document.Open();
Font font = FontFactory.GetFont(RESOURCES + "FreeMonoBold.ttf", BaseFont.WINANSI, BaseFont.EMBEDDED, 12);
document.Add(new Paragraph("Hello World", font));
PdfContentByte canvas = writer.DirectContent;
PdfGState gs = new PdfGState();
PdfDictionary dict = new PdfDictionary();
dict.Put(PdfName.HALFTONETYPE, new PdfNumber(5));
dict.Put(PdfName.HALFTONENAME, new PdfName("Test"));
gs.Put(PdfName.HT, dict);
canvas.SetGState(gs);
bool exceptionThrown = false;
try {
document.Close();
}
catch (PdfAConformanceException e) {
exceptionThrown = true;
}
if (!exceptionThrown)
Assert.Fail("PdfAConformanceException should be thrown.");
}
示例13: TransparencyCheckTest4
public void TransparencyCheckTest4() {
// step 1
Document document = new Document(new Rectangle(850, 600));
// step 2
PdfAWriter writer
= PdfAWriter.GetInstance(document, new FileStream(OUT + "pdfa2TransperancyCheckTest4.pdf", FileMode.Create),
PdfAConformanceLevel.PDF_A_2B);
writer.CreateXmpMetadata();
// step 3
document.Open();
// step 4
PdfContentByte canvas = writer.DirectContent;
// add the clipped image
Image img = Image.GetInstance(RESOURCES + "img/bruno_ingeborg.jpg");
float w = img.ScaledWidth;
float h = img.ScaledHeight;
canvas.Ellipse(1, 1, 848, 598);
canvas.Clip();
canvas.NewPath();
canvas.AddImage(img, w, 0, 0, h, 0, -600);
// Create a transparent PdfTemplate
PdfTemplate t2 = writer.DirectContent.CreateTemplate(850, 600);
PdfTransparencyGroup transGroup = new PdfTransparencyGroup();
transGroup.Put(PdfName.CS, PdfName.DEVICEGRAY);
transGroup.Isolated = true;
transGroup.Knockout = false;
t2.Group = transGroup;
// Add transparent ellipses to the template
int gradationStep = 30;
float[] gradationRatioList = new float[gradationStep];
for (int i = 0; i < gradationStep; i++) {
gradationRatioList[i] = 1 - (float) Math.Sin(Math.PI/180*90.0f/gradationStep*(i + 1));
}
for (int i = 1; i < gradationStep + 1; i++) {
t2.SetLineWidth(5*(gradationStep + 1 - i));
t2.SetGrayStroke(gradationRatioList[gradationStep - i]);
t2.Ellipse(0, 0, 850, 600);
t2.Stroke();
}
// Create an image mask for the direct content
PdfDictionary maskDict = new PdfDictionary();
maskDict.Put(PdfName.TYPE, PdfName.MASK);
maskDict.Put(PdfName.S, new PdfName("Luminosity"));
maskDict.Put(new PdfName("G"), t2.IndirectReference);
PdfGState gState = new PdfGState();
gState.Put(PdfName.SMASK, maskDict);
canvas.SetGState(gState);
canvas.AddTemplate(t2, 0, 0);
FileStream iccProfileFileStream = File.Open(RESOURCES + "sRGB Color Space Profile.icm", FileMode.Open, FileAccess.Read, FileShare.Read);
ICC_Profile icc = ICC_Profile.GetInstance(iccProfileFileStream);
iccProfileFileStream.Close();
writer.SetOutputIntents("Custom", "", "http://www.color.org", "sRGB IEC61966-2.1", icc);
// step 5
document.Close();
}
示例14: TransparencyCheckTest2
public void TransparencyCheckTest2() {
Document document = new Document();
try {
// step 2
PdfAWriter writer = PdfAWriter.GetInstance(document,
new FileStream(OUT + "pdfa2TransperancyCheckTest2.pdf", FileMode.Create), PdfAConformanceLevel.PDF_A_2B);
writer.CreateXmpMetadata();
// step 3
document.Open();
PdfDictionary sec = new PdfDictionary();
sec.Put(PdfName.GAMMA, new PdfArray(new float[] {2.2f, 2.2f, 2.2f}));
sec.Put(PdfName.MATRIX,
new PdfArray(new float[]
{0.4124f, 0.2126f, 0.0193f, 0.3576f, 0.7152f, 0.1192f, 0.1805f, 0.0722f, 0.9505f}));
sec.Put(PdfName.WHITEPOINT, new PdfArray(new float[] {0.9505f, 1f, 1.089f}));
PdfArray arr = new PdfArray(PdfName.CALRGB);
arr.Add(sec);
writer.SetDefaultColorspace(PdfName.DEFAULTRGB, writer.AddToBody(arr).IndirectReference);
// step 4
PdfContentByte cb = writer.DirectContent;
float gap = (document.PageSize.Width - 400)/3;
PictureBackdrop(gap, 500f, cb);
PictureBackdrop(200 + 2*gap, 500, cb);
PictureBackdrop(gap, 500 - 200 - gap, cb);
PictureBackdrop(200 + 2*gap, 500 - 200 - gap, cb);
PictureCircles(gap, 500, cb);
cb.SaveState();
PdfGState gs1 = new PdfGState();
gs1.FillOpacity = 0.5f;
cb.SetGState(gs1);
PictureCircles(200 + 2*gap, 500, cb);
cb.RestoreState();
cb.SaveState();
PdfTemplate tp = cb.CreateTemplate(200, 200);
PdfTransparencyGroup group = new PdfTransparencyGroup();
tp.Group = group;
PictureCircles(0, 0, tp);
cb.SetGState(gs1);
cb.AddTemplate(tp, gap, 500 - 200 - gap);
cb.RestoreState();
cb.SaveState();
tp = cb.CreateTemplate(200, 200);
tp.Group = group;
PdfGState gs2 = new PdfGState();
gs2.FillOpacity = 0.5f;
gs2.BlendMode = PdfGState.BM_HARDLIGHT;
tp.SetGState(gs2);
PictureCircles(0, 0, tp);
cb.AddTemplate(tp, 200 + 2*gap, 500 - 200 - gap);
cb.RestoreState();
Font font = FontFactory.GetFont(RESOURCES + "FreeMonoBold.ttf",
BaseFont.WINANSI, true);
font.Color = BaseColor.BLACK;
cb.ResetRGBColorFill();
ColumnText ct = new ColumnText(cb);
Phrase ph = new Phrase("Ungrouped objects\nObject opacity = 1.0", font);
ct.SetSimpleColumn(ph, gap, 0, gap + 200, 500, 18, Element.ALIGN_CENTER);
ct.Go();
ph = new Phrase("Ungrouped objects\nObject opacity = 0.5", font);
ct.SetSimpleColumn(ph, 200 + 2*gap, 0, 200 + 2*gap + 200, 500,
18, Element.ALIGN_CENTER);
ct.Go();
ph = new Phrase("Transparency group\nObject opacity = 1.0\nGroup opacity = 0.5\nBlend mode = Normal",
font);
ct.SetSimpleColumn(ph, gap, 0, gap + 200, 500 - 200 - gap, 18, Element.ALIGN_CENTER);
ct.Go();
ph = new Phrase(
"Transparency group\nObject opacity = 0.5\nGroup opacity = 1.0\nBlend mode = HardLight", font);
ct.SetSimpleColumn(ph, 200 + 2*gap, 0, 200 + 2*gap + 200, 500 - 200 - gap,
18, Element.ALIGN_CENTER);
ct.Go();
//ICC_Profile icc = ICC_Profile.GetInstance(File.Open(RESOURCES + "sRGB Color Space Profile.icm", FileMode.Open, FileAccess.Read, FileShare.Read));
//writer.SetOutputIntents("Custom", "", "http://www.color.org", "sRGB IEC61966-2.1", icc);
}
catch (DocumentException de) {
Console.Error.WriteLine(de.Message);
}
catch (IOException ioe) {
Console.Error.WriteLine(ioe.Message);
}
bool conformanceExceptionThrown = false;
try {
document.Close();
}
catch (PdfAConformanceException pdface) {
conformanceExceptionThrown = true;
}
if (!conformanceExceptionThrown)
Assert.Fail("PdfAConformance exception should be thrown on unknown blend mode.");
}
示例15: MarcaCancelado
private String MarcaCancelado(String path)
{
PdfReader reader = new PdfReader(path);
FileStream fs = null;
PdfStamper stamp = null;
var fileOutput = Path.GetTempFileName() + ".pdf";
string outputPdf = String.Format(fileOutput, Guid.NewGuid().ToString());
fs = new FileStream(outputPdf, FileMode.CreateNew, FileAccess.Write);
stamp = new PdfStamper(reader, fs);
BaseFont bf = BaseFont.CreateFont(@"c:\windows\fonts\arial.ttf", BaseFont.CP1252, true);
PdfGState gs = new PdfGState();
gs.FillOpacity = 0.35F;
gs.StrokeOpacity = 0.35F;
for (int nPag = 1; nPag <= reader.NumberOfPages; nPag++)
{
Rectangle tamPagina = reader.GetPageSizeWithRotation(nPag);
PdfContentByte over = stamp.GetOverContent(nPag);
over.BeginText();
WriteTextToDocument(bf, tamPagina, over, gs, "CANCELADO");
over.EndText();
}
reader.Close();
if (stamp != null) stamp.Close();
if (fs != null) fs.Close();
return fileOutput;
}