public static void UsingTextStamp() { // ExStart:UsingTextStamp // The path to the documents directory. string dataDir = RunExamples.GetDataDir_AsposePdf_Text(); // Create Document instance Document pdfDocument = new Document(); // Add page to pages collection of Document Page page = pdfDocument.Pages.Add(); // Instantiate TextStamp instance with sample text TextStamp stamp = new TextStamp("This is text stamp with character spacing"); // Specify font name for Stamp object stamp.TextState.Font = FontRepository.FindFont("Arial"); // Specify Font size for TextStamp stamp.TextState.FontSize = 12; // Specify character specing as 1f stamp.TextState.CharacterSpacing = 1f; // Set the XIndent for Stamp stamp.XIndent = 100; // Set the YIndent for Stamp stamp.YIndent = 500; // Add textual stamp to page instance stamp.Put(page); dataDir = dataDir + "CharacterSpacingUsingTextStamp_out_.pdf"; // Save resulting PDF document. pdfDocument.Save(dataDir); // ExEnd:UsingTextStamp Console.WriteLine("\nCharacter spacing specified successfully using text stamp.\nFile saved at " + dataDir); }
public static void UsingTextStamp() { // ExStart:UsingTextStamp // The path to the documents directory. string dataDir = RunExamples.GetDataDir_AsposePdf_Text(); // Create Document instance Document pdfDocument = new Document(); // Add page to pages collection of Document Page page = pdfDocument.Pages.Add(); // Instantiate TextStamp instance with sample text TextStamp stamp = new TextStamp("This is text stamp with character spacing"); // Specify font name for Stamp object stamp.TextState.Font = FontRepository.FindFont("Arial"); // Specify Font size for TextStamp stamp.TextState.FontSize = 12; // Specify character specing as 1f stamp.TextState.CharacterSpacing = 1f; // Set the XIndent for Stamp stamp.XIndent = 100; // Set the YIndent for Stamp stamp.YIndent = 500; // Add textual stamp to page instance stamp.Put(page); dataDir = dataDir + "CharacterSpacingUsingTextStamp_out.pdf"; // Save resulting PDF document. pdfDocument.Save(dataDir); // ExEnd:UsingTextStamp Console.WriteLine("\nCharacter spacing specified successfully using text stamp.\nFile saved at " + dataDir); }