-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Building pandoc on a Raspberry Pi
For Raspberry Pi 4 binaries, see also ickc/pandoc-arm.
The following guide is written for Raspberry Pi 1 Model B. YMMV on other models including the newer one.
The pandoc supplied by Raspbian is rather old (1.9.4.2) The last version you can build is 1.11.1 but this is still an improvement. Here is how to do it:
- You need a Raspberry Pi 1 Model B with 512 MB Ram
- You need an 8 GB (or larger) SD Card
- Use
raspi-config
to set the Memory split to 16 (You can change back to 64 later) - Set swap to 500 MB (
/etc/dphys-swapfile
) sudo apt-get update && apt-get upgrade
- Boot into console mode (no X)
- If you have any services running (Samba, Hostapd, Apache, ... ) stop them.
sudo apt-get haskell-platform
cabal update
- You may want to edit
.cabal/config
now and setuser-install
toFalse
, remove the--
to uncomment. Otherwise the newly build packages are only available for the user who build them. -
cabal install pandoc-1.11.1
this will take hours, be warned. - You may now want to install texlive, the full version will take up 3.5 GB but the small version should do for pandoc.
""" XXX DEX PPT Generator - 主入口文件 生成深色科技风格的XXX DEX产品演示PPT """
from fastapi import FastAPI, File, UploadFile, HTTPException from fastapi.responses import FileResponse from fastapi.middleware.cors import CORSMiddleware from src.ppt_generator import XXXDEXPPTGenerator import uvicorn import os import tempfile
app = FastAPI( title="XXX DEX PPT Generator", description="生成XXX DEX产品演示PPT的自动化工具", version="1.0.0" )
app.add_middleware( CORSMiddleware, allow_origins=[""], allow_credentials=True, allow_methods=[""], allow_headers=["*"], )
@app.post("/generate-ppt") async def generate_ppt(): """生成PPTX文件并返回下载链接""" try: generator = XXXDEXPPTGenerator()
# 创建临时文件
with tempfile.NamedTemporaryFile(suffix='.pptx', delete=False) as tmp_file:
tmp_path = tmp_file.name
# 生成PPT
generator.create_presentation(tmp_path)
return FileResponse(
tmp_path,
media_type="application/vnd.openxmlformats-officedocument.presentationml.presentation",
filename="XXX-DEX-产品演示.pptx"
)
except Exception as e:
raise HTTPException(status_code=500, detail=str(e))
@app.get("/health") async def health_check(): """健康检查接口""" return {"status": "healthy", "service": "XXX DEX PPT Generator"}
if name == "main": uvicorn.run(app, host="0.0.0.0", port=8000)