将文本围绕MPDF中的图像包裹

发布于 2025-01-25 14:53:41 字数 2404 浏览 4 评论 0原文

我试图将文本包裹在PDF中的图像上,我尝试了很多事情,但它在mpdf中不起作用

”格式2“

基本上我希望我的pdf格式如上图

所示是格式1代码的代码

<div class="content" style="text-align: center;">
                        <div class="main_img" style="height:300px; width:300px; float:right;
                        margin-left: 1em;">
                        <img src="' . "./uploads/$main_images" . '" style="height:300px; width:100%; float:right; justify:end;" />
                        </div>
                        <p style="text-align: justify; word-wrap: break-word;">' . $content . '</p>
                        <p style="text-align: justify;">' . $content2 . '</p>
                        <div class="other_img" style="height:300px width:100%; margin: 5px;">
                            <div class="oth_img" style=" background-image: url(' . "./uploads/$oth_images" . '); background-repeat: no-repeat; background-size: cover; height:300px; width:100%;"></div>
                        </div>
                    </div>

,用于格式2

<div class="content" style="">
                    <div class="other_img" style="height:300px width:100%; margin: 5px;">
                        <div class="oth_img" style=" background-image: url(' . "./uploads/$oth_images" . '); background-repeat: no-repeat; background-size: cover; height:300px; width:100%;"></div>
                    </div>
                    <br>
                    <p style="text-align: justify;">' . $content . '</p>
                    <div class="main_img" style="height:300px; width:300px; float:left; margin: 5px; margin-bottom:100px;">
                        <img src="' . "./uploads/$main_images" . '" style="height:300px; width:100%; float:left; justify:end;" />
                    </div>
                    <p style="text-align: justify;">' . $content2 . '</p>
                </div>

上述代码以正常html格式工作 但是它在PDF中不起作用 请指导我在PDF中进行这项工作也要

感谢

i was try to wrap text around image in pdf, i have tried lots of things but its not work in mpdf
Format 1

format 2

basically i want format of my pdf as above images

below is a code for format 1

<div class="content" style="text-align: center;">
                        <div class="main_img" style="height:300px; width:300px; float:right;
                        margin-left: 1em;">
                        <img src="' . "./uploads/$main_images" . '" style="height:300px; width:100%; float:right; justify:end;" />
                        </div>
                        <p style="text-align: justify; word-wrap: break-word;">' . $content . '</p>
                        <p style="text-align: justify;">' . $content2 . '</p>
                        <div class="other_img" style="height:300px width:100%; margin: 5px;">
                            <div class="oth_img" style=" background-image: url(' . "./uploads/$oth_images" . '); background-repeat: no-repeat; background-size: cover; height:300px; width:100%;"></div>
                        </div>
                    </div>

code for format 2

<div class="content" style="">
                    <div class="other_img" style="height:300px width:100%; margin: 5px;">
                        <div class="oth_img" style=" background-image: url(' . "./uploads/$oth_images" . '); background-repeat: no-repeat; background-size: cover; height:300px; width:100%;"></div>
                    </div>
                    <br>
                    <p style="text-align: justify;">' . $content . '</p>
                    <div class="main_img" style="height:300px; width:300px; float:left; margin: 5px; margin-bottom:100px;">
                        <img src="' . "./uploads/$main_images" . '" style="height:300px; width:100%; float:left; justify:end;" />
                    </div>
                    <p style="text-align: justify;">' . $content2 . '</p>
                </div>

above code work in normal html format
but its not work in pdf
please guide me to make this work in pdf also

thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文