PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Tue Jul 02, 2024 3:13 pm

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 10 posts ] 
Author Message
PostPosted: Thu Apr 15, 2010 5:32 pm 
Offline

Joined: Thu Apr 15, 2010 5:29 pm
Posts: 2
Hi,

Im creating a Invoice witch can have one or more pages, I want to display the total at the bottom of the las page. Any ideas?

Thanks,
Alejandro


Top
 Profile  
Reply with quote  
PostPosted: Mon Apr 19, 2010 7:21 am 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3101
Location: Cologne, Germany
Hi!
Use a TextFrame. The TextFrame will be on the "current" page (i. e. last page) and can have an absolute position.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Wed Apr 21, 2010 8:56 pm 
Offline

Joined: Wed Apr 21, 2010 6:31 pm
Posts: 3
Thomas Hoevel wrote:
Hi!
Use a TextFrame. The TextFrame will be on the "current" page (i. e. last page) and can have an absolute position.


Hi,
I am interseted in same ability too, byt because I am new with your program, I do not know where can I find it, could you please do me a favor and give me more information (where is it or do you have a sampe code for it)?
Thank you in advance for your time
Alex


Top
 Profile  
Reply with quote  
PostPosted: Thu Apr 22, 2010 7:59 am 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3101
Location: Cologne, Germany
AlexB wrote:
I do not know where can I find it

Use the methods called "AddTextFrame". Four classes implement AddTextFrame.
Simply type "AddTextFrame" into the index search of the VS documentation (after installing the PDFsharp help files) or search this forum for "AddTextFrame".

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Thu Apr 22, 2010 2:35 pm 
Offline

Joined: Thu Apr 15, 2010 5:29 pm
Posts: 2
I actually never find out how to set the absolute position, I found out that textFrame only has top and left properties. I would appreciate if someone could give me an example


Top
 Profile  
Reply with quote  
PostPosted: Mon Apr 26, 2010 7:41 am 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3101
Location: Cologne, Germany
alejandr0 wrote:
I found out that textFrame only has top and left properties

Maybe the names should be vertical and horizontal (instead of top and left).

Here's an example for a right-aligned textframe:
Code:
TextFrame tf = footer.AddTextFrame();
tf.RelativeHorizontal = RelativeHorizontal.Page;
tf.RelativeVertical = RelativeVertical.Paragraph;
tf.Left = ShapePosition.Right;
tf.WrapFormat.Style = WrapStyle.Through;
tf.Width = Unit.FromMillimeter(36);
tf.Height = Unit.FromPoint(12 + 2);

You can also set tf.Top to ShapePosition.Bottom for a bottom-aligned textframe.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Sun May 09, 2010 4:26 pm 
Offline

Joined: Sun May 09, 2010 4:03 pm
Posts: 3
Hi,
I have same problem and because I am new in C#, I did not understand your instruction, Actually I solved my problem with a silly method. I run my report first and count the actual pages = Z and re-run the report and use Z in second time report.
Could you please help me how can I use "TextFrame".

Thank you in advance
Robert


Top
 Profile  
Reply with quote  
PostPosted: Mon May 10, 2010 12:25 pm 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3101
Location: Cologne, Germany
RobertB wrote:
I have same problem and because I am new in C#, I did not understand your instruction, Actually I solved my problem with a silly method. I run my report first and count the actual pages = Z and re-run the report and use Z in second time report.

With MigraDoc you can use
Code:
paragraph.AddNumPagesField();

to display the number of pages in a document (MigraDoc does the counting for you).

RobertB wrote:
Could you please help me how can I use "TextFrame".

I'm not sure if I understand that question.
Simply call "AddTextFrame()" to get a new textframe, then set its properties.
AddTextFrame is supported by e. g. Section, HeaderFooter, and Cell.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Mon May 10, 2010 8:02 pm 
Offline

Joined: Sun May 09, 2010 4:03 pm
Posts: 3
Hi,
Thank you so much for your reply, let me describe my problem,
Suppose that I am going to create a PDF report,
how many page is it? I do not know, but I do need to have page X of Y in my all report's pages, and because I can not go back to the previous pages to write "Page: X of Y", when generating report finished,
I just create a report twice, at first time I generate the report to count number of the pages, with a temp name, then delete report from the my hard disk and again generate the same report, but in second time I do have number of pages (here is Y) and I can write it in my each page. (I know what X is in each page)
I hope, I made it clearly.
of course it takes time to create a report with your program but it is fantastic, because I can control on eveything and I do not depend on any external sotware and its setting up in other computers.
I have recommended it to most of my friends.
by the way if my litreture is not polite, I apologize because English is my second language.
Thank you and good luck
Robert


Top
 Profile  
Reply with quote  
PostPosted: Tue May 11, 2010 7:22 am 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3101
Location: Cologne, Germany
Hi!
RobertB wrote:
but I do need to have page X of Y in my all report's pages, and because I can not go back to the previous pages to write "Page: X of Y", when generating report finished, [...]

With MigraDoc you use "paragraph.AddNumPagesField();" instead of "Y" and "paragraph.AddPageField();" instead of "X" and MigraDoc does the counting.
And even better: you can add this code once to the page footer (or header) and MigraDoc will repeat it automatically on every page (until a new section with a different header/footer starts).

With PDFsharp, you can keep all pages in an array - and when the document is done you can add "page X of Y" before saving the document.

_________________
Regards
Thomas Hoevel
PDFsharp Team


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

All times are UTC


Who is online

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