Hello,
i've got an existing PDF document with varying page orientations (landscape,portrait). Is it possible to transfer the content into another new PDF document with the same page orientations to resize and stam it there?
Regards
HF
Scale and Stamp PDF
Re: Scale and Stamp PDF
Support · Dec 14, 2005Hello HF,
Yes, you can take an existing PDF document, scale it and stamp it without any problem. You will need to use ImportedPageData object to bring in the PDF document and resize them using the ScaleX and ScaleY properties of the ImportedPageData object. Take a look at the StampPDF example on our web site which shows how to stamp an existing PDF document. Click here
to go to the examples page.
Thanks,
ceTe Software Support Team
Re: Scale and Stamp PDF
Forum member · Dec 16, 2005Thank you for the quick reply, but unfortunately I still got the problem that I loose the pageorientation of the original page. That means I take the pagedata-Object, scale it and add it to my newly generated page (Page test = new Page()). The resulting document contains the scaled page but in the wrong orientation. What's my error?
Regards
HF
Re: Scale and Stamp PDF
Support · Dec 16, 2005Hello HF,
We suspect the behavior you are seeing has something to do with the rotate property on the original PDF. Can you please send us the original PDF and the final output PDF at [^a|mailto:support@cete.com|support^] so that we can reconfirm it and post the work around?
Thanks,
ceTe Software Support Team
Re: Scale and Stamp PDF
Forum member · Feb 24, 2006I am having a similar problem. I have two Landscape PDF files that I am trying to merge. Basically I am creating a new page with the following:
Page page = new Page(PageSize.Letter, PageOrientation.Landscape);
Then importing the data from a source:
page.Elements.Add(new ImportedPageData(pdfSrc1.GetPage(1)));
And then adding to a PdfDocument:
document.Pages.Add(page);
The resulting document comes out as Portrait with the right-hand-side cut off.
How else can this be accomplished?
Thank you.
Re: Scale and Stamp PDF
Support · Feb 24, 2006Hello,
We suspect the behavior you are seeing has something to do with the rotate property on the original PDF. Can you please send us the original PDF and the final output PDF at [^a|mailto:support@cete.com|support^] so that we can reconfirm it and post the work around?
Thanks,
ceTe Software Support Team
Re: Scale and Stamp PDF
Support · Feb 27, 2006Hello,
As we suspected, the pages had the rotate property which was causing the problem. Following is the code snippet that will work for you and allow you to merge existing PDF without changing the orientation.
ImportedPageData data = null;
Page page = null;
MergeDocument document = new MergeDocument( );
PdfDocument pdfDocument = new PdfDocument( @"C:\Temp\Test.pdf" );
PdfPageList pageList = pdfDocument.Pages;
for(int i = 0; i < pageList.Count; i++)
{
PdfPage page1 = pageList[i];
data = new ImportedPageData( page1 );
if((page1.Rotate + 360) % 180 == 90)
{
page = new Page( page1.GetDimensions().Height, page1.GetDimensions().Width );
}
else
{
page = new Page( page1.GetDimensions().Width, page1.GetDimensions().Height );
}
data.Angle = page1.Rotate;
page.Elements.Add(data);
document.Pages.Add(page);
}
document.Draw( @"C:\Temp\ImportedPageTest.pdf" );
Thanks,
ceTe Software Support Team