Hi!
I have an ongoing discussion on the Merger forum concerning a different aspect of this problem. What I need to do is to apply a template to an imported and modified pdf document. The imported and modified pdf document is contained in a MergedDocument object.
I do not know what template will be applied to the MergeDocument at page create time, so I cannot adapt my page sizes ahead of adding a template.
When I apply a template I thought the template would define the page size and shape, and that the existing content would just be "appended" on top of the template. This does not seem to be the case, the template is added, but the original document defines the size and shape of the resulting page, thus the template (which in this case is bigger than the original page) is clipped when drawn.
The code I use, simplified, is like this:
ImportedPageData template = new ImportedPageData(pdfDocument.Pages[pageNumber], 0, 0);
document.Template.Elements.Add(template); //document is created dynamically ahead of this operation.
The result is a document with the original page dimensions and a clipped template .. is this working as intended?
Templates
Re: Templates
Support · Mar 30, 2007Hello,
You are passing the 0,0 as XOffset and YOffset in the ImportedPageData constructor which adds the data in the center of the page. This may be the reason for the template to get cliffed off. It will be good if you pass some values for the XOffset, YOffset so that it gets added according to that position on the page.
You can also use the ImportedPageArea for which you can specify the X, Y positions as it extends from IArea interface.
Thanks,
ceTe Software Support Team.
Re: Templates
Forum member · Apr 2, 2007Changing the offsets does not seem to help, the page retains its original dimensions, and do not get the dimensions from the inserted template element, this is probably because there is no way of setting dimensions for the template.
In short:
ImportedPageData template = new ImportedPageData(pdfPage);
if (document.Template == null)
{
document.Template = new Template();
}
document.Template.Elements.Add(template);
Is there any way of setting dimensions for the template, so that it will extend to all pages in the original document? (ie. all pages get the same size as the template)?.
Currently I have found a workaround for this by using ExtendedPageDimensions, re-calculating the dimensions for each page in the original document.
Re: Templates
Support · Apr 2, 2007Hello,
The page will not get the dimensions of the template when it is added to the document. It is not possible to set the dimensions for a template.
You can readjust the dimensions of an existing PDF pages by using the ExtendedPageDimensions class only.
Thanks,
ceTe Software Support Team.