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 

Copy / Duplicate page for multiple page document

 
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
joshgerdes



Joined: 05 Feb 2009
Posts: 4

PostPosted: Thu Feb 05, 2009 10:22 pm    Post subject: Copy / Duplicate page for multiple page document Reply with quote

I am trying to create a document with multiple pages.
Each page has the same basic template with the only thing changing
between each page is small portion of text (for an address).

I was able to generate the initial page but I am having trouble
figuring out how to just duplicate that page with the base
content without having to generate the whole page.

Does anybody have any suggestions?

Thanks in advance.
Back to top
View user's profile Send private message
Thomas Hoevel



Joined: 16 Oct 2006
Posts: 387
Location: Cologne, Germany

PostPosted: Mon Feb 09, 2009 11:17 am    Post subject: Reply with quote

I'd try calling "Clone()" for that page.
_________________
Regards
Thomas Hoevel
PDFsharp Team
Back to top
View user's profile Send private message Visit poster's website
joshgerdes



Joined: 05 Feb 2009
Posts: 4

PostPosted: Mon Feb 09, 2009 4:06 pm    Post subject: Reply with quote

The clone method returns a pdfdictionary and not a pdfpage.
So if you could let me know how to convert a pdfdictionary to a pdfpage then I think it would work.
Back to top
View user's profile Send private message
Thomas Hoevel



Joined: 16 Oct 2006
Posts: 387
Location: Cologne, Germany

PostPosted: Mon Feb 09, 2009 4:32 pm    Post subject: Reply with quote

In C#:
Code:
PdfPage clone = (PdfPage)page.Clone();

_________________
Regards
Thomas Hoevel
PDFsharp Team
Back to top
View user's profile Send private message Visit poster's website
joshgerdes



Joined: 05 Feb 2009
Posts: 4

PostPosted: Mon Feb 09, 2009 5:32 pm    Post subject: Reply with quote

Thanks. I did not know you could cast a pdfdictionary as a pdfpage.

I still have a problem though.
Even though I have a clone of the page it does not act as a separate object.
So when I add items to the original page it shows up on both pages.

I feel like I'm missing something simple here.

Any thoughts?
Back to top
View user's profile Send private message
Thomas Hoevel



Joined: 16 Oct 2006
Posts: 387
Location: Cologne, Germany

PostPosted: Tue Feb 10, 2009 9:12 am    Post subject: Reply with quote

I thought that Clone() would give you a deep copy.
Maybe there's just a little thing missing ...

Different approach:
Create a PDF document with your template.
Create it in a memory stream (see WebSamples / Clock how to do it).

Then create an XPdfForm from that stream.
Draw this on every page of your final document and add the address later.

You have 10 or 15 lines of code instead of a simple Clone(), but it should work.
We do a similar thing all the time: we use a page from a PDF file as stationary for other documents. I also did it when I needed a letter with 1600 different addresses.

But there may be more efficient solutions.
_________________
Regards
Thomas Hoevel
PDFsharp Team
Back to top
View user's profile Send private message Visit poster's website
joshgerdes



Joined: 05 Feb 2009
Posts: 4

PostPosted: Wed Feb 18, 2009 7:53 pm    Post subject: Reply with quote

Thomas,

Thanks for the reply and idea for the different approach.

Do you think you could provide some sample code?

I tried the approach you suggested but I seem to be getting some errors
with the stream as it relates to the form.
I thought it would be more effective if just asked you for an example then
try and track down a working solution elsewhere.

Anything you can provide would be helpful.

Thanks in advance.
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