We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Diagonal text watermark that appears only when printing?

Is it possible to have a text watermark/ annotation that only appears when printing, that goes diagonally across the page from bottom left to top right?


It seems like we would want to use the FreeTextAnnotation for this, since that supports the NoView and Print annotation flags. However, I don’t see a way to make this text diagonal.

Alternatively, it appears a TextStamp would allow us to set an angle for the text, but has no support for making the text only appear when printing.

An example of how we are trying to format the text is attached.

Hi Keith,


Thanks for contacting support.

Yes you are correct. Currently we can set flags for FreeTextAnnotation object but it does not support the feature to set rotate angle. However for the sake of implementation, I have logged this
requirement in our issue tracking system under New Features list as PDFNEWNET-38524.
We will further investigate this requirement in details and will keep you
updated on the status of a correction.

We apologize for your inconvenience.

We are considering buying the Priority Support and would like our issue evaluated to see if it will be appropriate.

Hi Keith,


Please note that
ES/PS support does not guarantee any immediate resolution of issues (because
it might be dependent on other issues or feature which needs to be implemented
)
but under this model, the development team starts investigating the
problem on high priority. For further details, please visit Support Options.

Hi Nayyaz


Is the diagonal Text or TexpStamp or Floating Box already implemented?

I badly need to put horizontal watermark in my pdf page. Maybe you can suggest small code.

Thanks,
Rolly

Hi Rolly,


Thanks for contacting support.

Aspose.Pdf for .NET supports the feature to add TextStamp and FloatingBox object to PDF file. For more information, please visit Adding Text Stamp in the PDF File

Furthermore, in order to add FloatingBox, please try using following code snippet.

[C#]

// Instantiate Document object<o:p></o:p>

Document doc = new Document();

// Add page to PDF document

Page page = doc.Pages.Add();

// Create FloatingBox object

Aspose.Pdf.FloatingBox aBox = new Aspose.Pdf.FloatingBox(40, 60);

// Set left position for FloatingBox

aBox.Left=40;

// Set Top position for FloatingBox

aBox.Top=80;

// Set Horizontal alignment for FloatingBox

aBox.HorizontalAlignment= Aspose.Pdf.HorizontalAlignment.Center;

// Add text fragment to paragraphs collection of FloatingBox

aBox.Paragraphs.Add(new TextFragment("main text"));

// Set border for FloatingBox

aBox.Border= new Aspose.Pdf.BorderInfo( Aspose.Pdf.BorderSide.All);

// Set background color for FloatingBox

aBox.BackgroundColor= Aspose.Pdf.Color.Yellow;

// Add FloatingBox to paragraphs collection of page object

page.Paragraphs.Add(aBox);

// Set background of PDF page

page.Background= Aspose.Pdf.Color.LightGray;

// Save the PDF document

doc.Save("c:/pdftest/FloatingBox.pdf");

HI,

Sorry I type it should be diagonally not horizontally.

Can you give some code to make text DIAGONAL

Thanks,
Rolly

Hi Rolly,


Thanks for sharing the details.

Please try using following code snippet to accomplish your requirements. For your reference, I have also attached the output generated over my end.

[C#]

// Instantiate Document object<o:p></o:p>

Document doc = new Document();

// Add page to PDF document

Page page = doc.Pages.Add();

TextStamp stamp = new TextStamp("Watermark String");

stamp.RotateAngle = 45;

//set origin

stamp.XIndent = 100;

stamp.YIndent = 100;

//set text properties

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

stamp.TextState.FontSize = 16.0F;

stamp.TextState.FontStyle = FontStyles.Bold;

stamp.TextState.FontStyle = FontStyles.Italic;

stamp.TextState.ForegroundColor = Aspose.Pdf.Color.FromRgb(System.Drawing.Color.Aqua);

// Add TextStamp to page object

page.AddStamp(stamp);

// Set background of PDF page

page.Background = Aspose.Pdf.Color.LightGray;

// Save the PDF document

doc.Save(“c:/pdftest/Diagnal_StampObject.pdf”);