I'm having an issue while appending a generator document to a merger document. When I append the generator doc, I lose the template that was defined within it. If I just call .DrawToWeb on the generator doc without appending it to the other one first, then the template shows up as it should.
Not sure if I'm going about this the right way or not: The generator document is a class that inherits from the ceTe.DynamicPDF.Document class and is applying the template to itself within the constructor.
This method displays the template:
MyInheritedGeneratorDoc.DrawToWeb(ThisWebPage)
This method appends fine, but the template items are missing:
MyMergerDoc.Append(MyInheritedGeneratorDoc)
MyMergerDoc.DrawToWeb(ThisWebPage)
Any advice is appreciated.
Losing Template on .Append
Re: Losing Template on .Append
Support · Nov 16, 2006The reason you are getting the behavior as you described is because the Append method you are calling on the MergeDocument is basically just taking the Pages from the original Document object (MyInheritedGeneratorDoc) and adding them to the Page collection in the MergeDocument (MyMergerDoc). Since the Template on the original document is a Document level attribute and only the Pages are getting appended the Template on that original Document does not remain part of those pages.
In general the way you are doing this is not recommended. You should be doing this without using the MergeDocument.Append method (in fact in version 4.0 the MergeDocument.Append( ceTe.DynamicPDF.Document ) has been depreciated). In your case you will want to add the template that you originally had on the Document object as a section template to the MergeDocument. Then you can add the pages from your original Document object to your MergeDocument.object. Then the template would still appear on those added pages as you desired.
It almost sounds like you need not use a Document object at all. Like you could be doing everything directly in the MergeDocument object. First create you MergeDocument with whatever you are merging, then add any section template and create and add your new pages to the MergeDocument, then draw out the MergeDocument.
Thanks,
ceTe Software Support Team
Re: Losing Template on .Append
Forum member · Nov 16, 2006Thanks for your quick reply!
I'll try the method you suggested and see if I can do this without the Generator document altogether. The last few pages that I'm trying to append to the original document are dynamic and data-driven, so that's why I started with a Generator document for those. The prospect of doing all of this within the MergeDocument functionality is definitely more appealing though.
If I continue to have problems, I'll post again.