# PDF 파일 이미지 변환



PDF 파일을 이미지 파일로 변환합니다.



인증: Authorization: Bearer $APICK_API_KEY

본문 있는 REST 요청: multipart/form-data. GET 본문 및 MCP JSON-RPC 규격은 해당 명세를 따릅니다.

인증키는 서버에 보관하세요. 모든 예제는 정적 자료입니다.



## POST /rest/pdf_to_image 응답 필드

## API 요청: POST /rest/pdf_to_image



### 입력

- `pdf` (file, 필수): PDF 파일



### 응답 명세

```json

{
  "type": "string",
  "format": "binary"
}

```

### curl

```curl

curl --fail-with-body --request POST 'https://apick.app/rest/pdf_to_image' \
  --header "Authorization: Bearer $APICK_API_KEY" \
  --form 'pdf=@/C:/Users/user/Desktop/sample_document.pdf' \
  --dump-header response.headers --output result.zip
# response.headers의 Content-Type을 확인한 뒤 파일을 사용하세요.

```

### Node.js (서버 ESM)

```javascript

import { readFile } from "node:fs/promises";
const form = new FormData();
form.append("pdf", new Blob([await readFile("/C:/Users/user/Desktop/sample_document.pdf")]), "sample_document.pdf");
const response = await fetch("https://apick.app/rest/pdf_to_image", {
  method: "POST",
  headers: { Authorization: "Bearer " + process.env.APICK_API_KEY },
  body: form,
  signal: AbortSignal.timeout(120_000),
});
if (!response.ok) throw new Error(`HTTP ${response.status}: ${await response.text()}`);
if ((response.headers.get("content-type") || "").includes("json")) {
  throw new Error(JSON.stringify(await response.json()));
}
const { writeFile } = await import("node:fs/promises");
await writeFile("result.zip", new Uint8Array(await response.arrayBuffer()));

```

### python

```python

import os
import requests
parts = [
    ("pdf", ("sample_document.pdf", open("/C:/Users/user/Desktop/sample_document.pdf", "rb"))),
]
response = requests.request("POST", "https://apick.app/rest/pdf_to_image",
    headers={"Authorization": "Bearer " + os.environ["APICK_API_KEY"]},
    files=parts,
    timeout=(10, 120), stream=True)
response.raise_for_status()
if "json" in response.headers.get("Content-Type", ""):
    raise RuntimeError(response.json())
with open("result.zip", "wb") as output:
    for chunk in response.iter_content(65536):
        output.write(chunk)

```

### php

```php

<?php
$headers = ["Authorization: Bearer " . getenv("APICK_API_KEY")];
$form = [
    'pdf' => new CURLFile('/C:/Users/user/Desktop/sample_document.pdf'),
];
$curl = curl_init('https://apick.app/rest/pdf_to_image');
curl_setopt_array($curl, [
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_HTTPHEADER => $headers,
    CURLOPT_POSTFIELDS => $form,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CONNECTTIMEOUT => 10, CURLOPT_TIMEOUT => 120,
]);
$body = curl_exec($curl);
if ($body === false) { throw new RuntimeException(curl_error($curl)); }
$status = curl_getinfo($curl, CURLINFO_HTTP_CODE);
$type = curl_getinfo($curl, CURLINFO_CONTENT_TYPE) ?: "";
curl_close($curl);
if ($status >= 400) { throw new RuntimeException($body); }
if (strpos($type, "json") !== false) { throw new RuntimeException($body); }
file_put_contents('result.zip', $body);

```

## 코드·오류

## 상세 기능·요금

업로드 용량 제한: 1GB multipart/form-data 요청에 포함된 첨부파일 합계는 최대 1GB입니다. 처리시간은 재생시간, 페이지 수와 파일 형식에 따라 늘어날 수 있습니다. 제한을 초과하면 HTTP 413과 REQUEST_TOO_LARGE 오류가 반환되며 과금되지 않습니다. PDF 파일의 페이지 수만큼 이미지가 생성되며 변환된 이미지 파일은 압축파일(.zip)로 압축됩니다. Method URL POST https://apick.app/rest/pdf_to_image

## 상세 요청

Header 이름 필수 설명 Authorization O Bearer 인증키

## 상세 응답

Header 이름 필수 설명 success O API 서버 정상 응답 여부 cost O API 호출 요금 ms O API 응답 시간 Content-Type O 응답 바디 데이터 타입 Content-Disposition O 파일명(output 고정) Body 이름 타입 설명 zip 형식의 바이너리 데이터

## 상세 예제

요청 예시 form-data 전체 예제 보기 응답 예시 {zip 형식의 바이너리 데이터}
