Hi,
Hi Jak,
Aspose.Pdf.Document
pdfDocument = new Aspose.Pdf.Document();<o:p></o:p>
pdfDocument.Pages.Add();
DateTime dtServerTime = DateTime.Now;
DateTime dtEST = DateTime.Now;
Aspose.Pdf.Facades.FormattedText txtFormatted = new Aspose.Pdf.Facades.FormattedText();
txtFormatted.AddNewLineText("Processed/Reviewed By:");
txtFormatted.AddNewLineText(dtEST.ToString());
TextStamp textStamp = new TextStamp(txtFormatted);
textStamp.Background = true;
textStamp.BottomMargin = 50;
textStamp.HorizontalAlignment = Aspose.Pdf.HorizontalAlignment.Right;
textStamp.VerticalAlignment = VerticalAlignment.Bottom;
textStamp.XIndent = 10;
textStamp.YIndent = 10;
textStamp.TextState.FontSize = 10.0F;
textStamp.Opacity = 100;
//Set ID of stamp
textStamp.setStampId(999);
pdfDocument.Pages[1].AddStamp(textStamp);
pdfDocument.Save(“c:\pdftest\Test_output2.pdf”);
//load source document<o:p></o:p>
Aspose.Pdf.Facades.PdfContentEditor contentEditor = new Aspose.Pdf.Facades.PdfContentEditor();
contentEditor.BindPdf("c:\\pdftest\\Test_output2.pdf");
//remove stamp by Id (without stamps iterating)
contentEditor.DeleteStampByIds(new int[] { 999 });
//save result into intermediate file (may be stored into memory stream to don't deal with temporary flles)
contentEditor.Save(“c:/pdftest/Stamp_Removed.pdf”);
Hi Nayyer,
Hi Nayyer,
jak893:To remove the stamp:PdfContentEditor contentEditor = new PdfContentEditor();contentEditor.BindPdf(path);contentEditor.DeleteStampById(11235813);contentEditor.Save(@“C:\temp\test.pdf”);Ideally as well I’d like to avoid saving to a new file and would instead like to replace ‘C:\temp\test.pdf’ with ‘path’ so the original file is just resaved but with the stamps removed.Hi Jak,Thanks for sharing the details.I have again tested the scenario using Aspose.Pdf for .NET 9.3.0 in Visual Studio 2012 application where I have set the target platform of application as .NET Framework 4.0, running over Windows 7 (x64) and as per my observations, the Stamp object is properly being removed from PDF file. I have used the same code snippet to add stamp object, as you have stated in your earlier post.Now concerning to your other requirement of removing the stamp and saving output in same file, please try using the following code snippet.Can you please share some details regarding your working environment which can help us in replicating this issue at our end. We are sorry for this inconvenience.[C#]//
load source PDF file in Document object<o:p></o:p>Document doc = new Document(new FileStream("c:/pdftest/WithStamp - Copy.pdf", FileMode.OpenOrCreate));
PdfContentEditor contentEditor = new PdfContentEditor();
// bind Doccument object to Content Editor
contentEditor.BindPdf(doc);
contentEditor.DeleteStampById(11235813);
// save the updated Document object to save file (source/input)
doc.Save();
jak893:After some more digging around, I’ve gotten to the root of the issue. It seems that even though another developer has called the SetLicense method, this has only applied to for the Aspose Words module of our Total license and makes sense that when I try and manipulate the PDF, the software thinks it’s running in a trial state.Is there no way that I can call a global license method, this forum post would seem to suggest it’s not How to apply license for Aspose.Total for .Net, but it seems a little convoluted to have to call the SetLicense method for every module when a Total license has been purchased?
Aspose.Pdf.License license = new Aspose.Pdf.License();<o:p></o:p>
license.SetLicense("E:\Aspose.Total.lic");
Aspose.Words.License wordlic = new Aspose.Words.License();
wordlic.SetLicense("e:\Aspose.total.lic");