【发布时间】:2017-08-16 12:28:29
【问题描述】:
我正在尝试将图像文件转换为具有已定义页面大小(字母大小)的 PDF 文档。
当前我可以在不定义任何页面尺寸的情况下将图像转换为 PDF 文档(PDF 的默认尺寸是图像大小)。我想在创建文档时定义页面尺寸,并将图像放在该页面上(可能带有边距)。
以下代码 sn-p 显示了我当前如何在不为页面设置任何尺寸的情况下将图像文件转换为 PDF 文档:
async static Task<bool> ConvertImageToPDF(TestFile file)
{
pdftron.PDF.PDFDoc pdfdoc = new PDFDoc(); //Initialize a new PDF document
pdftron.PDF.Convert.ToPdf(pdfdoc, file.InputFile); //Use the Convert.ToPdf to generate the file from the image file
await pdfdoc.SaveAsync(file.OutputFile, SDFDocSaveOptions.e_linearized); //Save the PDF document generated from the conversion
pdfdoc.Destroy();
pdfdoc = null;
}
任何有关为 PDF 页面分配尺寸(字母大小)以及在该页面中插入图像文件的帮助或指导都非常受欢迎。
【问题讨论】:
标签: c# image pdf pdftron pdfnet