我正在尝试使用RasterImage选项加载PDF文件和Save方法来组合图像。但我收到的PDF文件无效。
另外,想要将图像放在PDF文件的底角。
任何代码段都会有很大的帮助。
由于
答案 0 :(得分:1)
这是LEADTOOLS的支持。 既然你提到过" RasterImage",我假设您正在使用我们的.NET类。
如果您的要求是将图像组合在PDF页面的下角,然后将其另存为光栅(位图)PDF,其中一种方法是使用与此类似的代码:
RasterImage pdfPage = _codecs.Load("Source.pdf");
RasterImage smallerImage = _codecs.Load("SmallImage.png");
LeadPoint combinePoint = new LeadPoint(pdfPage.Width - smallerImage.Width, pdfPage.Height - smallerImage.Height);
LeadRect destRect = new LeadRect(combinePoint, LeadSize.Create(smallerImage.Width, smallerImage.Height));
CombineCommand combine = new CombineCommand(smallerImage, destRect, LeadPoint.Create(0, 0), CombineCommandFlags.Destination0 | CombineCommandFlags.OperationAdd);
combine.Run(pdfPage);
_codecs.Save(pdfPage, "target.pdf", RasterImageFormat.RasPdfLzw, 24);
请注意,我们并不总是监控StackOverflow是否存在与LEAD相关的问题,因此,如果您对我们的工具包有技术问题,您可能需要使用我们的免费电子邮件,聊天或论坛支持服务。