compass.utilities.parsing.is_pdf_doc#
- is_pdf_doc(doc)[source]#
Determine whether a document is a PDF based on type or attributes
This function first checks if the document is an instance of PDFDocument. If not, it looks for a “doc_type” attribute in the document’s attributes and checks if it is a string that case-insensitively matches “pdf”. If neither condition is met, the function returns
False.- Parameters:
doc (
elm.web.document.Document) – Document instance to check for PDF characteristics. The function first checks if the document is an instance of PDFDocument. If not, it looks for a “doc_type” attribute in the document’s attributes and checks if it is a string that case-insensitively matches “pdf”. If neither condition is met, the function returnsFalse.- Returns:
bool–Truewhen a document represents a PDF file,Falseotherwise.