Forum Replies Created

Viewing 15 posts - 1,156 through 1,170 (of 4,234 total)
  • Author
    Posts
  • Raj
      in reply to: General questions / FAQ
      #26531

      I wanted to know the toal number of pages using java pd4ml. Is there any way for it?

      Raj
        in reply to: General questions / FAQ
        #26532

        Hi
        I need to set a different footer for my last page of pdf. I am using PD4ML JAVA API to render the PDF. Is there any way to do that?

        Thanks in Advance.

        Regards
        Raj

        in reply to: HTML/CSS rendering issues
        #26533

        hi
        i am using TTF embadding in pro edition to include arabic support , any way how can i make my html to pdf converter work based on the fonts that are provided by the html , i need to get this in my head because i have used the steps you specify for the TTF embadding and its not working .

        pd4ml.useTTF(“java:fonts”, true);
        //pd4ml.useTTF(“/windows/fonts”, true);
        pd4ml.setPermissions(“empty”, PD4ML.AllowCopy, false);
        pd4ml.setPermissions(“empty”, PD4ML.AllowModify, false);
        pd4ml.setHtmlWidth(userSpaceWidth);
        pd4ml.setPageSize(format);
        pd4ml.adjustHtmlWidth();

        pd4ml.render(url, fos);

        thanks

        in reply to: HTML/CSS rendering issues
        #26534

        Hi,

        I’m currently working with PD4ML (3.5.1 Pro) for Java.
        Here is my issue:

        I have a class with CSS properties about background:

        .ui-widget-header{<br /> background: url(http://php.dsi.intra.foncia.net/devche/mantis-log/resources/foncia/images/ui-bg_gloss-wave_45_4779c0_500x100.jpg) 50% 50% repeat-x;<br /> }

        When I try to render a HTML content into a PDF file, the background image doesn’t appear.
        With the debug mode, I can see that the file is sucessfully reached:

        image not yet in cache: http://php.dsi.intra.foncia.net/devche/mantis-log/resources/foncia/images/ui-bg_gloss-wave_45_4779c0_500x100.jpg<br /> not yet in cache: http://php.dsi.intra.foncia.net/devche/mantis-log/resources/foncia/images/ui-bg_gloss-wave_45_4779c0_500x100.jpg<br /> image size: 4037

        I’ve tried with the last eval version (3.7.1) but the result is the same.
        Do I have miss something in my process?

        Any help would be appreciate.
        Clemiou

        in reply to: Need to set a different footer for last page
        #28464

        It is not possible for limit footer appearance scope to the last page only.

        Try to define a footnote at the end of the document, instead of a footer.
        footnote text

        in reply to: How to know the total numbe of pages usiong pd4ml java api
        #28463

        You may request the number after pd4ml.render() call:

        System.out.println(“pages: ” + (Long)pd4ml.getLastRenderInfo(PD4Constants.PD4ML_TOTAL_PAGES));

        in reply to: fonts included in the html
        #28465

        HTML does not provide fonts. It only refers to fonts, present on a client PC (where a client browser has physical access to the fonts).

        In order to add fonts to a PDF document, PD4ML needs an access to font files (to parse the TTFs, extract used glyphs and embed the extracted subset to PDF document).

        JVM may use fonts in Java applications, but it offers no access to physical font files. In order to workaround the restriction, you need to accept TTF embedding “complexities”.

        First I would recommend to use the standard font dir.
        pd4ml.useTTF(“/windows/fonts”, true);
        But before you need to index existing fonts with the command line call:
        java -jar pd4ml.jar -configure.fonts /windows/fonts

        After it works you may create a JAR file with selected fonts. But first make sure the above works.

        Also if you want to define document access permissions, you should call setPermissions() method only once:

        pd4ml.setPermissions(“empty”, PD4ML.AllowCopy | PD4ML.AllowModify, false);

        in reply to: dir=rtl is not working
        #28462

        The forthcoming version is intended to resolve the issue.

        in reply to: fonts included in the html
        #28466

        thank you
        so if i do as you say any html tag that contains a font attribute with specific font will be interrepted with the appropriate font that i have just embadded and no need to add any additional code i just need say
        pd4ml.usttf(“windows:fonts”,true);

        thank you

        in reply to: HTML/CSS rendering issues
        #26536

        getiing the following exception

        PWC1406: Servlet.service() for servlet PdfCreater threw exception java.lang.NumberFormatException: For input string: “/F” at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48) at java.lang.Integer.parseInt(Integer.java:449) at org.zefer.pd4ml.pdf.h$_b.o00000(Unknown Source) at org.zefer.pd4ml.pdf.c.O?0000(Unknown Source) at org.zefer.pd4ml.pdf.c.?00000(Unknown Source) at org.zefer.pd4ml.pdf.c.close(Unknown Source) at org.zefer.pd4ml.pdf.PD4Device.dispose(Unknown Source) at org.zefer.pd4ml.PD4ML.o00000(Unknown Source) at org.zefer.pd4ml.PD4ML.render(Unknown Source) at ae.rwd.model.Pdf.convertHtmlToPdf(Pdf.java:79) at ae.rwd.servlet.PdfCreater.processRequest(PdfCreater.java:45) at ae.rwd.servlet.PdfCreater.doPost(PdfCreater.java:65) at javax.servlet.http.HttpServlet.service(HttpServlet.java:754) at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1523) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:188) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:641) at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:97) at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:85) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:185) at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:325) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:226) at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:165) at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:791) at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:693) at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:954) at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:170) at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135) at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102) at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88) at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76) at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53) at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57) at com.sun.grizzly.ContextTask.run(ContextTask.java:69) at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:330) at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:309) at java.lang.Thread.run(Thread.java:662)

        it says that i have an invalid input string that should be number but i dont have and here is my code . please if any body faced this issue before help

        and here is my code

        /*
        * To change this template, choose Tools | Templates
        * and open the template in the editor.
        */
        package ae.rwd.model;

        import java.awt.Dimension;
        import java.awt.Insets;
        import java.io.BufferedReader;
        import java.io.ByteArrayOutputStream;
        import java.io.FileNotFoundException;
        import java.io.IOException;
        import java.io.InputStream;
        import java.io.InputStreamReader;
        import java.io.Reader;
        import java.io.StringWriter;
        import java.io.UnsupportedEncodingException;
        import java.io.Writer;
        import java.net.MalformedURLException;
        import java.net.URL;
        import org.zefer.pd4ml.PD4Constants;
        import org.zefer.pd4ml.PD4ML;
        import org.zefer.pd4ml.PD4PageMark;

        /**
        *
        * @author Anas
        */
        public class Pdf {

        protected static int userSpaceWidth = 638;
        protected static Dimension format = PD4Constants.A4;
        protected static boolean landscapeValue = false;
        protected static int topValue = 10;
        protected static int leftValue = 50;
        protected static int rightValue = 50;
        protected static int bottomValue = 10;

        public static ByteArrayOutputStream convertHtmlToPdf(String bodyUrl, String headerUrl, String footerUrl, String charsetParam) throws MalformedURLException, FileNotFoundException, IOException {

        java.io.ByteArrayOutputStream fos = null;
        PD4ML pd4ml = null;
        PD4PageMark header = null;
        PD4PageMark footer = null;
        String charset = “windows-1256”;
        URL url = new URL(bodyUrl);
        fos = new java.io.ByteArrayOutputStream();
        pd4ml = new PD4ML();

        if (charsetParam != null && charsetParam.trim().length() > 0 && charsetParam.equalsIgnoreCase(“UTF-8”)) {
        charset = “UTF-8”;
        }

        if (headerUrl != null) {
        header = new PD4PageMark();
        header.setHtmlTemplate(getUrlAsStream(headerUrl, charset));
        header.setAreaHeight(-1);
        pd4ml.setPageHeader(header);
        }

        if (footerUrl != null) {
        footer = new PD4PageMark();
        footer.setHtmlTemplate(getUrlAsStream(footerUrl, charset));
        footer.setAreaHeight(-1);
        pd4ml.setPageFooter(footer);
        }

        pd4ml.useTTF(“/WINDOWS/Fonts/”, true);
        //pd4ml.useTTF(“/windows/fonts”, true);
        pd4ml.setDefaultTTFs(“Times New Roman”, “Arial”, “Courier New”);
        //pd4ml.setDefaultTTFs(“Simplified Arabic”, “ae_Arab”, “ae_Nice”);
        pd4ml.setPermissions(“empty”, PD4ML.AllowCopy, false);
        pd4ml.setPermissions(“empty”, PD4ML.AllowModify, false);
        // pd4ml.setPageInsets(new Insets(topValue, leftValue, bottomValue, rightValue));
        pd4ml.setHtmlWidth(userSpaceWidth);
        pd4ml.setPageSize(format);
        pd4ml.adjustHtmlWidth();

        pd4ml.render(url, fos);

        return fos;
        }

        private static String getUrlAsStream(String Url, String charset) throws MalformedURLException, IOException {
        URL url = new URL(Url);
        return convertInputStreamToString(url.openConnection().getInputStream(), charset);
        }

        private static String convertInputStreamToString(InputStream is, String charset) throws IOException, UnsupportedEncodingException {
        /*Anas Ibraheem Alsarairah
        * To convert the InputStream to String we use the
        * Reader.read(char[] buffer) method. We iterate until the
        * Reader return -1 which means there’s no more data to
        * read. We use the StringWriter class to produce the string.
        */
        if (is != null) {
        Writer writer = new StringWriter();
        char[] buffer = new char[1024];
        try {
        Reader reader = new BufferedReader(new InputStreamReader(is, charset));
        int n;
        while ((n = reader.read(buffer)) != -1) {
        writer.write(buffer, 0, n);
        }
        } finally {
        is.close();
        }
        return writer.toString();
        } else {
        return “”;
        }
        }
        }
        any help

        in reply to: Nested CSS definitions not rendered
        #27470

        Pd4ML does support CSS selectors like “.tableclass td”.

        Is this always true with the last version?
        Do you have a reason to not include this feature in PD4ML?

        Thanks a lot for you answers.

        in reply to: Nested CSS definitions not rendered
        #27471

        We had no reason not to include it, so PD4ML does support the feature.

        in reply to: Nested CSS definitions not rendered
        #27472

        @PD4ML wrote:

        We had no reason not to include it, so PD4ML does support the feature.

        So it seems to be the same problem that the first post of this topic.
        My CSS definition is the following:

        .ui-datatable .ui-datatable-data-empty td {
        border-color:inherit;
        border-width: 1px;
        border-style: solid;
        padding:4px 10px 4px 10px;
        }

        It seems to be OK with PD4ML but it doesn’t work.
        If I put the class directly in the HTML element, it works.

        Do you have any idea about this issue?
        Thanks.
        Clemiou

        in reply to: Nested CSS definitions not rendered
        #27473

        Could you please also publish an HTML snippet, you want to apply the CSS to.

        Also, to make sure the CSS selector does not work, try to temporarily add any obvious CSS property, like “color: red”.

        in reply to: fonts included in the html
        #28467

        You need to pass either a directory name of the font dir
        pd4ml.useTTF(“/windows/fonts”,true);
        or refer to a resource, available via the classloader (distinguished by “java:” prefix)
        pd4ml.useTTF(“java:fonts”,true);

        In both cases pd4fonts.properties file has to be generated in advance with
        java -jar pd4ml.jar -configure.fonts …
        call.

      Viewing 15 posts - 1,156 through 1,170 (of 4,234 total)