PDFsharp & MigraDoc Foundation
https://forum.pdfsharp.net/

Text box sizes in document
https://forum.pdfsharp.net/viewtopic.php?f=2&t=3641
Page 1 of 1

Author:  pistoletov [ Wed Aug 16, 2017 1:13 pm ]
Post subject:  Text box sizes in document

Hi!
I need to make output invoice in my project with accurate sizes text fields, borders. The output document must be exact cope of original paper document. I plan to scan original image and measure sizes in graphical editor and program document in vs c# using migradoc or pdf sharp?
Output document have 1 or 2 pages. What is the best units to do this? Santimeters or dots? What is the acuracy if i use santimeters. Does this librarys support 2 numbers after point or may be more?

Author:  Thomas Hoevel [ Wed Aug 16, 2017 1:59 pm ]
Post subject:  Re: Text box sizes in document

Hi!
pistoletov wrote:
What is the best units to do this? Santimeters or dots? What is the acuracy if i use santimeters. Does this librarys support 2 numbers after point or may be more?
There are no dots. All units are internally mapped to points. Values are float or double, so you can have several decimal digits.
Points are not dots, you can use fractions of points as needed. You can draw lines that are 0.25 points wide ...
See also:
viewtopic.php?p=8678#p8678
https://en.wikipedia.org/wiki/Point_(typography)

Author:  pistoletov [ Wed Aug 23, 2017 3:02 pm ]
Post subject:  Re: Text box sizes in document

thank you.
I just try to make my doc in migradoc.
I have a some questions about position elements on doc.
First i add section to a4 page without margins
Section section = this.document.AddSection();
section.PageSetup.LeftMargin = "0pt";
section.PageSetup.TopMargin = "0pt";
section.PageSetup.PageHeight = "755pt";
section.PageSetup.PageWidth = "525pt";
and than add textframes: textbox1 with paragraph1 inside and textbox2 with parargraph2 inside
how can i set exactly position of this elements?
textbox1:
this.fieldsOwners = section.AddTextFrame();
this.fieldsOwners.Height = "20pt";
this.fieldsOwners.Width = "150pt";
this.fieldsOwners.Left = "0pt";
this.fieldsOwners.Top = "0pt";

textbox2: this.nakl = section.AddTextFrame();
this.nakl.Height = "10pt";
this.nakl.Width = "95pt";
this.nakl.Left = "227pt";
this.nakl.Top = "0pt";

this sizes i take from photoshop editor (in points)
but on print document positions does not match with scanned documents.
Where i can find some detailed documentation about positions elements on document with properties descriptions?
How to set margins and coordinates of elements? Does coordinates used absolute or relative ?
Does it possible to make one textframe inside another textframe (on image third box "fieldname")?

Attachments:
doc.jpg
doc.jpg [ 26.64 KiB | Viewed 7915 times ]

Author:  Thomas Hoevel [ Wed Aug 23, 2017 3:52 pm ]
Post subject:  Re: Text box sizes in document

Hi!
pistoletov wrote:
First i add section to a4 page without margins
If you do not set margins to 0, the document will inherit the default margins. A4 is the default size.

You can set positions relative to page, to margin, to paragraph, ...
Code:
    var tf = section.AddTextFrame();
    tf.Width = "190mm";
    tf.RelativeVertical = RelativeVertical.Page;
    tf.Top = ShapePosition.Top;
    tf.MarginTop = "230mm";
Code from here: viewtopic.php?p=8936#p8936

You can have two textframes (a small one and a large one) at the same position. I don't know if you can have a textframe in a textframe - try it.

Search this forum for occurrences of "AddTextFrame", "RelativeVertical" or "RelativeHorizontal". I'm afraid there is no reference documentation about TextFrame positioning beyond IntelliSense in Visual Studio.

Author:  pistoletov [ Fri Aug 25, 2017 2:35 pm ]
Post subject:  Re: Text box sizes in document

Thank you.
It will be awesome to make a simple scheme with description of attributes like a http://vanseodesign.com/css/css-positioning/.

if i set top and left attributes this is coordinates of left top corner of textframe?
how i can set space between textlines?
i try paragraph.Format.LineSpacing = 16; or paragraph.Format.LineSpacing = "5mm";
- but no effect.

Author:  TH-Soft [ Fri Aug 25, 2017 3:00 pm ]
Post subject:  Re: Text box sizes in document

The meaning of LineSpacing depends on the value of LineSpacingRule.

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/