Skip to content

Commit

Permalink
docs
Browse files Browse the repository at this point in the history
  • Loading branch information
pelikhan committed Feb 11, 2025
1 parent ea16226 commit 2098828
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions docs/src/content/docs/reference/scripts/pdf.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,21 @@ pages.slice(0, 2).forEach((page, i) => {
})
```

## Rendering to images
## Images and figures

Check warning on line 39 in docs/src/content/docs/reference/scripts/pdf.md

View workflow job for this annotation

GitHub Actions / build

Header changed from "Rendering to images" to "Images and figures". Consider keeping the original header for consistency.

GenAIScript automatically extracts bitmap images from PDFs and stores them in the data array. You can use these images to generate prompts. The image are encoded as PNG and may be large.

```js
const { data } = await parsers.PDF(env.files[0])
```

## Rendering pages to images

Check failure on line 47 in docs/src/content/docs/reference/scripts/pdf.md

View workflow job for this annotation

GitHub Actions / build

Code block is missing after the new section title.

Add the `renderAsImage` option to also reach each page to a PNG image (as a buffer). This buffer can be used with a vision model to perform
an OCR operation.

```js wrap
const { images } = await parsers.PDF(env.files[0],
{ renderAsImage: true })
const { images } = await parsers.PDF(env.files[0], { renderAsImage: true })
```

## PDFs are messy
Expand Down

0 comments on commit 2098828

Please sign in to comment.