0
我试图自动填充pdf表单,但它不会让我画pdf。所以我创建了一个窗体的图像,并使用drawstring方法填充它。问题是,即使打印审阅在我尝试打印时正确显示文档,我也会得到比纸张大小更大的放大文档。我无法想象为什么。 这里是我的代码:c中的printpreview图像#
private void buttonPrint_Click(object sender, EventArgs e)
{
Image img = panelForm.BackgroundImage;
printDocumentForm.DefaultPageSettings.PaperSize = new PaperSize("A4", img.Width, img.Height);
printPreviewForm.Document = printDocumentForm;
printPreviewForm.ShowDialog();
}
private void printDocumentForm_PrintPage(object sender, PrintPageEventArgs e)
{
Image img = panelForm.BackgroundImage;
Image copy = (Image) img.Clone();
// I've added some drawstring methods here to fill the blanks
// but I removed them in this example to save some space
e.Graphics.DrawImage(copy, new Point(0, 0));
}
预览窗口显示填补空白正确的文档。但是当我在预览窗口上按下打印按钮时,我会看到放大的文档... 编辑:我应该补充一点,当我用Paint打开.bmp文件时,我可以正确打印图像。没有任何明显的原因,相同的图像在我的项目中显得更大,更模糊。打印机为什么拉伸我的图像?为什么预览窗口显示正确的图像大小?