HTML to PDF / DOCX / RTF Java converter library › Forums › PD4ML v3 Archived Forums (Read Only) › Troubleshooting › body background-color vs. background-image › Re: Re: body background-color vs. background-image
I´d like to thank you, for the quick answer. It works perfect. 🙂
<br />
public class Pd4Php {<br />
<br />
private String image_url;<br />
public static void main(String[] args) throws Exception {<br />
...<br />
Pd4Php converter = new Pd4Php();<br />
converter.generatePDF( args[0], args[1], args[2], args[3], args.length > 4 ? args[4] : null );<br />
// give an additional argument to the command line<br />
}<br />
private void generatePDF(String inputUrl, String htmlWidth, String pageFormat, String fontsDir, String imageUrl)<br />
{ // an additional String imageUrl<br />
if(imageUrl != null)<br />
{<br />
PD4PageMark footer = new PD4PageMark();<br />
footer.setPageBackgroundImageUrl(imageUrl);<br />
pd4ml.setPageFooter(footer);<br />
}<br />
}<br />
In your PHP Code you need to add the following:
<br />
passthru('java -Xmx512m -Djava.awt.headless=true -cp .:pd4ml_demo.jar Pd4Php '' . $_POST .<br />
'' 800 A4 $_POST 2>&1');<br />