PDFsharp - moved to http://forum.pdfsharp.net/ Forum Index PDFsharp - moved to http://forum.pdfsharp.net/
Please visit the new PDFsharp forum at http://forum.pdfsharp.net/
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Multiple Pages On The Fly

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    PDFsharp - moved to http://forum.pdfsharp.net/ Forum Index -> Support - moved to http://forum.pdfsharp.net/
View previous topic :: View next topic  
Author Message
enginious



Joined: 04 Nov 2007
Posts: 1

PostPosted: Sun Nov 04, 2007 9:25 pm    Post subject: Multiple Pages On The Fly Reply with quote

Hi,

Sorry if I'm asking a really basic question, but I would like to use this for generating a PDF brochure, where the number of pages is different each time it is produced.

As it's produced from a database, I just want to be able to make it automatically create Page1, Page2 etc all in one document.

However, so far I can only get it to have a static number of pages, which are designated at design time - am I missing anything obvious?

Thanks for any help you can offer.
Sparky.
Back to top
View user's profile Send private message
ACS



Joined: 01 Dec 2007
Posts: 15

PostPosted: Sat Dec 01, 2007 8:02 pm    Post subject: Reply with quote

Generating multiple pages dynamically is easy. All you need to do to add a new page is call the .AddPage() method of the PdfDocument object.

For example, let's say I have a program that uses a variable which stores the number of pages I wanna generate, called numPages.

You can then write code as follows (this is in C#):

Code:

PdfDocument doc;
PdfPage page;

doc = new PdfDocument();
for (int i = 0; i < numPages; i++)
{
  page = doc.AddPage();

  // do whatever you need to do here...
}


Now inside the for loop you can put stuff onto the "page" object.
Back to top
View user's profile Send private message
jpavez



Joined: 17 Dec 2007
Posts: 4
Location: Chile

PostPosted: Mon Dec 17, 2007 6:03 pm    Post subject: It's possible create from single page to multiple pages? Reply with quote

Hi'

For a large process diagram (in a single page) i need tranform the document with single pagen in a document with multiple pages..(sorry my english, i speak spanish...)

Regards, Josť.
_________________
Salu2, JPavez
Back to top
View user's profile Send private message Send e-mail
ACS



Joined: 01 Dec 2007
Posts: 15

PostPosted: Wed Dec 19, 2007 12:31 am    Post subject: Reply with quote

Hi jpavez,

Are you saying that you have a diagram that can't fit onto one page, so you want to spread it across multiple pages?
Back to top
View user's profile Send private message
Vyacheslav Popov



Joined: 23 Nov 2007
Posts: 18

PostPosted: Wed Dec 19, 2007 8:45 am    Post subject: Reply with quote

You have insert a number page using: AddPageField()

example:
Code:

        public static void WriteNumberPagina(Document document, PositionNumber position, Color color)
        {
            Paragraph paragraph;
            FormattedText formattedText;
            TextFrame textFrame;

            textFrame = document.LastSection.AddTextFrame();
            textFrame.RelativeVertical = RelativeVertical.Page;
            textFrame.RelativeHorizontal = RelativeHorizontal.Page;
            textFrame.Width = "20mm";
            textFrame.Top = document.DefaultPageSetup.PageHeight - Unit.FromMillimeter(10);
            if (posicion == PositionNumber.Left)
                textFrame.Left = Unit.FromMillimeter(7);
            else
                textFrame.Left = document.DefaultPageSetup.PageWidth - textFrame.Width - Unit.FromMillimeter(2);
            paragraph = textFrame.AddParagraph();
            formattedText = paragraph.AddFormattedText("Pag. ");
            formattedText.Font.Size = 9;
            formattedText.Font.Bold = true;
            formattedText.Color = color;
            formattedText = paragraph.AddFormattedText();
            formattedText.AddPageField();
            formattedText.Font.Size = 16;
            formattedText.Font.Bold = true;
            formattedText.Color = color;
        }
Back to top
View user's profile Send private message Visit poster's website
jpavez



Joined: 17 Dec 2007
Posts: 4
Location: Chile

PostPosted: Thu Dec 20, 2007 4:02 am    Post subject: Reply with quote

Hi' ACS:

I Have a diagram that "can" fit onto one page, but i want spread it across multiple pages using c# code...

I am generating BPMN Diagram and Database Model in PDF in one page, having that, i need spread it across multiple pages...

BPMN Diagrams y DataBase model can be very large and i need print in A4 or 8.5x11" Letter.

It's possible?

Regards, Josť
(from Chile)
_________________
Salu2, JPavez
Back to top
View user's profile Send private message Send e-mail
jpavez



Joined: 17 Dec 2007
Posts: 4
Location: Chile

PostPosted: Thu Dec 20, 2007 4:03 am    Post subject: Reply with quote

PD: The diagram generate it on the fly, over Web.
_________________
Salu2, JPavez
Back to top
View user's profile Send private message Send e-mail
ACS



Joined: 01 Dec 2007
Posts: 15

PostPosted: Mon Dec 24, 2007 4:47 am    Post subject: Reply with quote

Hi jpavez,

If you want your diagram spread across multiple pages, what you'll need to do is generate the diagram on each separate page, but offset.

For example, let's say for the sake of simplicity you want half the diagram rendered on one page, and the other half rendered on the other.

What you wanna do is render the full diagram on page 1, but with an offset, so part of it will be offpage. The offpage part obviously won't be rendered.
Then insert your second page, and render the same diagram on the page, but offset in the OTHER direction.
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    PDFsharp - moved to http://forum.pdfsharp.net/ Forum Index -> Support - moved to http://forum.pdfsharp.net/ All times are GMT
Page 1 of 1

 
Jump to:  
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 vote in polls in this forum


Powered by phpBB © phpBB Group. Hosted by phpBB.BizHat.com


Start Your Own YouTube Clone

Free Web Hosting | Free Forum Hosting | FlashWebHost.com | Image Hosting | Photo Gallery | FreeMarriage.com

Powered by PhpBBweb.com, setup your forum now!
For Support, visit Forums.BizHat.com