문제 해결
Aspose.PDF FOSS for .NET 작업 시 흔히 발생하는 문제와 해결책
문서 로드
| Problem | Cause | Solution |
|---|
Document.Open이(가) 유효한 PDF에서 발생함 | 파일이 비밀번호로 보호됨 | 생성자에 비밀번호를 제공하십시오 |
| 대용량 PDF에서 메모리 부족 | 전체 파일을 바이트 배열로 로드함 | 페이지를 개별적으로 처리하거나 스트리밍을 사용하십시오 |
Pages[0]이(가) 인덱스 오류를 발생시킴 | 페이지가 1 기반 인덱싱을 사용함 | 첫 페이지에 Pages[1]을(를) 사용하십시오 |
주석
| Problem | Cause | Solution |
|---|
| 저장 후 주석이 보이지 않음 | 사각형의 면적이 0이거나 페이지 경계 밖에 있음 | 좌표가 페이지 내에 있는지 확인하십시오 MediaBox |
LinkAnnotation.Uri 반환값이 null | 링크가 GoTo 또는 JavaScript 동작을 사용함 | PdfAction.Create 로 해결하고 ActionType 를 확인하십시오 |
Flatten() 예외 발생 | 주석에 /P (페이지) 참조가 없음 | 주석이 Page.Annotations 를 통해 추가되었는지 확인하십시오 |
텍스트 추출
| Problem | Cause | Solution |
|---|
| Extracted text is garbled | Non-standard encoding or CID font mapping | Check font embedding; scanned PDFs may need OCR |
| No text fragments found | Page content is a raster image | Use OCR before text extraction |
| Regex returns no matches | PDF text layout inserts whitespace | Use a looser pattern or normalize whitespace |
렌더링 및 변환
| Problem | Cause | Solution |
|---|
| Rendered image is blurry | Resolution too low | Increase DPI in Resolution constructor |
| HTML output missing images | External image paths not configured | Use HtmlSaveOptions with embedded images |
| PDF/A conversion removes annotations | Target profile disallows annotations | Use PDF/A-2 or PDF/A-3 |
폼 필드
| Problem | Cause | Solution |
|---|
| Field value is empty | Field has no /V entry | Check field.Value is not null |
FillField has no effect | Field name mismatch | Use Form.FieldNames to list available names |
| ExportToJson produces empty output | Widget annotation not correctly cast | Verify the annotation is a WidgetAnnotation |
일반 팁
- 파일 핸들을 해제하려면 항상
Document을 using으로 감싸십시오. - 파일 잠금을 방지하기 위해 인메모리 워크플로에
Document.Open(byte[])을 사용하십시오. - 인덱스로 페이지에 접근하기 전에
doc.Pages.Count을 확인하십시오. - 최상의 성능을 위해 모든 수정 후에 문서를 한 번만 저장하십시오.
참조