PD4ML v4 Forums PD4ML v3 Archived Forums (Read Only) Troubleshooting changePageOrientation in RTF

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #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

    #29452

    For 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?

    #29453

    Thank 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

    #29454

    I 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 ) );

    #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.

    #29456

    You 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

Viewing 6 posts - 1 through 6 (of 6 total)

The forum ‘Troubleshooting’ is closed to new topics and replies.