Free Support Forum - aspose.com

Stamp a Paragraph over PDF

Hello,


Can it possible to Stemp a paragraph over PDF by aspose as i want to stamp below text as(Terms and condition ) over PDF can it possible its argent actually tomorrow is demo with client
do need full ASAP Thanks in Advance.

Terms & Conditions

Electronic Supporting Information files are available without a subscription to innodata Web Editions. The American Chemical Society holds a copyright ownership interest in any copyrightable Supporting Information. Files available from the innodata website may be downloaded for personal use only. Users are not otherwise permitted to reproduce, republish, redistribute, or sell any Supporting Information from the innodata website, either in whole or in part, in either machine-readable form or any other form without permission from the American Chemical Society. For permission to reproduce, republish and redistribute this material, requesters must process their own requests via the RightsLink permission system. Information about how to use the RightsLink permission system can be found at innodata.com

thanks,
laxman singh negi

Hi Laxman,


Thanks for your inquiry. You can easily add multi-line watermark to your Pdf file using Aspose.Pdf.Facades namespace. Please check following documentation link for details and code snippet.
Hopefully it will serve the purpose.

Adding multi-line Watermark to existing PDF

Please feel free to contact us for any further assistance.

Best Regards,

Hello,


please find the attachments with output sample can it possible to watermark whole paragraph .

Hi Laxman,


Can you please try using the following code snippet and see if it can fulfill your requirements. For your reference, I have also attached the resultant PDF file generated with following code snippet.

[C#]

//open document<o:p></o:p>

PdfFileStamp fileStamp = new PdfFileStamp();

fileStamp.BindPdf("c:/pdftest/FieldLimit_output.pdf");

//Instantiate a stamp object

Aspose.Pdf.Facades.Stamp logoStamp = new Aspose.Pdf.Facades.Stamp();

//Instantiate an object of FormattedText class

FormattedText formatText = new FormattedText("Terms & Conditions",

System.Drawing.Color.FromArgb(0, 0, 0), Aspose.Pdf.Facades.FontStyle.Helvetica, EncodingType.Winansi, false, 12);

//Add another line for Stamp

formatText.AddNewLineText("");

//Add another line for Stamp

formatText.AddNewLineText("Electronic Supporting Information files are available without a subscription to ACS Web Editions.");

formatText.AddNewLineText("The American Chemical Society holds a copyright ownership interest in any copyrightable Supporting ");

formatText.AddNewLineText("Information. Files available from the ACS website may be downloaded for personal use only. Users are ");

formatText.AddNewLineText("not otherwise permitted to reproduce, republish, redistribute, or sell any Supporting Information ");

formatText.AddNewLineText("from the ACS website, either in whole or in part, in from the ACS website, either in whole or in part,");

formatText.AddNewLineText(" in either machine-readable form or any other form without permission from the American Chemical Society. ");

formatText.AddNewLineText("For permission to reproduce, republish and redistribute this material, requesters must process their own ");

formatText.AddNewLineText("requests via the RightsLink permission system. Information about how to use the RightsLink permission");

formatText.AddNewLineText(" system can be found at http://pubs.acs.org/page/copyright/permissions.html.");

logoStamp.SetOrigin(20, 300);

//BindLogo to PDF

logoStamp.BindLogo(formatText);

//add stamp to PDF file

fileStamp.AddStamp(logoStamp);

// save the document with text watermark

fileStamp.Save("c:/pdftest/StampedPage.pdf");

//save updated PDF file

fileStamp.Close();

Hi Laxman,


Adding more to my previous comments, please note that Line break (\n) is not working when adding text stamp in PDF file. Once this problem is resolved, we can add the complete paragraph as an argument to AddNewLineText(…) method instead of calling this method again and again. For the sake of correction, I have logged this
issue as
PDFNEWNET-34962 in our issue tracking system. We will
further look into the details of this problem and will keep you updated on the
status of correction. Please be patient and spare us little time.

We are sorry
for this inconvenience.

<span style=“font-size:10.0pt;font-family:“Arial”,“sans-serif”;
mso-fareast-font-family:“Times New Roman”;color:#333333”><o:p></o:p>

Thanks for Pre…


i had need some help regarding stamping can it possible to create term and condition
formatting as my attachments with this main out put look like as attachments Term and condition part thanks in advane

Thanks for Pre…


i had need some help regarding stamping can it possible to create term and condition
formatting as my attachments with this main out put look like as attachments Term and condition part

As i am attaching bi00049a034_si_001.pdf needed out put and in input.pdf we need to stamping as bi00049a034_si_001.pdf only the term and condition part.




thanks in advance
Hi Laxman,

In order to add multi-line text to PDF file, you need to break the string by your self and follow the approach as specified earlier. However as per requirement of adding some text with formatting (as terms and Condition string is in bold), you may try using TextFragment but still this class is also causing issue with line break. We will further look into the details of this problem and will keep you updated on the status of correction.

We are sorry for this inconvenience.

[C#]

//open document
Document pdfDocument = new Document("c:/pdftest/Input (1).pdf");
//get particular page
Page pdfPage = (Page)pdfDocument.Pages[1];
//create text fragment
TextFragment textFragment = new TextFragment("Terms & Conditions");
textFragment.Position = new Position(100, 600);
//set text properties
textFragment.TextState.FontSize = 12;
textFragment.TextState.Font = FontRepository.FindFont("Arial");
textFragment.TextState.FontStyle = FontStyles.Bold;
// create TextBuilder object
TextBuilder textBuilder = new TextBuilder(pdfPage);
// append the text fragment to the PDF page
textBuilder.AppendText(textFragment);


//create text fragment
TextFragment textFragment2 = new TextFragment("Electronic Supporting Information f iles are available w ithout a subscription to \n ACS Web Edit ions. The American Chemical Society \n holds a copyright ownership interest in any copyrightable Supporting Information. Files available f rom the ACS website may be");
textFragment2.Position = new Position(100, 500);
//set text properties
textFragment2.TextState.FontSize = 12;
textFragment2.TextState.Font = FontRepository.FindFont("Arial");
// create TextBuilder object
TextBuilder textBuilder2 = new TextBuilder(pdfPage);
// append the text fragment to the PDF page
textBuilder.AppendText(textFragment2);
//save document

pdfDocument.Save("c:/pdftest/Text_Watermark_output.pdf");

Hello

I have nedeed as below result can it possible


Client:
Inline image 2

Inline image 4
Your Sample:
Inline image 3

hello


can it possible to stamp under line text over pdf as below

http://pubs.acs.org/page/copyright/permissions.html.

lnegi:
can it possible to stamp under line text over pdf as below
Hi Laxman,

I am afraid the FontStyles enumeration does not support Underline value so currently we cannot add underline text when using TextFragment class. We already have logged this requirement as PDFNEWNET-34380 under new features list. As soon as this feature becomes available, we would be more than happy to update you with the status of correction. Please be patient and spare us little time.

However as a workaround, you can add URL string using TextFragment object and add underline by placing Line annotation using CreateLine(…) method of PdfContentEditor class. Please take a look over following code snippet.

[C#]

//open document<o:p></o:p>

Document pdfDocument = new Document("c:/pdftest/Doc1.pdf");

//get particular page

Page pdfPage = (Page)pdfDocument.Pages[1];

//create text fragment

TextFragment textFragment = new TextFragment("http://pubs.acs.org/page/copyright/permissions.html");

textFragment.Position = new Position(100, 600);

//set text properties

textFragment.TextState.FontSize = 12;

textFragment.TextState.Font = FontRepository.FindFont("Arial");

// create TextBuilder object

TextBuilder textBuilder = new TextBuilder(pdfPage);

// append the text fragment to the PDF page

textBuilder.AppendText(textFragment);

PdfContentEditor editor = new PdfContentEditor();

//editor.BindPdf("c:/pdftest/Doc1.pdf");

editor.BindPdf(pdfDocument);

// create line annotation in PDF file

editor.CreateLine(new System.Drawing.Rectangle(100, 600, 380, 110), "", 100, 600, 380, 600, 1, 1, System.Drawing.Color.Black, "U", new int[] { 2, 3 }, new string[] { "None", "None" });

// save the updated document

editor.Save(“c:/pdftest/Doc1_example_out.pdf”);



For your reference, I have attached the PDF file which is generated over my end.
lnegi:
Hello

I have nedeed as below result can it possible


Client:
Inline image 2

Inline image 4
Your Sample:
Inline image 3
Hi Laxman,

I am afraid I am unable to understand the above query. Can you please share some details so that we can try replicating this problem at our end. We apologize for your inconvenience.

hello

i am writing code as below but getting following issue raised by client please check and
provide me conclusion ASAP

//open document
PdfFileStamp fileStamp2 = new PdfFileStamp();
fileStamp2.BindPdf(@“D:\saspose\outputresult4.pdf”);

//Instantiate a stamp object
Aspose.Pdf.Facades.Stamp logoStamp2 = new Aspose.Pdf.Facades.Stamp();
//Instantiate an object of FormattedText class
FormattedText formatText2 = new FormattedText("", System.Drawing.Color.Black, System.Drawing.Color.White, Aspose.Pdf.Facades.FontStyle.Helvetica, EncodingType.Winansi, false, 8);
//Add another line for Stamp
float Space =.3F;
formatText2.AddNewLineText("Electronic Supporting Information files are available without a subscription to ACS Web Editions. The American Chemical Society ", Space);
formatText2.AddNewLineText("holds a copyright ownership interest in any copyrightable Supporting Information. Files available from the ACS website may be ", Space);
formatText2.AddNewLineText("downloaded for personal use only. Users are not otherw ise permitted to reproduce, republish, redistribute, or sell any Supporting ", Space);
formatText2.AddNewLineText("Information from the ACS website, either in whole or in part, in either machine-readable form or any other form without permission ", Space);
formatText2.AddNewLineText("from the American Chemical Society. For permission to reproduce, republish and redistribute this material, requesters must process ", Space);
formatText2.AddNewLineText("their own requests via the RightsLink permission system. Information about how to use the RightsLink permission system can be ", Space);
formatText2.AddNewLineText("found at ", Space);
//BindLogo to PDF
logoStamp2.BindLogo(formatText2);
logoStamp2.SetOrigin(40, 125);

logoStamp2.IsBackground = false;
logoStamp2.Opacity = 0.7F;
int[] j = { 1 };
logoStamp2.Pages = j;
//add stamp to PDF file
fileStamp2.AddStamp(logoStamp2);
// save the document with text watermark
fileStamp2.Save(@“D:\saspose\outputresult5.pdf”);
//save updated PDF file
fileStamp2.Close();
if (File.Exists(@“D:\saspose\outputresult4.pdf”))
{
File.Delete(@“D:\saspose\outputresult4.pdf”);
}


1) No underline on the link/URL - please have this implemented on the sample

2) Discrepancy on font color on the sample provided by ACS (black) versus the sample prepared by your tool(grayish):

Sample from Client - black

Inline image 4

Sample prepared by Your toll - grayish

Inline image 5

3) Presence of white broken lines on the T&C text content. At 125% (and below) magnification view, broken lines are very visible while at 150% view broken lines are not visible, please see screen grabs below.

At 100% and 125% page size/magnification:

Inline image 3

At 150% page size/magnification:

Inline image 2

line broken mark .



thannks;

laxman singh negi

hello

i am writing code as below but getting following issue raised by client please check and
provide me conclusion ASAP

//open document
PdfFileStamp fileStamp2 = new PdfFileStamp();
fileStamp2.BindPdf(@“D:\saspose\outputresult4.pdf”);

//Instantiate a stamp object
Aspose.Pdf.Facades.Stamp logoStamp2 = new Aspose.Pdf.Facades.Stamp();
//Instantiate an object of FormattedText class
FormattedText formatText2 = new FormattedText("", System.Drawing.Color.Black, System.Drawing.Color.White, Aspose.Pdf.Facades.FontStyle.Helvetica, EncodingType.Winansi, false, 8);
//Add another line for Stamp
float Space =.3F;
formatText2.AddNewLineText("Electronic Supporting Information files are available without a subscription to ACS Web Editions. The American Chemical Society ", Space);
formatText2.AddNewLineText("holds a copyright ownership interest in any copyrightable Supporting Information. Files available from the ACS website may be ", Space);
formatText2.AddNewLineText("downloaded for personal use only. Users are not otherw ise permitted to reproduce, republish, redistribute, or sell any Supporting ", Space);
formatText2.AddNewLineText("Information from the ACS website, either in whole or in part, in either machine-readable form or any other form without permission ", Space);
formatText2.AddNewLineText("from the American Chemical Society. For permission to reproduce, republish and redistribute this material, requesters must process ", Space);
formatText2.AddNewLineText("their own requests via the RightsLink permission system. Information about how to use the RightsLink permission system can be ", Space);
formatText2.AddNewLineText("found at ", Space);
//BindLogo to PDF
logoStamp2.BindLogo(formatText2);
logoStamp2.SetOrigin(40, 125);

logoStamp2.IsBackground = false;
logoStamp2.Opacity = 0.7F;
int[] j = { 1 };
logoStamp2.Pages = j;
//add stamp to PDF file
fileStamp2.AddStamp(logoStamp2);
// save the document with text watermark
fileStamp2.Save(@“D:\saspose\outputresult5.pdf”);
//save updated PDF file
fileStamp2.Close();
if (File.Exists(@“D:\saspose\outputresult4.pdf”))
{
File.Delete(@“D:\saspose\outputresult4.pdf”);
}


1) No underline on the link/URL - please have this implemented on the sample

2) Discrepancy on font color on the sample provided by ACS (black) versus the sample prepared by your tool(grayish):

Sample from Client - black

Inline image 4

Sample prepared by Your toll - grayish

Inline image 5

3) Presence of white broken lines on the T&C text content. At 125% (and below) magnification view, broken lines are very visible while at 150% view broken lines are not visible, please see screen grabs below.

At 100% and 125% page size/magnification:

Inline image 3

At 150% page size/magnification:

Inline image 2

line broken mark .



thannks;

laxman singh negi

Reminder!


let them know that this is getting urgent

Hi Laxman,


Please accept my apology for the delayed response. I’m afraid I can’t view the embedded images. Can you please share these images as attachment? So we understand your requirement and suggest you further accordingly.

Sorry for the inconvenience faced.

Best Regards,

hello

i am writing code as below but getting following issue raised by client please check and
provide me conclusion ASAP

//open document
PdfFileStamp fileStamp2 = new PdfFileStamp();
fileStamp2.BindPdf(@“D:\saspose\outputresult4.pdf”);

//Instantiate a stamp object
Aspose.Pdf.Facades.Stamp logoStamp2 = new Aspose.Pdf.Facades.Stamp();
//Instantiate an object of FormattedText class
FormattedText formatText2 = new FormattedText("", System.Drawing.Color.Black, System.Drawing.Color.White, Aspose.Pdf.Facades.FontStyle.Helvetica, EncodingType.Winansi, false, 8);
//Add another line for Stamp
float Space =.3F;
formatText2.AddNewLineText("Electronic Supporting Information files are available without a subscription to ACS Web Editions. The American Chemical Society ", Space);
formatText2.AddNewLineText("holds a copyright ownership interest in any copyrightable Supporting Information. Files available from the ACS website may be ", Space);
formatText2.AddNewLineText("downloaded for personal use only. Users are not otherw ise permitted to reproduce, republish, redistribute, or sell any Supporting ", Space);
formatText2.AddNewLineText("Information from the ACS website, either in whole or in part, in either machine-readable form or any other form without permission ", Space);
formatText2.AddNewLineText("from the American Chemical Society. For permission to reproduce, republish and redistribute this material, requesters must process ", Space);
formatText2.AddNewLineText("their own requests via the RightsLink permission system. Information about how to use the RightsLink permission system can be ", Space);
formatText2.AddNewLineText("found at ", Space);
//BindLogo to PDF
logoStamp2.BindLogo(formatText2);
logoStamp2.SetOrigin(40, 125);

logoStamp2.IsBackground = false;
logoStamp2.Opacity = 0.7F;
int[] j = { 1 };
logoStamp2.Pages = j;
//add stamp to PDF file
fileStamp2.AddStamp(logoStamp2);
// save the document with text watermark
fileStamp2.Save(@“D:\saspose\outputresult5.pdf”);
//save updated PDF file
fileStamp2.Close();
if (File.Exists(@“D:\saspose\outputresult4.pdf”))
{
File.Delete(@“D:\saspose\outputresult4.pdf”);
}
please find the attahements ita argent Tommorrow is the demo

Hi Laxman,


Thanks for sharing the details and sorry for the delayed response. I have gone through the code snippet that you have shared and the reason you are getting gray text is because you have used logoStamp2.Opacity = 0.7F;. Once this code line is removed, the text appears in black color. Furthermore, please try using the following code snippet to accomplish your requirements. For your reference, I have also attached the resultant PDF file which is generated over my end using Aspose.Pdf for .NET 7.7.0.

In case of any further query, please feel free to contact. We are sorry for your inconvenience.

[C#]

//open document<o:p></o:p>

Aspose.Pdf.Facades.PdfFileStamp fileStamp2 = new Aspose.Pdf.Facades.PdfFileStamp();

fileStamp2.BindPdf(@"c:\pdftest\HighLight_example_out.pdf");

//Instantiate a stamp object

Aspose.Pdf.Facades.Stamp logoStamp2 = new Aspose.Pdf.Facades.Stamp();

//Instantiate an object of FormattedText class

Aspose.Pdf.Facades.FormattedText formatText2 = new Aspose.Pdf.Facades.FormattedText("", System.Drawing.Color.Black, System.Drawing.Color.White, Aspose.Pdf.Facades.FontStyle.Helvetica, EncodingType.Winansi, false, 8);

//Add another line for Stamp

formatText2.AddNewLineText("");

float Space = .3F;

formatText2.AddNewLineText("Electronic Supporting Information files are available without a subscription to ACS Web Editions. The American Chemical Society ", Space);

formatText2.AddNewLineText("holds a copyright ownership interest in any copyrightable Supporting Information. Files available from the ACS website may be ", Space);

formatText2.AddNewLineText("downloaded for personal use only. Users are not otherw ise permitted to reproduce, republish, redistribute, or sell any Supporting ", Space);

formatText2.AddNewLineText("Information from the ACS website, either in whole or in part, in either machine-readable form or any other form without permission ", Space);

formatText2.AddNewLineText("from the American Chemical Society. For permission to reproduce, republish and redistribute this material, requesters must process ", Space);

formatText2.AddNewLineText("their own requests via the RightsLink permission system. Information about how to use the RightsLink permission system can be ", Space);

formatText2.AddNewLineText("found at ", Space);

//BindLogo to PDF

logoStamp2.BindLogo(formatText2);

logoStamp2.SetOrigin(40, 125);

logoStamp2.IsBackground = false;

// logoStamp2.Opacity = 0.7F;

int[] j = { 1 };

logoStamp2.Pages = j;

//add stamp to PDF file

fileStamp2.AddStamp(logoStamp2);

// create MemoryStream object to hold stamped file

MemoryStream stream = new MemoryStream();

// save the document with text watermark

//fileStamp2.Save(@"c:\pdftest\Aspose_Test_Stamped.pdf");

fileStamp2.Save(stream);

//save updated PDF file

fileStamp2.Close();

//open document

Document pdfDocument = new Document(stream);

//get particular page

Page pdfPage = (Page)pdfDocument.Pages[1];

//create text fragment

TextFragment textFragment1 = new TextFragment("Terms & Conditions");

textFragment1.Position = new Position(40, 195);

//set text properties

textFragment1.TextState.FontSize = 10;

textFragment1.TextState.Font = FontRepository.FindFont("Arial");

textFragment1.TextState.FontStyle = FontStyles.Bold;

// create TextBuilder object

TextBuilder textBuilder2 = new TextBuilder(pdfPage);

// append the text fragment to the PDF page

textBuilder2.AppendText(textFragment1);

//create text fragment

TextFragment textFragment = new TextFragment("http://pubs.acs.org/page/copyright/permissions.html");

textFragment.Position = new Position(70, 125);

//set text properties

textFragment.TextState.FontSize = 8;

textFragment.TextState.Font = FontRepository.FindFont("Arial");

textFragment.TextState.ForegroundColor = System.Drawing.Color.Blue;

// create TextBuilder object

TextBuilder textBuilder = new TextBuilder(pdfPage);

// append the text fragment to the PDF page

textBuilder.AppendText(textFragment);

PdfContentEditor editor = new PdfContentEditor();

//editor.BindPdf("c:/pdftest/Doc1.pdf");

editor.BindPdf(pdfDocument);

// create line annotation in PDF file

editor.CreateLine(new System.Drawing.Rectangle(70, 123, 380, 110), "", 70, 123, 255, 123, 1, 1, System.Drawing.Color.Blue, "U", new int[] { 2, 3 }, new string[] { "None", "None" });

// save the updated document

editor.Save("c:/pdftest/Correct_Stamped_output.pdf");

Hi,


Argent!!!
I have attached two pdf an one image file.

1.Outputresult.pdf (resultant out put by won code) for checking the spacing problem. as if we do zoom out and zoom in the pdf showing spacing as i have attached image file after 125 pdf resolution.
as i have highlighted by red arrow.


2.correct_Stamped_output.pdf created by your code as u had send me its not showing text as stamp .its hide the text under below(means text not transparent).

3.and hyperlink text not transparent.

please let me know if any concern ASAP.


thanks,
laxman

Hi Laxman,


In order to resolve the transparency related issue, you may un-comment Stamp.Opacity(…) property and use 0.3F; as its value. Furthermore, all the text objects can be added using single PdfFileStamp object but in order to add line, you need to try using CreateLine(…) method of PdfContentEditor class.

[C#]

//open document<o:p></o:p>

Aspose.Pdf.Facades.PdfFileStamp fileStamp2 = new Aspose.Pdf.Facades.PdfFileStamp();

fileStamp2.BindPdf(@"c:\pdftest\HighLight_example_out.pdf");

//Instantiate a stamp object

Aspose.Pdf.Facades.Stamp logoStamp2 = new Aspose.Pdf.Facades.Stamp();

//Instantiate an object of FormattedText class

Aspose.Pdf.Facades.FormattedText formatText2 = new Aspose.Pdf.Facades.FormattedText("", System.Drawing.Color.Black, System.Drawing.Color.White, Aspose.Pdf.Facades.FontStyle.Helvetica, EncodingType.Winansi, false, 8);

//Add another line for Stamp

formatText2.AddNewLineText("");

float Space = .3F;

formatText2.AddNewLineText("Electronic Supporting Information files are available without a subscription to ACS Web Editions. The American Chemical Society ", Space);

formatText2.AddNewLineText("holds a copyright ownership interest in any copyrightable Supporting Information. Files available from the ACS website may be ", Space);

formatText2.AddNewLineText("downloaded for personal use only. Users are not otherw ise permitted to reproduce, republish, redistribute, or sell any Supporting ", Space);

formatText2.AddNewLineText("Information from the ACS website, either in whole or in part, in either machine-readable form or any other form without permission ", Space);

formatText2.AddNewLineText("from the American Chemical Society. For permission to reproduce, republish and redistribute this material, requesters must process ", Space);

formatText2.AddNewLineText("their own requests via the RightsLink permission system. Information about how to use the RightsLink permission system can be ", Space);

formatText2.AddNewLineText("found at ", Space);

//BindLogo to PDF

logoStamp2.BindLogo(formatText2);

logoStamp2.SetOrigin(40, 125);

logoStamp2.IsBackground = false;

logoStamp2.Opacity = 0.3F;

int[] j = { 1 };

logoStamp2.Pages = j;

//add stamp to PDF file

fileStamp2.AddStamp(logoStamp2);

Aspose.Pdf.Facades.Stamp stamp = new Aspose.Pdf.Facades.Stamp();

stamp.BindLogo(new FormattedText("Terms & Conditions", System.Drawing.Color.Black, System.Drawing.Color.White, Aspose.Pdf.Facades.FontStyle.Helvetica, EncodingType.Winansi, true, 10));

stamp.SetOrigin(40, 195);

//set particular pages

stamp.Pages = new int[] { 1};

Aspose.Pdf.Facades.Stamp hyperlink_stamp = new Aspose.Pdf.Facades.Stamp();

hyperlink_stamp.BindLogo(new FormattedText("http://pubs.acs.org/page/copyright/permissions.html", System.Drawing.Color.Blue, System.Drawing.Color.White, Aspose.Pdf.Facades.FontStyle.Helvetica, EncodingType.Winansi, true, 8));

hyperlink_stamp.SetOrigin(70, 125);

//set particular pages

hyperlink_stamp.Pages = new int[] { 1 };

//add Terms&Condition stamp to PDF file

fileStamp2.AddStamp(stamp);

//add Hyperlink stamp to PDF file

fileStamp2.AddStamp(hyperlink_stamp);

// create MemoryStream object to hold stamped file

MemoryStream stream = new MemoryStream();

fileStamp2.Save(stream);

//save updated PDF file

fileStamp2.Close();

PdfContentEditor editor = new PdfContentEditor();

editor.BindPdf(stream);

// create line annotation in PDF file

editor.CreateLine(new System.Drawing.Rectangle(70, 123, 380, 110), "", 70, 123, 255, 123, 1, 1, System.Drawing.Color.Blue, "S", new int[] { 2, 3 }, new string[] { "None", "None" });

// save the updated document

editor.Save("c:/pdftest/Correct_Stamped_output.pdf");

// close the MemoryStream object

stream.Close();