Giter Club home page Giter Club logo

neoflyingsaucer's People

Contributors

beckje01 avatar bluthen avatar cdauth avatar cneijenhuis avatar computerlove avatar danfickle avatar gmottram avatar hrj avatar jensrutschmann avatar julien-gonzalez avatar kschaefe avatar loesak avatar mircea-pop avatar nesteant avatar pbrant avatar pdoubleya avatar scrhartley avatar vianney avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

neoflyingsaucer's Issues

Support for WOFF font format.

Web Open Font Format is now the standard for embedding fonts on the web so we need to support it. Does anybody know of a WOFF to TrueType script in Java? Otherwise, we may need to write one.

Plans for release on maven central?

I'm currently using flying saucer in a project, but would like access to the CSS3 enhancements that you've implemented, and would also like to move away from iText 2. The main reason I haven't made the switch to this project is because I haven't been able to find a maven release and I'd rather not have to build a jar of the library to include as a dependency. Do you have any plans to release through maven central / jcenter / similar?

Thanks for the work you've put into this.

Build on Java 8

I couldn't find jars for this project, so I had to build it by myself, but errors occurred. This thread on stackoverflow did the trick: http://stackoverflow.com/a/16743137

I know you want want to stick with Java 6 for now, but please provide the jars on maven central or use the fix provided on stackoverflow.

By the way, great project, thank you!

Cheers,
André Miranda

Support for CSS3

@habermann24 has done some very good work on the upstream branch:

flyingsaucerproject#22

Are these changes aligned with your direction, and do you think you can pull it into your fork? The changes seem to be straightforward, but there are merge conflicts (because of the switch to Java 1.5, etc).

If you are fine with the changes but don't have time to merge, I can volunteer to do the merge.

Inline styles don't get applied.

Given something like this:

<html>
   <body>
     <div>
       <style> body > div {border:4px solid #555} </style>                          
     </div>
  <body>
</html>

... the style doesn't get applied. Moreover, the text of the style tag gets shown in the output.

Is this expected behavior? I am not sure if inline styles in body are standard compliant, though most browsers seem to support them fine.

CSS Multi-column Layout Module

Hi,
i recently started experimenting with your fork and it work very good so far.
Now i'm trying to produce a PDF from a html page with a double column layout (achieved using the "column-number" property). The page is dynamic, so creating the columns in advance would be tricky.
Is there any chance of having it implemented in the near future? Or do you have a workaround/another way to achieve the same result?

Thx

Added manual test runner, many test failing

IF anyone has got some idle time, I've added a section to the readme as such:

Once you have setup the project and looked at the browser, please consider running the manual test runner located at: com.github.neoflyingsaucer.manualtestrunner in the flying-saucer-examples module. If you can figure out why individual tests are failing, file an issue with details or send a pull request. Thanks.

Q: A new PDF output library.

The issue is that the old IText library is no longer maintained and the author is hostile to open-source projects using it (judging from comments on StackOverflow). He also claims it has unfixed technical problems.

Therefore, I've been looking for an open source project to replace it and came across the open-source version of the PDFJet library. I've uploaded it at pdfstream. It's licensed under a BSD style license.

It doesn't have many of the features that Itext has, such as form components and encryption, but it is mature and looks well written. Have a look and comment if you have an opinion on whether we should switch.

EDIT: I'm working on this in the pdfstream branch.

linear-gradient when height > width renders only until height == width

Happy New Year everyone!
I ran into an issue with linear-gradient backgrounds. The following html is rendered correctly:

<body style="margin: 0">
  <div style="height: 1024px; width: 1024px; background: linear-gradient(180deg, red, green);">
  </div>
</body>

screen shot 2015-01-02 at 12 36 53
Whereas

height: 1024px; width: 512px;

renders incorrectly to:
screen shot 2015-01-02 at 12 36 03
The gradient is cut off at a height of 512px, although the colors have been computed correctly until that point.
The opposite (height smaller than width) works correctly, though: Image
Using a plain color also works fine.

I have a workaround, so it's not a blocker for me currently (= enjoy your holidays :)). I also had a quick look at the code relating to linear-gradient, and I may poke around it more later when I've got more time.
Best,
Chris

Plan to deprecate this repository in favor of openhtmltopdf.

After much soul searching I have decided to deprecate this repository. The core problem was that there has been a huge amount of code churn by me with not much benefit. Churn such as three different PDF output libraries. This churn has introduced many bugs. Also, several bugs have been fixed in FlyingSaucer since this repository was forked (this repository is 92 commits behind).

The good news is that I have learnt a lot about maintaining a large (non web-app) Java code base and I feel I can do a lot better now. Therefore, I have re-forked FlyingSaucer at openhtmltopdf. I have already implemented a PDF-BOX 2 output device, right-to-left (RTL) text support, Jsoup HTML5 parser and more on that repository (without a huge amount of churn). I have also taken the necessary steps to release to maven central and hope to do so in the next week.

Therefore, I strongly encourage you to switch to that repository.

Finally, I'd like to apologise to all those that have contributed to this repository. I can assure you that most of your code will be ported across to openhtmltopdf in the future.

Regards,
Daniel.

PDF forms

This was in the original iText renderer so we could use that code but the PDF output code would have to be changed to use PDF-BOX.

Infinite loop bug (possibly when margins are too large for page).

Test case at:
com.github.neoflyingsaucer.test.pdf.TestPage.testInfiniteLoopBugOnTooWideContent():

    @Test
    @Ignore("Failing (infinite loop somewhere in code)")
    public void testInfiniteLoopBugOnTooWideContent()
    {
        PdfTest pdf = new PdfTest("InfiniteLoopBugOnTooWideContent");

        String html =
            "<html><head><style>" +
            "@page { size: 30px; margin: 0; }" +
            "</style></head><body>" +
            "<ul><li>TEST</li></ul></body></html>";

        pdf.prepare(html);
        pdf.assertContains("/MediaBox");
    }

-webkit-gradient is parsed as URL resource.

A css rule such as:

background-image: -webkit-gradient(
     linear,
     left bottom,
     left top,
     color-stop(0.2, rgba(94, 94, 94, 0.5)),
     color-stop(0.9, rgba(24,24,24, 0.1))
   );

gets parsed as if a URL was specified for the background image. It causes the user agent to start fetching this URL:

http://blahblah/-webkit-gradient(linear, left bottom, left top, color-stop(0.2, rgba(94, 94, 94, 0.5)), color-stop(0.9, rgba(24,24,24, 0.1)));

Only one root element paints background.

This means that html with a background-color or background-image overrides body with same.
Test cases at com.github.neoflyingsaucer.test.BackgroundTest.testBackgroundColorOnBodyAndHtml() and com.github.neoflyingsaucer.test.BackgroundTest.testBackgroundImageOnBodyAndHtml()

See also #33

Implement CSS Media Queries

Media queries allow CSS authors to target specific device features such as display size. They are now heavily used across the web, especially by responsive frameworks such as Bootstrap, and as such should be considered a priority.

I have started implementing media queries in 8fbcb6f (media rule enum and some validation) and this issue will be used to keep track of further commits/ideas, etc.

Inspiration and code can be taken from the WebKit CSS directory, especially files starting with MediaQuery.
https://github.com/WebKit/webkit/tree/master/Source/WebCore/css

Java 8

I've started a java8 branch to see if we can clean up some of the boilerplate by using Java 8 features. Any objections to making this the master branch?

Multiple background images.

Needs to be implemented. Should be pretty straight forward, as all the logic is in AbstractOutputDevice and the CSS background builders.

Test case at com.github.neoflyingsaucer.test.BackgroundTest.testBackgroundImageMultiple()

fallback declarations don't work

In the following:

div {
background: #000;
background: radial-gradient(closest-corner circle at 600px 600px, #001b24 0%, #000 100%);
}

The black background is a fall-back that should be used since radial-gradient is not recognized.

master branch doesn't compile

While compiling with mvn package the build fails with:

[ERROR] /home/ubuntu/shared/flyingsaucerPure/flying-saucer-core/src/main/java/org/xhtmlrenderer/test/DocumentDiffTest.java:[31,31] error: cannot find s
ymbol
[ERROR]   symbol:   class Graphics2DRenderer
  location: package org.xhtmlrenderer.simple

I am just quoting the first error. There are many like these. I tried to move further along by commenting out the test code, but that is leading to a chain of dependencies. I am still trying to hack around it.

Is there a simple way to fix the build (without hacks)?

Thanks,
hrj

Browser demo

Is it possible to have the browser demo in this fork of the project?

Slf4j merge

Hi,

I do use flying saucer library but I don't like jul in the project. What do you think about merging slf4j logging directly into the project? I can send you pull request if you want

ImageRenderer / Java2DRenderer / Graphics2DRenderer

Hi,
I'm looking for a solution to render HTML to images, and this fork has some improvements upon the upstream flyingsaucer that I'm excited about (CSS3, jsoup)!
Anyway, after some initial trouble (maven install failed because of some JavaDoc errors) I tried the ImageRender-example. There seem to be two ways to render the image:

Java2DRenderer: This unfortunately failed because the replacedElementFactory is set to null. There is currently a TODO in the code since 6e46e27

Caused by: java.lang.NullPointerException: replacedElementFactory may not be null
    at org.xhtmlrenderer.layout.SharedContext.setReplacedElementFactory(SharedContext.java:611) ~[flying-saucer-core-9.0.5-SNAPSHOTX.jar:na]
    at org.xhtmlrenderer.swing.Java2DRenderer.init(Java2DRenderer.java:370) ~[flying-saucer-core-9.0.5-SNAPSHOTX.jar:na]

Graphics2DRenderer: Worked fine, however the example refers to it as the old way of doing it, and the class is in the example module whereas the Java2DRenderer is in the core module.

Could someone please explain which class I should prefer / what their differences are? If the Java2DRenderer class is preferable, I'll try to fix the issue, though I'd appreciate any pointers :)

Thanks!

Proposed cleanups

@danfickle What do you think of these proposals:

  • Use enhanced for-loops
  • Remove the log comments at the bottom of files. These seem to be relics from CVS era.
  • Move files in com.github.danfickle.flyingsaucer.swing.test package which are currently under src/main/java into src/test/java
  • Use final wherever possible

If you are fine with it, I will attempt them myself.

Use w3c Document?

The *Panel classes (XHTMLPanel, etc) are using the jsoup Document class. But this class is not a sub-class of org.w3c.dom.Document which is the standard document class in Java for dealing with DOM.

The biggest missing feature in the jsoup Document class is that it doesn't support DOM events, while w3c DOM does.

Using w3c DOM also makes it easy to interoperate with other libraries.

Are you okay to switch to w3c Document for the Panel APIs? Note that JSoup can still be used for parsing. The idea is to convert it to a w3c Document after the parsing is over.

The conversion can be done with a small amount of code. Here is sample code (in Scala) to do the conversion:

  def jsoup2DOM(jsoupDocument: org.jsoup.nodes.Document): Document = {
    val docBuilderFactory = DocumentBuilderFactory.newInstance()
    val docBuilder = docBuilderFactory.newDocumentBuilder()
    val document = docBuilder.newDocument()
    createDOM(jsoupDocument, document, document, new HashMap[String, String]())
    document
  }

  private def createDOM(node: org.jsoup.nodes.Node, out: Node, doc: Document, ns: Map[String, String]) {
    node match {
      case d : org.jsoup.nodes.Document =>
        for (n <- d.childNodes()) {
          createDOM(n, out, doc, ns)
        }
      case e: org.jsoup.nodes.Element =>
        val _e = doc.createElement(e.tagName())
        out.appendChild(_e)
        val atts = e.attributes()
        for (a <- atts) {
          var attName = a.getKey
          if (attName != "xmlns") {
            val attPrefix = getNSPrefix(attName)
            if (attPrefix != null) {
              if (attPrefix == "xmlns") {
                ns.put(getLocalName(attName), a.getValue)
              } else if (attPrefix != "xml") {
                val namespace = ns.get(attPrefix)
                if (namespace == null) {
                  attName = attName.replace(':', '_')
                }
              }
            }
            _e.setAttribute(attName, a.getValue)
            if (attName == "id") {
              _e.setIdAttribute(attName, true)
            }
          }
        }
        for (n <- e.childNodes()) {
          createDOM(n, _e, doc, ns)
        }
      case t:org.jsoup.nodes.TextNode =>
        if (!(out.isInstanceOf[Document])) {
          out.appendChild(doc.createTextNode(t.text()))
        }
      case d:org.jsoup.nodes.DataNode =>
        out.appendChild(doc.createCDATASection(d.getWholeData()))
      case dt:org.jsoup.nodes.DocumentType =>
        println("Doc type: " + dt)
        //TODO
      case _ => throw new Exception("Unexpected node: " + node.getClass) // TODO: NOP
    }
  }

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.