# แปลง Image เป็น PDF ใน Python

> แปลง Image เป็น PDF ใน Python ใช้ Python library API เพื่อแปลงไฟล์ Image เป็น PDFs

Source: https://products.aspose.com/slides/th/python-net/conversion/image-to-pdf/
Updated: 2023-03-21



## แปลง Image เป็น PDF ใน Python

[**Aspose.Slides สำหรับ Python ผ่าน .NET**](https://products.aspose.com/slides/th/python-net/) เป็นไลบรารี Python ที่มีประสิทธิภาพสำหรับการสร้างและจัดการไฟล์งานนำเสนอ นอกจากนี้ ยังมีวิธีที่ยืดหยุ่นในการแปลง Image เป็น PDF เมื่อใช้ **Aspose.Slides สำหรับ Python ผ่าน .NET** นักพัฒนาหรือแอปพลิเคชันใดๆ ก็สามารถแปลงไฟล์ Image เป็น PDF ด้วยโค้ด Python เพียงไม่กี่บรรทัด

ในฐานะ API การประมวลผลเอกสารสมัยใหม่ Aspose.Slides สำหรับ Python จะส่งออกไฟล์ Image เป็นรูปแบบไฟล์ PDF ได้อย่างรวดเร็ว ไลบรารี Aspose PowerPoint ช่วยให้คุณแปลง Image เป็น PDF และรูปแบบไฟล์อื่นๆ อีกมากมาย

## แปลง Image เป็น PDF โดยใช้ Python

หากต้องการแปลง Image เป็น PDF คุณจะต้องสร้างงานนำเสนอจากไฟล์ Image และบันทึกเป็น PDF

### รหัส Python สำหรับแปลง Image เป็น PDF

```python

import aspose.slides as slides
import aspose.pydrawing as drawing

with slides.Presentation() as pres:
    slide = pres.slides[0]
    image = pres.images.add_image(drawing.Bitmap(dataDir+ "image.png"))
	slide.shapes.add_picture_frame(slides.ShapeType.RECTANGLE, 10, 10, 100, 100, image)
    pres.save("index.pdf", slides.export.SaveFormat.PDF)

```

## วิธีแปลง Image เป็น PDF โดยใช้ Aspose.Slides สำหรับ Python API

นี่คือขั้นตอนในการแปลง Image เป็น PDF ใน Python

ติดตั้ง [**Aspose.Slides for Python via .NET**](https://products.aspose.com/slides/th/python-net/)

เพิ่มการอ้างอิงไลบรารี (นำเข้าไลบรารี) ไปยังโครงการ Python ของคุณ

เปิดไฟล์ต้นฉบับ Image ใน Python

บันทึกผลลัพธ์เป็นไฟล์ PDF

## แปลง Image เป็นรูปแบบอื่นที่รองรับ
