Skip to content

Remove redundant PDF file opening in loop - #75

Open
Gustavo R. Ayala (agustavo87) wants to merge 1 commit into
Azure-Samples:mainfrom
agustavo87:fix-pdf-load-loop
Open

Remove redundant PDF file opening in loop#75
Gustavo R. Ayala (agustavo87) wants to merge 1 commit into
Azure-Samples:mainfrom
agustavo87:fix-pdf-load-loop

Conversation

@agustavo87

Copy link
Copy Markdown

Purpose

Remove unnecessary pymupdf.open() call inside the page iteration loop. The PDF was being reopened on every page unnecessarily.

Also adds explicit doc.close() for proper resource cleanup.

Does this introduce a breaking change?

[ ] Yes
[x] No

Pull Request Type

What kind of change does this Pull Request introduce?

[ ] Bugfix
[ ] Feature
[ ] Code style update (formatting, local variables)
[x] Refactoring (no functional changes, no api changes)
[ ] Documentation content changes
[ ] Other... Please describe:

How to Test

Remove images converted page_*.png in notebooks and notebooks/Spanish
Run the corresponding sections of chat_pdf_images.ipynb notebooks, until the ## Convert PDFs to images python code block where the pdfs are converted to images (ensure dependencies installed) .

What to Check

Check that the page_*.png files are created correctly (14 pages)

Remove unnecessary pymupdf.open() call inside the page iteration loop. The PDF was being reopened on every page unnecessarily.

Also adds explicit doc.close() for proper resource cleanup.
@agustavo87

Copy link
Copy Markdown
Author

Gustavo R. Ayala (@agustavo87) please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.

@microsoft-github-policy-service agree [company="{your company}"]

Options:

  • (default - no company specified) I have sole ownership of intellectual property rights to my Submissions and I am not making Submissions in the course of work for my employer.
@microsoft-github-policy-service agree
  • (when company given) I am making Submissions in the course of work for my employer (or my employer has intellectual property rights in my Submissions by contract or applicable law). I have permission from my employer to make Submissions and enter into this Agreement on behalf of my employer. By signing below, the defined term “You” includes me and my employer.
@microsoft-github-policy-service agree company="Microsoft"

Contributor License Agreement

@microsoft-github-policy-service agree

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant