HTML to PDF / DOCX / RTF Java converter library › Forums › PD4ML v3 Archived Forums (Read Only) › HTML/CSS rendering issues › Multiple Column PDF › Re: Re: Multiple Column PDF
I should add that I also tried to get the html properly rendering in browser with dual column. I did it using this head meta:
.printDualColumn {
-moz-column-count: 2;
-webkit-column-count: 2;
column-count: 2;
}
And then I surrounded the content which needs dual column printing with:
It renders correctly in dual column format in the browser from the html. But when I render the html to pdf using pd4ml it does not render in two column.
@Test<br />
public void dualColumnTest2() throws Exception {<br />
PD4ML pd4ml = new PD4ML();<br />
pd4ml.outputFormat(PD4ML.PDF);<br />
Insets insets = new Insets(10,10,10,10);<br />
pd4ml.setPageInsetsMM(insets);<br />
pd4ml.setHtmlWidth(800);<br />
pd4ml.adjustHtmlWidth();<br />
Map<String, String> m = new HashMap<String, String>();<br />
m.put(PD4Constants.PD4ML_MEDIA_TYPE_PRINT, "override");<br />
pd4ml.setDynamicParams(m);<br />
String content = "" +<br />
"<html>" +<br />
"<head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><style type="text/css">" +<br />
"n.printDualColumn {n" +<br />
"tttt-moz-column-count: 2;n" +<br />
"tttt-webkit-column-count: 2;n" +<br />
"ttttcolumn-count: 2;n" +<br />
"ttt}n" +<br />
"</style></head>" +<br />
"<body>" +<br />
"<p>Stuff before the dual-column text</p>" +<br />
"<div class="printDualColumn">" +<br />
"Lots of text to be placed in dual columns" +<br />
"Lots of text to be placed in dual columns" +<br />
"Lots of text to be placed in dual columns" +<br />
"Lots of text to be placed in dual columns" +<br />
"</div>" +<br />
"</body></html>";<br />
StringReader htmlInput = new StringReader(content);<br />
FileOutputStream htmlInputFile = new FileOutputStream("c:/bb/foo2.html");<br />
htmlInputFile.write(content.getBytes());<br />
FileOutputStream pdfOutput = new FileOutputStream("c:/bb/foo2.pdf");<br />
pd4ml.render(htmlInput, pdfOutput);<br />
}
Is there something I can do either in the css or in my java code?