PDFlib - 从字符串添加 SVG

PDFlib - add SVG from string

使用 PDFlib 时是否可以将 SVG 图形从字符串添加到 PDF 页面?

文档指出 load_graphics() 采用光盘上的文件名。有解决办法吗?

当然,您可以使用 PVF(PDFlib 虚拟文件系统)来完成此任务。有关详细介绍,请参阅 PDFlib 9.2 教程第 3.1.3 章“PDFlib 虚拟文件系统 (PVF)”。

PDFlib 程序包 (starter_pvf.php) 中包含一个用于光栅图像的示例,并且还包含在 PDFlib 说明书中: starter_pvf.

    # We just read some image data from a file; to really benefit
    # from using PVF read the data from a Web site or a database instead

    $imagedata = read_file("../input/PDFlib-logo.tif");

    $p->create_pvf("/pvf/image", $imagedata, "");

    # Load the image from the PVF
    $image = $p->load_image("auto", "/pvf/image", "");