PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Sat Sep 07, 2024 11:17 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
 Post subject: Get Current Page Number
PostPosted: Wed Apr 17, 2013 8:10 am 
Offline

Joined: Wed Apr 17, 2013 8:02 am
Posts: 4
Hi,

I am making a PDF product list, which has got an index of all the products and their quick find page numbers at the end. My Problem is I cannt use Paragraph.AddPageField(), and I can't find a way to store this value in an array or a list. All the Products in the Index will be sorted by the Product Code and I have show their page numbers, hence I need the page number where I lay it out.

Also I am not able to use the GetValue method of the PageField, as I can't find the documentation on this API.

Any Help in this issue will be much appreciated.

Cheers.


Top
 Profile  
Reply with quote  
PostPosted: Wed Apr 17, 2013 8:32 am 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3109
Location: Cologne, Germany
Hi!

With MigraDoc you define the contents of a document. No page numbers exist at this stage.

When you render a document (e.g. as PDF), it gets rendered to pages. Therefore you have to use fields to show page numbers - either on the page or in references.

dinesh_sp wrote:
My Problem is I cannt use Paragraph.AddPageField()
My problem is you have to be more specific or I cannot help you. Why can't you use it? What have you tried?

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Wed Apr 17, 2013 9:37 am 
Offline

Joined: Wed Apr 17, 2013 8:02 am
Posts: 4
Hi Thomas,

Thanks for your prompt reply. This is what I am trying to achieve.

I have a list of products, that are grouped by category, and I am able to display that on PDF successfully. At the end, when all products have been displayed, I show an index of products, which has Product Code and the Page on which it is found.
Ex.
Product Page Number
AAA 10
BBB 2
CCC 1.

This list is sorted by Products, but the table which shows the product details is sorted by category.
Now when I am writing the Prouduct AAA, I want to store the Page number 10 in an array to be displayed in this index, however, I am not having much luck using the AddPageField. I cant use a paragraph becuase the Index will be sorted by Product Code and I am looping products which are not sorted by product code.

hence while laying out products in a loop, I want some way to find which page this product will be displayed

Please suggest a way.

kind Regards,


Top
 Profile  
Reply with quote  
PostPosted: Wed Apr 17, 2013 11:22 am 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3109
Location: Cologne, Germany
See this sample:
http://www.pdfsharp.net/wiki/HelloMigraDoc-sample.ashx

Search for "Paragraphs" (including quotes) and see how it is used with AddBookmark(), AddPageRefField(), and AddHyperlink().
You need a unique string for each product (will not be displayed). Your PDF will have entries that are linked to the product page (do not use AddHyperlink if you do not want that).

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Thu Apr 18, 2013 7:31 am 
Offline

Joined: Wed Apr 17, 2013 8:02 am
Posts: 4
Hi Thomas,

I have made fair bit of progress in doing the Indexing. What I have found is bookmarks are not working correctly if placed inside of a table cell ?? It there some kind of limitation that bookmarks wouldnt work in a table cell ??

Basically I have a table with 3 columns, if I want to put a bookmark, I merge 3 columns, and put a bookmark and display the headig in a paragraph. For some reason, all my bookmarks go to page 1 for some strange reason.

I also want to bookmark all products in the list, and display them in a table, would migradoc support bookmarking a product in a table cell and showing in the Table of Contents as an index ??

Thanks in Advance.


Top
 Profile  
Reply with quote  
PostPosted: Wed May 01, 2013 12:08 am 
Offline

Joined: Wed Apr 17, 2013 8:02 am
Posts: 4
I got around to my problem of bookmarking by create separate table for each row and the indexing worked.

Thanks for you help.


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: No registered users and 29 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:  
cron
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group