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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Creating a Document or form

Thread ID:





104218 Jun 29,2012 11:18 PM UTC Jul 3,2012 08:52 AM UTC Silverlight 2
Tags: PDF
Administrator [Syncfusion]
Asked On June 29, 2012 11:18 PM UTC

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 3, 2012 12:24 AM UTC

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[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 08:52 AM UTC

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.



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.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon 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.Close Icon