PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Sun Apr 28, 2024 1:25 am

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Sat Jul 25, 2009 9:21 pm 
Offline

Joined: Sat Jul 25, 2009 9:11 pm
Posts: 4
Hi. Really impressed with PDFSharp and have managed to get it to do what I want (merging pdf files together) but I can't figure out how to work with MigraDoc to number pages. I am using VB.Net

I found the code to number pages at viewtopic.php?p=1712#p1712

Code:
Dim style As Style
        pdfDocument = New Document()
       
        [.......]

        Dim section As Section
        Dim r As Row
        Dim c As Column

        section = pdfDocument.AddSection()

        [...........]

        'Aggiungo il numero di pagina in basso a destra
        p = New Paragraph()
        p.AddText("Pag. ")
        p.AddPageField()
        p.AddText(" di ")
        p.AddNumPagesField()
        p.Format.Alignment = ParagraphAlignment.Right
        section.Footers.Primary.Add(p)


And I want to number pages on an existing PDF.

I have:

Code:
For Each page As PdfPage In readDocument.Pages
        document.AddPage(page)
Next page


and I'd like to number each page in that For/Next routine. How do I pass the page to MigraDoc and number it?

Thanks.


Top
 Profile  
Reply with quote  
PostPosted: Mon Jul 27, 2009 9:11 am 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3096
Location: Cologne, Germany
MigraDoc can only create new PDF documents.

The TwoPagesOnOne sample shows how to add page numbers (using PDFsharp).

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Mon Jul 27, 2009 10:03 am 
Offline

Joined: Sat Jul 25, 2009 9:11 pm
Posts: 4
Thanks for the reply.

Yes, have found out how to do it using DrawString and it works!


Top
 Profile  
Reply with quote  
PostPosted: Tue Jul 28, 2009 1:19 pm 
Offline

Joined: Sat Jul 25, 2009 9:11 pm
Posts: 4
I was also wondering if it is possible to set the page number property of a page within a PDF document?

Not adding the physical text (have done that and it works perfectly) but the number of the page as used to navigate the PDF document?

With Acrobat, you can use the 'Number Pages' option. Specifically, I want the first few pages to be numbered i,ii, iii, etc and then the rest to be 1 to whatever so that the page numbers recognized in Adobe Reader match the physical pages numbers. Basically so somebody can use Adobe Reader to jump to page 1 even if it is physically the fourth page of the PDF document e.g., Acrobat shows "1 (4 of 168)" in its page navigation tab.

Thanks, and again PDFSharp is really impressive. Well done!


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

All times are UTC


Who is online

Users browsing this forum: No registered users and 224 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