Hãy thử điều này:
- Tạo một file svg mẫu trong Inkscape (xem ví dụ dưới đây).
- Mở tệp đó bằng trình chỉnh sửa văn bản và đặt một số mã thông báo trình giữ chỗ cho các biến bạn muốn thay đổi: Phông chữ và văn bản.
- Tạo trang web để người dùng có thể chọn phông chữ và viết văn bản.
- Truy xuất dữ liệu đó trong máy chủ.
- Đọc tệp mẫu và thay đổi mã thông báo trình giữ chỗ với dữ liệu người dùng.
- Gọi Inkscape thông qua dòng lệnh.
inkscape template.svg --export-text-to-path --export-id=maintext --export-pdf=new_file.pdf
Bây giờ, tôi biết, tôi biết, bạn nói bạn muốn một sản lượng svg ... Tôi đã thử các tùy chọn:
--export-plain-svg=new_file.svg
Nhưng theo man page Inkscape:
-T, --export-text-to-path
Convert text objects to paths on export, where applicable (for PS, EPS, and PDF export).
Soooo ... không thể xuất thô svg và xuất văn bản sang đường dẫn: S ... BTW này phải được điền dưới dạng lỗi.
Bạn có thể phục vụ cho PDF, hoặc gọi điện thoại một lần nữa:
inkscape -l new_file.svg new_file.pdf
nào ... Tôi biết, là khá ngu ngốc. Không, thực sự, nộp một lỗi trên Inkscape: P
Đây là ví dụ Inkscape mẫu:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
version="1.1"
width="440.29297"
height="39.824219"
id="svg2">
<defs
id="defs4" />
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<text
x="-3.4374955"
y="30.390625"
id="maintext"
xml:space="preserve"
style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:[FONT_PLACEHOLDER]"><tspan
x="-3.4374955"
y="30.390625"
id="tspan3006"
style="fill:#000000">[TEXT_PLACEHOLDER]</tspan></text>
</svg>
Kind regards.
Xem http: // stackoverflow.com/questions/8296964/is-there-a-php-thư viện-cho-vẽ-văn bản-as-a-vector-phác thảo –