Troubleshooting

Troubleshooting

Troubleshooting

Common issues and solutions when working with Aspose.PDF FOSS for .NET.


Document Loading

ProblemCauseSolution
Document.Open throws on a valid PDFFile is password-protectedSupply the password in the constructor
Out of memory on large PDFsEntire file loaded into byte arrayProcess pages individually or use streaming
Pages[0] throws index errorPages use 1-based indexingUse Pages[1] for the first page

Annotations

ProblemCauseSolution
Annotation not visible after saveRectangle has zero area or is outside page boundsVerify coordinates fall within the page MediaBox
LinkAnnotation.Uri returns nullLink uses a GoTo or JavaScript actionResolve via PdfAction.Create and check ActionType
Flatten() throwsAnnotation missing /P (page) referenceEnsure annotation was added through Page.Annotations

Text Extraction

ProblemCauseSolution
Extracted text is garbledNon-standard encoding or CID font mappingCheck font embedding; scanned PDFs may need OCR
No text fragments foundPage content is a raster imageUse OCR before text extraction
Regex returns no matchesPDF text layout inserts whitespaceUse a looser pattern or normalize whitespace

Rendering and Conversion

ProblemCauseSolution
Rendered image is blurryResolution too lowIncrease DPI in Resolution constructor
HTML output missing imagesExternal image paths not configuredUse HtmlSaveOptions with embedded images
PDF/A conversion removes annotationsTarget profile disallows annotationsUse PDF/A-2 or PDF/A-3

Form Fields

ProblemCauseSolution
Field value is emptyField has no /V entryCheck field.Value is not null
FillField has no effectField name mismatchUse Form.FieldNames to list available names
ExportToJson produces empty outputWidget annotation not correctly castVerify the annotation is a WidgetAnnotation

General Tips

  • Always wrap Document in using to release file handles.
  • Use Document.Open(byte[]) for in-memory workflows to avoid file locks.
  • Check doc.Pages.Count before accessing pages by index.
  • Save the document once after all modifications for best performance.

See Also