Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Export2PDF And Our Own Lost Fonts.

    1. SmartClient Version: v8.3p_2013-01-31/PowerEdition Deployment (built 2013-01-31)
    2. FF16
    3. No error logs from the server side.

    Hi,

    I want to export a Canvas as PDF.
    Our skin_style.css has two self-created fonts defined as font-face:

    @font-face {
    font-family: HelveticaNeue;
    src: url('./font/Font-Regular.eot?#iefix') format('eot'),
    url('./font/Font-Regular.ttf') format('truetype');
    }

    After calling RPCManager.exportContent the PDF has been generated but the Fonts weren't found.

    There were taken some fonts from the font-family, that means the skin_style.css was found.

    I suggest the iText didn't find it.

    Could you please give me some advice on it?

    Thanks upfront!

    #2
    Take a look at the docs for PDFExport here - notice all the advice about logs that would indicate image resolution failure. The same potentially applies to fonts specified in CSS. Are you seeing any such logs?

    Comment


      #3
      Hi,

      thank you for your answer.

      I've read the doc for PdfExport but didn't find any information about fonts, only for images. The images are displayed correctly in my PDF.

      My css is defined in the in server.properties as an alternative through the flag:
      skin.Www2.extraStyleSheet: /smartwep/skins/Www2/skin_styles.css

      The ResourceLoader find it, but the fonts are not recognized.

      === 2013-02-08 11:35:28,749 [80-3] INFO PdfExport - CharSet used: UTF-8
      === 2013-02-08 11:35:28,767 [80-3] WARN ResourceLoader - Failed to download file:/C:/dev/apache-tomcat-6.0.36/skin_styles.css: java.io.FileNotFoundException: C:\dev\apache-tomcat-6.0.36\skin_styles.css (The system cannot find the file specified)
      === 2013-02-08 11:35:28,767 [80-3] INFO ResourceLoader - Resource not found in main path. Error: C:\dev\wep\main\src\main\webapp\portal\sc\skins\Www2\skin_styles.css (The system cannot find the path specified). Searching in alternative paths
      === 2013-02-08 11:35:28,768 [80-3] INFO ResourceLoader - Resource 'skin_styles.css' found in an alternative path
      === 2013-02-08 11:35:28,841 [80-1] INFO RequestContext - URL: '/wep/smartwep/skins/Www2/images/FormSectionItem/opener_opened.png', User-Agent: 'Java/1.6.0_37': Unsupported WITHOUT Accept-Encoding header
      === 2013-02-08 11:35:28,843 [80-1] INFO Download - done streaming: C:/dev/wep/main/src/main/webapp/smartwep/skins/Www2/images/FormSectionItem/opener_opened.png
      === 2013-02-08 11:35:28,862 [80-1] INFO RequestContext - URL: '/wep/smartwep/skins/Www2/images/FormSectionItem/opener_closed.png', User-Agent: 'Java/1.6.0_37': Unsupported WITHOUT Accept-Encoding header
      === 2013-02-08 11:35:28,863 [80-1] INFO Download - done streaming: C:/dev/wep/main/src/main/webapp/smartwep/skins/Www2/images/FormSectionItem/opener_closed.png
      === 2013-02-08 11:35:28,866 [80-3] INFO ProxyHttpServletResponse - content-disposition set to: attachment;filename=export.pdf - unwrapping response output stream (CompressionFilter)
      === 2013-02-08 11:35:28,879 [80-3] DEBUG RPCDMI - rpc returned data

      Comment


        #4
        It looks like ITextRenderer allows you to register your fonts with the FontResolver, see this Q&A.

        Please let us know if this works for you, and we'll look at possibly adding more automatic resolution in 4.0.

        Comment


          #5
          Hi,

          thank you for your advice.

          The introduced solution in the forum may work if I create the PDF with the iText, but I still don't want to implement any server logic to create PDFs and use your built-in solution.

          Is there maybe another approach to tell iText about the fonts?

          Thanks,
          zapryano

          Comment


            #6
            Take a look at the docs for PDFExport (previously linked). You just need to add a small amount of DMI logic, there is no need to implement PDF export yourself.

            Comment


              #7
              Hi the fonts were still not found (the reason was not clear).

              I created a separate .css file only for printing into pdf reasons.

              In server.properties:
              skin.Www2.extraStyleSheet: /portal/skins/Www2/skin_styles_pdf.css

              I'm creating the pdf with that separate .css now with Arial, which is always found.

              Cheers,
              zapryano

              Comment


                #8
                Is this intended as something we should look at? You've provided no information to look into at all..

                Comment


                  #9
                  Hi,

                  the problem is now solved for me, I have to maintain two css (one for web and one for pdf) files but that is still acceptable.

                  Thanks,
                  zapryano

                  Comment

                  Working...
                  X