ResizeContentsPct

ResizeContentsPct(string, string, int[], double, double)

调整文档页面内容的大小。 缩小页面内容并添加边距。 以百分比指定新内容大小。

public bool ResizeContentsPct(string source, string destination, int[] pages, double newWidth, 
    double newHeight)
范围类型描述
sourceString源文档的路径。
destinationString将保存结果文档的路径。
pagesInt32[]页面索引数组。如果为 null,则将处理所有文档页面。
newWidthDouble页面内容的新宽度(以百分比为单位)。
newHeightDouble以百分比为单位的页面内容的新高度。

返回值

如果调整大小成功,则为 true。

例子

PdfFileEditor fileEditor = new PdfFileEditor();
fileEditor.ResizePct("input.pdf", "output.pdf",
//调整文档所有页面的大小
null, 
//新内容宽度 = 初始大小的 60%
60, 
//新内容高度 = 初始大小的 60%
60);
// 页面的剩余区域为空(页边距)。左右边距大小为 (100% - 60%) / 2 = 20%
// 上边距和下边距相同。

也可以看看


ResizeContentsPct(Stream, Stream, int[], double, double)

调整文档页面内容的大小。 缩小页面内容并添加边距。 以百分比指定新内容大小。

public bool ResizeContentsPct(Stream source, Stream destination, int[] pages, double newWidth, 
    double newHeight)
范围类型描述
sourceStream包含源文档的流。
destinationStream将保存结果文档的流。
pagesInt32[]页面索引数组。如果为 null,则将处理所有文档页面。
newWidthDouble页面内容的新宽度(以百分比为单位)。
newHeightDouble以百分比为单位的页面内容的新高度。

返回值

如果成功调整大小,则为 true。

例子

PdfFileEditor fileEditor = new PdfFileEditor();
Stream src = new Stream("input.pdf", FileMode.Open);
Stream dest = new Stream("output.pdf", FileMode.Create);
fileEditor.ResizePct(src, dest, 
//调整文档所有页面的大小
null, 
//新内容宽度 = 初始大小的 60%
60, 
//新内容高度 = 初始大小的 60%
60);
// 页面的剩余区域为空(页边距)。左右边距大小为 (100% - 60%) / 2 = 20%
// 上边距和下边距相同。

也可以看看