Centering an pdfimportedpage in iTextSharp

你离开我真会死。 提交于 2019-12-03 20:29:21

Can you set the x-coordinate when you call AddTemplate?

Float offset = 0;
if(importedPage.width < iTextDocument.PageSize.Width) {
   offset = (iTextDocument.PageSize.Width - importedPage.width)/2;
}
pdfContentByte.AddTemplate(importedPage, offset, 0);

Or does it do the scaling in AddTemplate so you don't know the final width?

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!