HTML to PDF / DOCX / RTF Java converter library › Forums › PD4ML v3 Archived Forums (Read Only) › Troubleshooting › changePageOrientation in RTF
- This topic has 5 replies, 2 voices, and was last updated Jan 15, 2014
17:11:42 by PD4ML.
-
AuthorPosts
-
January 14, 2014 at 14:23#26895
I am trying to make PDF&RTF files from html page.
in example there is a string to set page orientation:
pd4ml.setPageSize( landscapeValue ? pd4ml.changePageOrientation( format ): format );it work perfect with PDF, but have no effect with RTF format.
What can be wrong?P.S. I am using PD4ML 385 Pro
January 14, 2014 at 14:31#29452For the time being, PD4ML does not support the feature by RTF output.
Also I am not sure if RTF file format implements such a feature. Do you have an RTF sample (probably created with MS Word or OpenOffice) to confirm it is possible?
January 15, 2014 at 05:39#29453Thank you for your fast answer
Attached file is .RTF, but it have landscape orientation in Word 2007 and OpenOffice 4.0.1 at my computer
January 15, 2014 at 12:25#29454I guess I misunderstood you first time. PD4ML does not support a dynamic format change: for example, the first page is portrait, the second is landscape.
To avoid possible code errors, try to define format explicitly, without conditions:
Portrait:
pd4ml.setPageSize( PD4Constants.A4 );Landscape:
pd4ml.setPageSize( pd4ml.changePageOrientation( PD4Constants.A4 ) );January 15, 2014 at 14:00#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.January 15, 2014 at 17:11#29456You are right: we’ve just found a bug in our code. A solution will be available with the new maintenance release in 1-2 weeks. Or request a dev build by email from support pd4ml com
-
AuthorPosts
The forum ‘Troubleshooting’ is closed to new topics and replies.