简体   繁体   English

iTextSharp中的PDF大小上限

[英]PDF Size maximum limit in iTextSharp

i have encountered a problem maximum page size allowed in iTextsharp, so when i try to generate a document with size superior to 14 400 , i get an message error the.page.size.must.be.smaller.than.14400.by.14400.its.1.by.2 , i tried to play with userunits like described here , but i have not found a solution. 我遇到了iTextsharp中允许的最大页面大小问题,因此当我尝试生成尺寸大于14400的文档时,出现了消息错误the.page.size.must.be.smaller.than.14400.by.14400.its.1.by.2 ,我尝试使用userunits 所述的用户单元 ,但未找到解决方案。

i generate the PDF by merging file in one page using AddTemplate() , i think to scale the pdf dimensions by 1/4 for eg, and set userunits to 4, but i think that i should scale the imported pages too , any help in this way because i don't know how to scale imported pages, i not sure if this the right solution. 我通过使用AddTemplate()在一页中合并文件来生成PDF,我认为例如将pdf尺寸缩放1/4,并将userunits设置为4,但是我认为我也应该缩放导入的页面,在这样,因为我不知道如何缩放导入的页面,所以我不确定这是否是正确的解决方案。

 PdfImportedPage imp1 = wr.GetImportedPage(r1, 1); 
 wr.DirectContent.AddTemplate(imp1,(float)(x*cm),(float)(y*cm));

Any help please or any suggestion 任何帮助请或任何建议

As you make clear in your comment that your problem in testing your solution ( DirectContent.AddTemplate applied to a PdfImportedPage ) actually is that you don't know how to scale imported page , here a pointer to an example that shows how to do right that. 正如您在评论中明确指出的那样,测试解决方案(将DirectContent.AddTemplate应用于PdfImportedPage )的问题实际上是您不知道如何缩放导入的页面 ,这里是一个示例的指针,该示例显示了如何正确地执行此操作。 。

Have a look at the sample NUpTool.cs translated from the matching Java sample NUpTool from chapter 6 of iText in Action — 2nd Edition . 看一下从iText in Action — 2nd Edition 第6章中匹配的Java示例NUpTool转换而来的示例NUpTool.cs The variable factor here describes the scaling factor. 此处的可变factor描述了比例因子。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM