خرید بک لینک

Vote count: 0

I want to create four repeating "templates" on a single PDF page. The "static" info in each quarter page will be the same, but there will be variable content that differs in each one. You can think of it as four "copies" of a login form or some such, but with the entries programmatically added, such as:

Real name: B. Clay Shaon
User name: Radicalia
Password: thatDaedKatzenjammer
Email address: clay@pigeon.com

Real name: Albert L.B. Kollenbo
User name: Grandpa
Password: caseyJonesBigBrother1907
Email address: princealbertinacan@balpeenhammer.org

(with another two at the right)

I have code to create a document and add a paragraph like so:

using (var ms = new MemoryStream())
{
    using (var doc = new Document(PageSize.A4, 25, 25, 25, 25))
    {
        using (var writer = PdfWriter.GetInstance(doc, ms))
        {
            doc.Open();

            Paragraph realName = new Paragraph("Real name:", 
times16BoldCyan);
            doc.Add(realName);
            . . .

This sort of thing works for a "normal" page, but in the scenario described above (four quarter pages stuffed into one page), how should I go about it? Should it be something like this:

    using (var msNorthWestQuadrant = new MemoryStream())
    {
        using (var docNorthWestQuadrant = new Document(PageSize.A4, 6.25, 
6.25, 6.25, 6.25))
        {
            using (var writer = PdfWriter.GetInstance(docNorthWestQuadrant, 
            msNorthWestQuadrant))
            {
                docNorthWestQuadrant.Open();

                Paragraph realName = new Paragraph("Real name:", 
times16BoldCyan);
                docNorthWestQuadrant.Add(realName);
                . . .

        using (var msNorthEastQuadrant = new MemoryStream())
        {
            using (var docNorthEastQuadrant = new Document(PageSize.A4, 
12.5, 12.5, 6.25, 6.25))
            {
                using (var writer = 
PdfWriter.GetInstance(docNorthEastQuadrant, msNorthEastQuadrant))
                {
                    docNorthEastQuadrant.Open();

                    Paragraph realName = new Paragraph("Real name:", 
times16BoldCyan);
                    docNorthEastQuadrant.Add(realName);
                    . . .

(etc. - with SouthEastQuadrant and SouthEastQuadrant, too?)

...or is that the wrong approach? If it is, what are the precise values I need for the PageSize locations/sizes (the "1.25"s above are just a wild guess).

asked 2 mins ago

برچسب: نویسنده: استخدام کار تاريخ: شنبه 22 اسفند 1394 ساعت: 21:35

صفحه بندی