public static void Run() { //ExStart: TextAlignmentForFloatingBoxContents // The path to the documents directory. string dataDir = RunExamples.GetDataDir_AsposePdf_Text(); Aspose.Pdf.Document doc = new Document(); doc.Pages.Add(); Aspose.Pdf.FloatingBox floatBox = new Aspose.Pdf.FloatingBox(100, 100); floatBox.VerticalAlignment = VerticalAlignment.Bottom; floatBox.HorizontalAlignment = Aspose.Pdf.HorizontalAlignment.Right; floatBox.Paragraphs.Add(new TextFragment("FloatingBox_bottom")); floatBox.Border = new Aspose.Pdf.BorderInfo(Aspose.Pdf.BorderSide.All, Aspose.Pdf.Color.Blue); doc.Pages[1].Paragraphs.Add(floatBox); Aspose.Pdf.FloatingBox floatBox1 = new Aspose.Pdf.FloatingBox(100, 100); floatBox1.VerticalAlignment = VerticalAlignment.Center; floatBox1.HorizontalAlignment = Aspose.Pdf.HorizontalAlignment.Right; floatBox1.Paragraphs.Add(new TextFragment("FloatingBox_center")); floatBox1.Border = new Aspose.Pdf.BorderInfo(Aspose.Pdf.BorderSide.All, Aspose.Pdf.Color.Blue); doc.Pages[1].Paragraphs.Add(floatBox1); Aspose.Pdf.FloatingBox floatBox2 = new Aspose.Pdf.FloatingBox(100, 100); floatBox2.VerticalAlignment = VerticalAlignment.Top; floatBox2.HorizontalAlignment = Aspose.Pdf.HorizontalAlignment.Right; floatBox2.Paragraphs.Add(new TextFragment("FloatingBox_top")); floatBox2.Border = new Aspose.Pdf.BorderInfo(Aspose.Pdf.BorderSide.All, Aspose.Pdf.Color.Blue); doc.Pages[1].Paragraphs.Add(floatBox2); doc.Save(dataDir + "FloatingBox_alignment_review_out.pdf"); //ExEnd: TextAlignmentForFloatingBoxContents }
public static void Run() { // ExStart:1 // The path to the documents directory. string dataDir = RunExamples.GetDataDir_AsposePdf_WorkingDocuments(); Aspose.Pdf.Document pdf = new Aspose.Pdf.Document(); Aspose.Pdf.Page sec1 = pdf.Pages.Add(); Aspose.Pdf.Text.TextFragment t1 = new Aspose.Pdf.Text.TextFragment("paragraph 3 segment"); sec1.Paragraphs.Add(t1); Aspose.Pdf.Text.TextSegment seg1 = new Aspose.Pdf.Text.TextSegment(); t1.Text = "paragraph 3 segment 1"; t1.TextState.ForegroundColor = Color.Red; t1.TextState.FontSize = 12; Aspose.Pdf.Image image1 = new Aspose.Pdf.Image(); image1.File = dataDir + "test_image.png"; Aspose.Pdf.FloatingBox box1 = new Aspose.Pdf.FloatingBox(117, 21); sec1.Paragraphs.Add(box1); box1.Left = -4; box1.Top = -4; box1.Paragraphs.Add(image1); pdf.Save(dataDir + "CreateMultiLayerPdf_out.pdf"); // ExEnd:1 }
public static void Run() { // ExStart:1 // The path to the documents directory. string dataDir = RunExamples.GetDataDir_AsposePdf_StampsWatermarks(); // Instantiate Document instance Aspose.Pdf.Document pdf = new Aspose.Pdf.Document(); // Add a Page into the pdf document Aspose.Pdf.Page page = pdf.Pages.Add(); // Initializes a new instance of the FloatingBox class Aspose.Pdf.FloatingBox box1 = new Aspose.Pdf.FloatingBox(140, 80); // Float value that indicates left position of the paragraph box1.Left = 2; // Float value that indicates top position of the paragraph box1.Top = 10; // Add the macros to the paragraphs collection of the FloatingBox box1.Paragraphs.Add(new Aspose.Pdf.Text.TextFragment("Page: ($p/ $P )")); // Add a floatingBox to the page page.Paragraphs.Add(box1); // Save the document pdf.Save(dataDir + "PageNumberinHeaderFooterUsingFloatingBox_out.pdf"); // ExEnd:1 }
public static void Run() { // ExStart:2 // The path to the documents directory. string dataDir = RunExamples.GetDataDir_AsposePdf_WorkingDocuments(); int alpha = 10; int green = 0; int red = 100; int blue = 0; Color alphaColor = Color.FromArgb(alpha, red, green, blue); Aspose.Pdf.Document doc = new Aspose.Pdf.Document(); Aspose.Pdf.Page page = doc.Pages.Add(); Aspose.Pdf.Text.TextFragment t1 = new Aspose.Pdf.Text.TextFragment("paragraph 3 segment"); t1.TextState.ForegroundColor = Color.Red; t1.IsInLineParagraph = true; t1.TextState.FontSize = 12; Aspose.Pdf.FloatingBox TextFloatingBox1 = new Aspose.Pdf.FloatingBox(117, 21); TextFloatingBox1.ZIndex = 1; TextFloatingBox1.Left = -4; TextFloatingBox1.Top = -4; page.Paragraphs.Add(TextFloatingBox1); TextFloatingBox1.Paragraphs.Add(t1); Aspose.Pdf.Image image1 = new Aspose.Pdf.Image(); image1.File = dataDir + "test_image.png"; Aspose.Pdf.FloatingBox ImageFloatingBox = new Aspose.Pdf.FloatingBox(117, 21); page.Paragraphs.Add(ImageFloatingBox); ImageFloatingBox.Left = -4; ImageFloatingBox.Top = -4; ImageFloatingBox.ZIndex = 2; ImageFloatingBox.Paragraphs.Add(image1); doc.Save(dataDir + @"Multilayer-2ndApproach_out.pdf"); // ExEnd:2 }