这是我的代码.它正确地添加了我想要的图片,除了图像使用其原始分辨率外,一切正常,因此如果图像很大,则会裁剪它以适应页面.
有没有办法让图片像缩放功能一样使用拉伸以适应,还能保持宽高比?我必须在那里找到一些东西.:P
这是一张图片来说明问题:

using System;
using System.IO;
using iTextSharp.text;
using iTextSharp.text.pdf;
using System.Drawing;
using System.Collections.Generic;
namespace WinformsPlayground
{
public class PDFWrapper
{
public void CreatePDF(List<System.Drawing.Image> images)
{
if (images.Count >= 1)
{
Document document = new Document(PageSize.LETTER);
try
{
// step 2:
// we create a writer that listens to the document
// and directs a PDF-stream to a file
PdfWriter.GetInstance(document, new FileStream("Chap0101.pdf", FileMode.Create));
// step 3: we open the document
document.Open();
foreach (var image in …Run Code Online (Sandbox Code Playgroud)