Aspose-pdf,把html转成pdf,文本两端对齐属性text-align: justify不生效

使用aspose-pdf,把html转成pdf,文本两端对齐属性text-align: justify不生效
xxxx.pdf (321.3 KB)

<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
		<title>Document</title>
		<style>
			* {
				margin: 0;
				padding: 0;
				color: #606266;
			}

			.make_cut {
				background: #fff;
				position: relative;
			}

			.make_cut .cut_middle {
				position: relative;
				width: 100%;
				height: 100%;
				background-size: 100% 100%;
				background-repeat: no-repeat;
			}

			.middle_bg {
				position: absolute;
				top: 0;
				left: 0;
				width: 100%;
				height: 100%;
				z-index: 1;
				object-fit: fill;
			}

			.box_middle {
				width: 100%;
				height: 100%;
				position: relative;
				overflow: hidden;
				z-index: 2;
			}

			.box_middle .yoyoo-ddr {
				position: absolute;
			}

			.box_middle .html_div_img {
				object-fit: cover;
				width: 100%;
				height: 100%;
			}

			.insert_span {
				display: inline;
				word-break: break-all;
				text-decoration: none !important;
			}
		</style>
	</head>
	<body>
		<div class="make_cut" style="width: 945px; height: 680px;">
			<div class="cut_middle"> <img src="C:\Users\lw\Downloads\9c010b21325940678cb0326427b12b72.png" alt="" class="middle_bg">
				<div class="box_middle" style="width: 945px; height: 680px;">
					<div class="yoyoo-ddr" style="left: 167px; top: 195px; width: 80px; height: 121px; transform: rotate(0deg);">
						<!----><img src="C:\Users\lw\Downloads\476f824b133e4f10ac640c0a538475ff.png" alt="" data-name="head" class="html_div_img">
						<div class="resize-handler-wrapper"><span data-resizetype="tl" class="resize-handler tl" style="cursor: nw-resize; width: 11px; height: 11px; top: -5px; left: -5px;"></span><span
							 data-resizetype="tm" class="resize-handler tm" style="cursor: n-resize; width: 11px; height: 11px; top: -5px; margin-left: -5px;"></span><span
							 data-resizetype="tr" class="resize-handler tr" style="cursor: ne-resize; width: 11px; height: 11px; right: -5px; top: -5px;"></span><span
							 data-resizetype="r" class="resize-handler r" style="cursor: e-resize; width: 11px; height: 11px; right: -5px; margin-top: -5px;"></span><span
							 data-resizetype="br" class="resize-handler br" style="cursor: se-resize; width: 11px; height: 11px; bottom: -5px; right: -5px;"></span><span
							 data-resizetype="bm" class="resize-handler bm" style="cursor: s-resize; width: 11px; height: 11px; margin-left: -5px; bottom: -5px;"></span><span
							 data-resizetype="l" class="resize-handler l" style="cursor: w-resize; width: 11px; height: 11px; margin-top: -5px; left: -5px;"></span><span
							 data-resizetype="bl" class="resize-handler bl" style="cursor: sw-resize; width: 11px; height: 11px; left: -5px; bottom: -5px;"></span></div><span
						 data-type="rotate" class="rotate-handler" style="width: 11px; height: 11px; top: -25px; margin-left: -5px;"></span>
					</div>
					<div class="yoyoo-ddr" style="left: 100px; top: 100px; width: 170px; height: 170px; transform: rotate(0deg); display: none;">
						<div class="resize-handler-wrapper"><span data-resizetype="tl" class="resize-handler tl" style="cursor: nw-resize; width: 11px; height: 11px; top: -5px; left: -5px;"></span><span
							 data-resizetype="tm" class="resize-handler tm" style="cursor: n-resize; width: 11px; height: 11px; top: -5px; margin-left: -5px;"></span><span
							 data-resizetype="tr" class="resize-handler tr" style="cursor: ne-resize; width: 11px; height: 11px; right: -5px; top: -5px;"></span><span
							 data-resizetype="r" class="resize-handler r" style="cursor: e-resize; width: 11px; height: 11px; right: -5px; margin-top: -5px;"></span><span
							 data-resizetype="br" class="resize-handler br" style="cursor: se-resize; width: 11px; height: 11px; bottom: -5px; right: -5px;"></span><span
							 data-resizetype="bm" class="resize-handler bm" style="cursor: s-resize; width: 11px; height: 11px; margin-left: -5px; bottom: -5px;"></span><span
							 data-resizetype="l" class="resize-handler l" style="cursor: w-resize; width: 11px; height: 11px; margin-top: -5px; left: -5px;"></span><span
							 data-resizetype="bl" class="resize-handler bl" style="cursor: sw-resize; width: 11px; height: 11px; left: -5px; bottom: -5px;"></span></div><span
						 data-type="rotate" class="rotate-handler" style="width: 11px; height: 11px; top: -25px; margin-left: -5px;"></span>
					</div>
					<div class="yoyoo-ddr active" style="left: 337px; top: 99px; width: 385px; height: 462px; transform: rotate(0deg);">
						<div class="html_div_text">
							<p style="text-align: justify;line-height: 1.5;text-align-last: justify;"><span style="font-size: 29px;"><a
									 class="insert_span name" style="display:inline;" contenteditable="false">#(name)</a>同志自2024年9月6日至2024年10月23日参加中共福州市委党校(福州市行政学院)</span><a
								 class="insert_span class_name" style="display: inline; font-size: 29px; text-decoration: underline;"
								 contenteditable="false"><span style="font-size: 29px;">#(class_name)</span></a><span style="font-size: 29px;">学习,修完教学计划规定的全部课程,经考试学习成绩合格,特发给结业证书。</span></p>
							<p><br></p>
						</div>
						<!---->
						<div class="resize-handler-wrapper"><span data-resizetype="tm" class="resize-handler tm" style="cursor: n-resize; width: 11px; height: 11px; top: -5px; margin-left: -5px;"></span><span
							 data-resizetype="r" class="resize-handler r" style="cursor: e-resize; width: 11px; height: 11px; right: -5px; margin-top: -5px;"></span><span
							 data-resizetype="bm" class="resize-handler bm" style="cursor: s-resize; width: 11px; height: 11px; margin-left: -5px; bottom: -5px;"></span><span
							 data-resizetype="l" class="resize-handler l" style="cursor: w-resize; width: 11px; height: 11px; margin-top: -5px; left: -5px;"></span></div><span
						 data-type="rotate" class="rotate-handler" style="width: 11px; height: 11px; top: -25px; margin-left: -5px;"></span>
					</div>
					<div class="middle_x_line" style="left: 248px; display: none;"></div>
					<div class="middle_y_line" style="top: 0px; display: none;"></div>
					<!---->
				</div>
			</div>
		</div>
	</body>
</html>

这是测试html的内容

@liuwei2891

您还可以分享您用于转换的示例代码示例吗?我们将在我们的环境中测试该场景并相应地解决它。

    public static void main(String[] args) throws IOException {
        HtmlLoadOptions htmlOptions = new HtmlLoadOptions();
        FileInputStream inputStream = new FileInputStream("input.html");
        Document document = new Document(inputStream, htmlOptions);
        document.save("output.pdf");
        inputStream.close();
        document.close();
    }

@liuwei2891

我们已在内部问题跟踪系统中打开以下新票证,并将根据免费支持政策中提到的条款提供修复。

问题 ID:PDFJAVA-44557

如果您需要优先支持,以及直接联系我们的付费支持管理团队,您可以获取付费支持服务

你好,请问这个问题有解决方案了吗?大概多久可以解决呢?

@yichunxia

该问题最近已记录在我们的问题管理系统中,并将按照先到先得的原则确定优先级。一旦我们在解决问题方面取得一些进展,我们将通过此论坛帖子通知您。请耐心等待并给我们一些时间。

对于给您带来的不便,我们深表歉意。