Code:
# Composable verbs for complex workflows
pdf = (attach("2412.19437v2.pdf")
| load.pdf_to_pdfplumber # File → Object
| split.pages # Object → Collection
| present.markdown) # Extract content
# | refine.add_headers # Polish content
# | adapt.claude("Analyze")) # Format for AI
# Check what we get
print(f"Type of pdf object: {type(pdf)}")
print(f"Available attributes: {dir(pdf)}")
for item in pdf:
print(str(item))
I am trying to split a pdf into pages and convert each page into a new markdown file.
Currently the pipe I am using is splitting the pdf to create an AttachmentCollection, then I try to present the attachments as markdown files.
However, when I try to print each entry in the AttachmentCollection I get the following errors:
[Attachments] Applying step 'load.pdf_to_pdfplumber' to 2412.19437v2.pdf
[Attachments] Applying step 'split.pages' to 2412.19437v2.pdf
# PDF Document: 2412.19437v2.pdf#page-1
*Error extracting PDF text: seek of closed file*
# PDF Document: 2412.19437v2.pdf#page-2
*Error extracting PDF text: seek of closed file*
# PDF Document: 2412.19437v2.pdf#page-3
*Error extracting PDF text: seek of closed file*
# PDF Document: 2412.19437v2.pdf#page-4
*Error extracting PDF text: seek of closed file*
# PDF Document: 2412.19437v2.pdf#page-5
*Error extracting PDF text: seek of closed file*
Code:
I am trying to split a pdf into pages and convert each page into a new markdown file.
Currently the pipe I am using is splitting the pdf to create an AttachmentCollection, then I try to present the attachments as markdown files.
However, when I try to print each entry in the AttachmentCollection I get the following errors: