Giter VIP home page Giter VIP logo

cssboxpdf's Introduction

CSSBoxPdf

PDF output renderer for the CSSBox rendering engine.

(c) 2015 Zbynek Cervinka
(c) 2019 Radek Burget

This package adds a PDF output support to CSSBox. It implements an additional renderer that produces a PDF document. The PDF generation is based on the the Apache PDFBox™ library.

See the demo source package for the examples of PDF ouptut generation from CSSBox. Alternatively, the CSSBoxSvg renderer may be used for producing the SVG output.

See the WebVector project If you are looking for a GUI or command line interface for HTML to PDF, SVG or PNG document conversion.

cssboxpdf's People

Contributors

jonesde avatar radkovo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

cssboxpdf's Issues

Guess font name and attribute from file nam is not correct, especially for CJK fonts.

CSSBoxPdf guess font file url by matching file name and font family name. It's not correct especially for CJK font. I suggest using FontMapper to get font.

Change PDFRender#setFont like this. It is still a POC.

    /**
     * Creates object describing font
     * 
     * @return the font object
     */
    private PDFont setFont(String fontFamily, boolean isItalic, boolean isBold)
    {
        COSDictionary dictionary = new COSDictionary();
        dictionary.setItem( COSName.TYPE, COSName.FONT_DESC );
        PDFontDescriptor desc = new PDFontDescriptor(dictionary);
        desc.setItalic(isItalic);
        desc.setFontWeight(isBold? 700: 400);
        desc.setFontFamily(fontFamily);
        FontMapping<TrueTypeFont> trueTypeFont = FontMappers.instance().getTrueTypeFont(fontFamily, desc);

        PDFont font = null;
        if (trueTypeFont != null) {
            try {
                font = PDType0Font.load(doc, trueTypeFont.getFont(), true);
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return font;
    }

Table Cell Shifting on Pagination

Pagination works great for the most part with tables, but there is an issue with cells in a table row shifting (up/down?) separately from other cells in the row.

Attached is a PDF showing this issue. This is rendered using screen for the media type, though the same happens using print. It also seems to happen for all tables regardless of styling and other complexity.

I looked at the code (in PDFRenderer.java) a bit to see if perhaps there was a place that table rows could be handled as a unit instead of individual cells within the row, but it doesn't seem to work this way (or be structured this way). I'm happy to work on this if you have any ideas on how this might be handled.

TableCellShifting_AssetSummary.pdf

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.