我使用PDFsharp(v1.32)合并多个PDF文件.我使用以下代码打开文档:
PdfDocument inputDocument = PdfReader.Open(pdfFilePath, PdfDocumentOpenMode.Import);
Run Code Online (Sandbox Code Playgroud)
在打开一个文档(PDF版本1.5(Acrobat 6.x))时,我收到一个例外:
PdfSharp.dll中发生未处理的"PdfSharp.Pdf.IO.PdfReaderException"类型的异常附加信息:无法处理iref流.PDFsharp的当前实现无法处理Acrobat 6中引入的此PDF功能.
我该怎么办?我需要合并所有文件,我不能跳过它.我试图找到解决方案,但发现没有回答,或者只是来自PDFsharp团队的非常老的反馈意见,他们将"修复它".
我注意到ReSharper建议我检查是否Console.ReadLine()为null.我不明白为什么,因为据我所知,""即使您按下enter控制台并且没有输入任何符号,该方法也会返回.
我使用VS 2015与第3次更新,C#6,.NET 4.6.1,ReSharper 10.
我熟悉QUOTENAME功能.但我不明白我能用什么呢?为什么这么广泛使用?
select quotename('[abc]') -- '[[abc]]]'
select quotename('abc') -- '[abc]'
select '[' + 'abc' +']' -- why it is not so good as previous?
Run Code Online (Sandbox Code Playgroud) 我之前使用 PDFsharp 进行了一些文件合并,现在我正在尝试更改多个文件(插入或删除一些页面),但我遇到了问题,即库看不到页面。它说 PageCount == 0 并且我在对象中找不到页面(在调试时)。当然,我不能做我现在的工作。我使用这个非常简单的代码:
var destinationPdf = new PdfDocument(destinationFilePath);
Int32 count = destinationPdf.PageCount;
Run Code Online (Sandbox Code Playgroud)
而且,这是我以前用来将文件合并为一个 PDF 的代码:
public class PdfCreator
{
private PdfDocument document;
public PdfCreator()
{
this.document = new PdfDocument();
}
public void AddImage(String imageFilePath)
{
PdfPage newPage = this.document.AddPage();
XGraphics xGraphics = XGraphics.FromPdfPage(newPage);
XImage image = XImage.FromFile(imageFilePath);
xGraphics.DrawImage(image, 0, 0);
}
public void AddPdfFile(String pdfFilePath)
{
PdfDocument inputDocument = PdfReader.Open(pdfFilePath, PdfDocumentOpenMode.Import);
Int32 count = inputDocument.PageCount;
for (Int32 currentPage = 0; currentPage < count; currentPage++)
{
PdfPage …Run Code Online (Sandbox Code Playgroud)