IronPDF 故障排除 IronPdf 無法開啟或解析特定的 PDF 檔案 Troubleshooting PDF Parsing Errors in IronPDF Curtis Chau 更新日期:6月 1, 2025 Download IronPDF NuGet 下載 DLL 下載 Windows 安裝程式 Start Free Trial Copy for LLMs Copy for LLMs Copy page as Markdown for LLMs Open in ChatGPT Ask ChatGPT about this page Open in Gemini Ask Gemini about this page Open in Grok Ask Grok about this page Open in Perplexity Ask Perplexity about this page Share Share on Facebook Share on X (Twitter) Share on LinkedIn Copy URL Email article This article was translated from English: Does it need improvement? Translated View the article in English 當嘗試使用 IronPDF 解析 PDF 文件時,您可能會遇到以下異常: Unhandled exception. System.IO.IOException: PDF can not be opened as a PDF. May be an incorrect file type or a password is required. Please check file for corruption or validity by a 3rd party at: https://www.pdf-online.com/osa/validate.aspx 此錯誤通常發生在使用以下代碼將 PDF 文件加載到 PdfDocument 對象時: // Attempt to load a PDF document from a file var pdf = PdfDocument.FromFile("Test.pdf"); // Attempt to load a PDF document from a file var pdf = PdfDocument.FromFile("Test.pdf"); ' Attempt to load a PDF document from a file Dim pdf = PdfDocument.FromFile("Test.pdf") $vbLabelText $csharpLabel 可能的原因 密碼保護的 PDF 擁有者密碼:此異常的最常見原因是 PDF 由 擁有者密碼 保護。 當 PDF 設有擁有者密碼時,會限制某些操作,例如編輯或複製。 要加載此類文件,您必須提供密碼。 損壞的 PDF PDF 文件可能損壞或不是有效的 PDF 格式。 損壞的文件可能導致 IronPDF 在解析時失敗。 解決方案 處理密碼保護的 PDF 如果您知道 PDF 的密碼,您可以將其傳遞給 PdfDocument.FromFile() 方法: // Load a password-protected PDF by specifying the owner password var pdf = PdfDocument.FromFile("test.pdf", "ownerpassword"); // Load a password-protected PDF by specifying the owner password var pdf = PdfDocument.FromFile("test.pdf", "ownerpassword"); ' Load a password-protected PDF by specifying the owner password Dim pdf = PdfDocument.FromFile("test.pdf", "ownerpassword") $vbLabelText $csharpLabel 您還可以通過在 Adobe Acrobat 中檢查其屬性來驗證文件是否受密碼保護。 有關識別 PDF 安全狀態的更多信息,請參閱此文章。 處理損壞的 PDF 要檢查 PDF 文件是否損壞,使用第三方驗證工具。 如果文件損壞,IronPDF 將無法解析。 如果這些故障排除步驟無法解決問題,請提交工程支持請求以獲取我們支持工程師的進一步協助。 Curtis Chau 立即與工程團隊聊天 技術作家 Curtis Chau 擁有卡爾頓大學計算機科學學士學位,專注於前端開發,擅長於 Node.js、TypeScript、JavaScript 和 React。Curtis 熱衷於創建直觀且美觀的用戶界面,喜歡使用現代框架並打造結構良好、視覺吸引人的手冊。除了開發之外,Curtis 對物聯網 (IoT) 有著濃厚的興趣,探索將硬體和軟體結合的創新方式。在閒暇時間,他喜愛遊戲並構建 Discord 機器人,結合科技與創意的樂趣。 準備好開始了嗎? Nuget 下載 16,154,058 | 版本: 2025.11 剛剛發布 免費 NuGet 下載 總下載量:16,154,058 查看許可證