Quantcast
Channel: Aspose.Pdf Product Family
Viewing all articles
Browse latest Browse all 3131

FloatingBox to top left corner every pdf doc

$
0
0
hey,

i've write some code:

 Aspose.Pdf.Generator.Pdf pdf1 = new Aspose.Pdf.Generator.Pdf();
            Aspose.Pdf.Generator.Section sec1 = pdf1.Sections.Add();
            Aspose.Pdf.Generator.FloatingBox box1 = new Aspose.Pdf.Generator.FloatingBox(108, 180);
            sec1.Paragraphs.Add(box1);
            box1.BoxHorizontalPositioning = Aspose.Pdf.Generator.BoxHorizontalPositioningType.Page;
            box1.BoxHorizontalAlignment = Aspose.Pdf.Generator.BoxHorizontalAlignmentType.Left;
            box1.BoxVerticalPositioning = Aspose.Pdf.Generator.BoxVerticalPositioningType.Page;
            box1.BoxVerticalAlignment = Aspose.Pdf.Generator.BoxVerticalAlignmentType.Top;
            box1.Paragraphs.Add(new Aspose.Pdf.Generator.Text("Hello."));

            pdf1.Save("test.pdf");

            Aspose.Pdf.Document doc = new Aspose.Pdf.Document("test.pdf");
            var page = doc.Pages[1];
            Aspose.Pdf.FloatingBox aBox = new Aspose.Pdf.FloatingBox(40, 60);
            aBox.Left = 0;
            aBox.Top = 0;
            aBox.VerticalAlignment = Aspose.Pdf.VerticalAlignment.Top;
            aBox.HorizontalAlignment = Aspose.Pdf.HorizontalAlignment.Left;
            aBox.Paragraphs.Add((new Aspose.Pdf.Text.TextFragment("main text")));
            aBox.Border = new Aspose.Pdf.BorderInfo();
            aBox.BackgroundColor = Aspose.Pdf.Color.Yellow;
            page.Paragraphs.Add(aBox);
                    
            doc.Save("test2.pdf");



that code, generates two pdf files. i've attached them to post.
first part of code add HELLO text to  the floatingBox  at top left corner of page and save pdf.
second part of code opens that pdf document again and adds another (yellow) floatingbox with text MAIN TEXT again on top left corner then save pdf

second floating box is not at top left corner.

can i add floatingbox to left top corner on existsing pdf document (every pdf document or only generated with pdf.generator) ? can i add floatingbox to left border of page existsing documents (every pdf document or only generated with pdf.generator) ?

thanks for replay

Viewing all articles
Browse latest Browse all 3131

Trending Articles