We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Creating a Document or form

Thread ID:

Created:

Updated:

Platform:

Replies:

104218 Jun 29,2012 07:18 PM Jul 3,2012 04:52 AM Silverlight 2
loading
Tags: PDF
Administrator [Syncfusion]
Asked On June 29, 2012 07:18 PM

I'm just starting out with creating a pdf document and I'm pretty sure I want to create a document vs creating a form, because I'm going to create the form at runtime and the layout can vary.  If I'm going to output a read-only pdf, there is no use in creating a form vs just making a PdfDocument.

The other question is, I want to create a pdf that looks sort of like a form.  For example a text label, like 
Employee ID: 
and a value like 100 to look like:
Name:  Dan                 Employee ID:  100                

I'd want the underlines to show a defined length.  Do I draw a line under them, or is there some thing else I could do?

Also I plan to make a lot of rows, I guess I would add a bunch of rectangles with strings in them, but is there a way to do it like a cursor position, or do I have to get the exact pixel x/y points?





Administrator [Syncfusion]
Replied On July 2, 2012 08:24 PM

Ok, I think the best way to do it is to use pdfGrids.  Then use only the bottom border for the values.  Let me know if I'm on the right track:


                  PdfStringFormat cellFLeft = new PdfStringFormat(PdfTextAlignment.Left, PdfVerticalAlignment.Bottom);
                  PdfStringFormat cellFRight = new PdfStringFormat(PdfTextAlignment.Right, PdfVerticalAlignment.Bottom);


                  PdfPen noPen = new PdfPen(Colors.Transparent);
                  PdfPen botBorder = new PdfPen(Color.FromArgb(255, 0, 0, 0), 1f);
                  noPen.Width = 1.0f;

                  PdfGridCellStyle labelStyle = new PdfGridCellStyle();
                  labelStyle.Font = font;
                  PdfBorders pdfbNone = new PdfBorders();
                  pdfbNone.All = noPen;
                  labelStyle.Borders = pdfbNone;

                  PdfGridCellStyle valueStyle = new PdfGridCellStyle();
                  valueStyle.Font = font;
                  PdfBorders pdfbBot = new PdfBorders();
                  pdfbBot.Bottom = botBorder;
                  pdfbBot.Top = noPen;
                  pdfbBot.Left = noPen;
                  pdfbBot.Right = noPen;
                  valueStyle.Borders = pdfbBot;

                  PdfGrid grid = new PdfGrid();
               
                  grid.Rows.Add();
                  grid.Columns.Add(3);
                  grid.Rows.ApplyStyle(labelStyle);
                  grid.Rows[0].Cells[0].Value = "Test1";
                  grid.Rows[0].Cells[1].Value = "Test2";
                  grid.Rows[0].Cells[1].Style = valueStyle;

                  grid.Columns[0].Format = cellFRight;
                  grid.Columns[0].Width = 80;
                  grid.Columns[1].Format = cellFLeft;
                  grid.Columns[1].Width = 180;
                 
             
                  PdfLayoutResult resultg = grid.Draw(page, PointF.Empty);




George Livingston [Syncfusion]
Replied On July 3, 2012 04:52 AM

Hi Dan,

Thank you for using Syncfusion Products.

Yes, using PdfGrid to achieve your target is the recommended way.

Please let us know if you have any other questions.

Regards,
George


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;