I am trying to stamp a pdf document. Attached is the sample
document with stamp text “PAID IN FULL”. I am able to do something close to it
but not the “FillStroke”. Can you please provide some assistance?
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
Code Snippet:
PdfFileStamp fileStamp = new PdfFileStamp(outFile,
stamppedFIle);
//create stamp
Aspose.Pdf.Facades.Stamp stamp = new Aspose.Pdf.Facades.Stamp();
stamp.BindLogo(new FormattedText("PAID IN FULL", System.Drawing.Color.Gray, "Arial",
EncodingType.Winansi, true, 78));
stamp.SetOrigin(100, 100);
stamp.Opacity = 5;
stamp.BlendingSpace = BlendingColorSpace.DeviceRGB;
stamp.Rotation = 45.0F;
stamp.IsBackground = false;
//add stamp to PDF file
fileStamp.AddStamp(stamp);
//save updated PDF file
fileStamp.Close();
Thank you.
Hi Robert,
Thanks for your inquiry. I am afraid the requested feature is not available in Aspose.Pdf. We have logged an enhancement ticket PDFNEWNET-37131 in our issue tracking system for the same. We will keep you updated about the issue resolution progress.
We are sorry for the inconvenience caused.
Best Regards,
@boadean
Thanks for your patience.
We are pleased to inform you that earlier logged issue PDFNET-37131 has been resolved in Aspose.PDF for .NET 18.1. We have implemented setting of rendering mode for text adding and editing scenarios. In order to render stroke text, please create TextState
object and set RenderingMode
to TextRenderingMode.StrokeText
and also select color for StrokingColor
property. You may then bind TextState
to the stamp using new BindTextState()
method.
The changed code will be following:
// Facades example
// Create TextState object to transfer advanced properties
TextState ts = new TextState();
// Set color for stroke
ts.StrokingColor = Color.Gray;
// Set text rendering mode
ts.RenderingMode = TextRenderingMode.StrokeText;
PdfFileStamp fileStamp = new PdfFileStamp(outFile, stamppedFIle);
Aspose.Pdf.Facades.Stamp stamp = new Aspose.Pdf.Facades.Stamp();
stamp.BindLogo(new FormattedText("PAID IN FULL", System.Drawing.Color.Gray, "Arial", EncodingType.Winansi, true, 78));
// Bind TextState
stamp.BindTextState(ts);
stamp.SetOrigin(100, 100);
stamp.Opacity = 5;
stamp.BlendingSpace = BlendingColorSpace.DeviceRGB;
stamp.Rotation = 45.0F;
stamp.IsBackground = false;
fileStamp.AddStamp(stamp);
fileStamp.Close();
In case of any further assistance, please feel free to let us know.