PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Thu Mar 28, 2024 8:18 pm

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 6 posts ] 
Author Message
PostPosted: Wed Aug 16, 2017 1:13 pm 
Offline

Joined: Tue Aug 15, 2017 11:27 am
Posts: 29
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?


Top
 Profile  
Reply with quote  
PostPosted: Wed Aug 16, 2017 1:59 pm 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3095
Location: Cologne, Germany
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)

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Wed Aug 23, 2017 3:02 pm 
Offline

Joined: Tue Aug 15, 2017 11:27 am
Posts: 29
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 7908 times ]
Top
 Profile  
Reply with quote  
PostPosted: Wed Aug 23, 2017 3:52 pm 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3095
Location: Cologne, Germany
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.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Fri Aug 25, 2017 2:35 pm 
Offline

Joined: Tue Aug 15, 2017 11:27 am
Posts: 29
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.


Top
 Profile  
Reply with quote  
PostPosted: Fri Aug 25, 2017 3:00 pm 
Offline
PDFsharp Expert
User avatar

Joined: Sat Mar 14, 2015 10:15 am
Posts: 909
Location: CCAA
The meaning of LineSpacing depends on the value of LineSpacingRule.

_________________
Best regards
Thomas
(Freelance Software Developer with several years of MigraDoc/PDFsharp experience)


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 146 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group