#29455

@PD4ML wrote:

Portrait:
pd4ml.setPageSize( PD4Constants.A4 );
Landscape:
pd4ml.setPageSize( pd4ml.changePageOrientation( PD4Constants.A4 ) );

Yes, i use always second type, but it have no effect:

private static int PDF = 1;<br /> private static int RTF = 2;<br /> <br /> @Test<br /> public void pd4TestRun() throws Exception {<br /> convert(<path>, "C:\result.rtf", RTF);<br /> convert(<path>, "C:\result.pdf", PDF);<br /> }<br /> <br /> private void convert(String input, String output, int type) throws Exception {<br /> FileOutputStream fos = new FileOutputStream(new File(output));<br /> <br /> PD4ML pd4ml = new PD4ML();<br /> if (type == RTF) pd4ml.outputFormat(PD4Constants.RTF);<br /> pd4ml.setPageSize(pd4ml.changePageOrientation(PD4Constants.A4));<br /> pd4ml.setPageInsets(new Insets(20, 20, 20, 20));<br /> pd4ml.setHtmlWidth(1024);<br /> pd4ml.disableHyperlinks();<br /> pd4ml.useTTF("java:fonts", true);<br /> pd4ml.setDefaultTTFs("Times New Roman", "Arial", "Courier New");<br /> InputStream is = new FileInputStream(new File(input));<br /> InputStreamReader inputStreamReader = new InputStreamReader(is);<br /> pd4ml.render(inputStreamReader, fos, new File(input).toURL());<br /> fos.close();<br /> }
This code generate 2 files (attached to this message). But PDF is landscape, and RTF is portrait.
I need landscape both.