PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Sat Apr 27, 2024 5:03 pm

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: PDF sharp Code
PostPosted: Mon Jan 22, 2024 9:09 am 
Offline

Joined: Mon Jan 22, 2024 7:47 am
Posts: 2
I have a word document that is a contract. I wish to create a same document but it should be in PDF using PDF sharp or MigraDoc. In this document, I want to be bale to fill in the spaces with data from the database them print it in pdf. I have attached the word document.

This is what I have currently done:

string employerDay = txtEmployerDay.Text;
string employerMonth = txtEmployerMonth.Text;
string employerYear = txtEmployerYear.Text;
string employerPlace = txtEmployerPlace.Text;
string employerName = txtEmployerName.Text;
string employerSurname = txtEmployerSurname.Text;
//Get Days, Months and Years Assignee
string assigneeDay = txtAssigneeDay.Text;
string assigneeMonth = txtAssigneeMonth.Text;
string assigneeYear = txtAssigneeYear.Text;
string assigneePlace = txtAssignerPlace.Text;
string assigneeName = txtAssigneeName.Text;
string assgnerrSurname = txtAssigneeSurname.Text;
string nameAndSurname = txtNameSurname.Text;
string identityNumber = txtIdentityNo.Text;

// Create a new document
Document document = new Document();

// Add sections to the document
Section section = document.AddSection();

// Add a header to the section
HeaderFooter header = section.Headers.Primary;
Paragraph headerParagraph = header.AddParagraph();
headerParagraph.AddText("FIXED TERM CONTRACT");

section.AddParagraph();

// Create a paragraph above the table with specified style
Paragraph headingParagraph = section.AddParagraph();
headingParagraph.Format.LeftIndent = "14.2pt";
headingParagraph.Format.FirstLineIndent = "-14.2pt";
headingParagraph.Format.Alignment = ParagraphAlignment.Justify;
headingParagraph.Format.Font.Size = 6.5;
headingParagraph.Format.Font.Bold = true;
headingParagraph.Format.LineSpacing = 0;


Please assist


Top
 Profile  
Reply with quote  
 Post subject: Re: PDF sharp Code
PostPosted: Tue Jan 23, 2024 8:35 am 
Offline
PDFsharp Expert
User avatar

Joined: Sat Mar 14, 2015 10:15 am
Posts: 916
Location: CCAA
siyakubeka wrote:
I have attached the word document.
Have you? Never mind, makes no difference.

The line "section.AddParagraph();" is a good start. Add more text this way.

See also:
https://pdfsharp.net/wiki/HelloMigraDoc-sample.ashx
https://pdfsharp.net/wiki/Invoice-sample.ashx

_________________
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  [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 414 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