An HTML to PDF library for the JVM. Based on Flying Saucer and Apache PDF-BOX 2. With SVG image support. Now also with accessible PDF support (WCAG, Section 508, PDF/UA)!

Overview

build

OPEN HTML TO PDF

OVERVIEW

Open HTML to PDF is a pure-Java library for rendering arbitrary well-formed XML/XHTML (and even HTML5) using CSS 2.1 for layout and formatting, outputting to PDF or images.

Use this library to generated nice looking PDF documents. But be aware that you can not throw modern HTML5+ at this engine and expect a great result. You must special craft the HTML document for this library and use it's extended CSS feature like #31 or #32 to get good results. Avoid floats near page breaks and use table layouts.

GETTING STARTED

DIFFERENCES WITH FLYING SAUCER

  • Uses the well-maintained and open-source (LGPL compatible) PDFBOX as PDF library, rather than iText.
  • Proper support for generating accessible PDFs (Section 508, PDF/UA, WCAG 2.0).
  • Proper support for generating PDF/A standards compliant PDFs.
  • New, faster renderer means this project can be several times faster for very large documents.
  • Better support for CSS3 transforms.
  • Automatic visual regression testing of PDFs, with many end-to-end tests.
  • Ability to insert pages for cut-off content.
  • Built-in plugins for SVG and MathML.
  • Font fallback support.
  • Limited support for RTL and bi-directional documents.
  • On the negative side, no support for OpenType fonts.
  • Much more. See changelog below.

LICENSE

Open HTML to PDF is distributed under the LGPL. Open HTML to PDF itself is licensed under the GNU Lesser General Public License, version 2.1 or later, available at http://www.gnu.org/copyleft/lesser.html. You can use Open HTML to PDF in any way and for any purpose you want as long as you respect the terms of the license. A copy of the LGPL license is included as license-lgpl-2.1.txt or license-lgpl-3.txt in our distributions and in our source tree.

An exception to this is the pdf-a testing module, which is licensed under the GPL. This module is not distributed to Maven Central and is for testing only.

Open HTML to PDF uses a couple of FOSS packages to get the job done. A list of these can be found in the dependency graph.

CREDITS

Open HTML to PDF is based on Flying-saucer. Credit goes to the contributors of that project. Code will also be used from neoFlyingSaucer

FAQ

  • OPEN HTML TO PDF is tested with OpenJDK 8 and 11. We are not currently testing with Oracle JDKs. As of RC18, it requires at least Java 8 to run.
  • No, you can not use it on Android.
  • You should be able to use it on Google App Engine (Java 8 or greater environment). Let us know your experience.
  • Flowing columns are not implemented. Implemented in RC12.
  • No, it's not a web browser. Specifically, it does not run javascript or implement many modern standards such as flex and grid layout.

TEST CASES

Test cases, failing or working are welcome, please place them in /openhtmltopdf-examples/src/main/resources/testcases/ and run them from /openhtmltopdf-examples/src/main/java/com/openhtmltopdf/testcases/TestcaseRunner.java.

CHANGELOG

head - 1.0.7-SNAPSHOT

  • See commit log.

1.0.6 (2020-December-22)

IMPORTANT: #615 This is a bug fix release for an endless loop issue when using break-word with floating elements with a top/bottom margin.

  • #624 Update PDFBOX to 2.0.22 and pdfbox-graphics2d to 0.30. Thanks @rototor.
  • #467 Prevent possibility of CSS import loop.
  • #621 Allow spaces in data uris. Thanks @syjer.

1.0.5 (2020-November-30)

SECURITY: #609 Updates Apache Batik SVG renderer to latest version to avoid security issue. If you are using this project to render untrusted SVGs (advised against), you should update immediately. Thanks a lot @halvorbmundal.

IMPORTANT: The fast renderer is now the default in preparation of removing the old slow renderer. To temporarily use the slow renderer, you can call the deprecated method builder.useSlowMode() (PDF output only).

IMPORTANT: #543 This version stays on PDFBOX version 2.0.20 due to a bug with non-breaking spaces in version 2.0.21. Please make sure version 2.0.21 is not on your classpath. This bug has been fixed in the upcoming 2.0.22.

  • #544 Code to create a website for pre-canned PDF templates in thymeleaf and raw XHTML format. Check out the template website to preview templates.
  • #533 Barcode plugin. Very useful PR supplied by @syjer. Barcode plugin docs.
  • #521 Move Java2D image output to fast renderer and general improvements. Java2D image output docs.
  • 9ffd0e #568 Filter out problematic characters that are visible in some fonts but should not be such as soft-hyphen. Thanks @StephanSchrader.
  • #587 Fix for white-space: nowrap cutting off instead of wrapping. Thanks @vipcxj for finally fixing via PR.
  • #577 Add foreground PDF drawer plugin (useful especially for watermarks). Thanks @rototor for PR and @sillen102 for persisting.
  • #566 Rename baseUri arg to baseDocumentUri and improve javadoc to avoid confusion. Thanks for reporting @NehalDamania.
  • 801780 Update junit test dependency to 4.13.1 to avoid security scanner warnings (the specific security problem did not impact this library).
  • #553 Fix for ContentLimitContainer causing NPEs when negative margins are used. Thanks for reporting @adilxoxo.
  • #552 Optimize the log formatter for j.u.l logging. Thanks for the impressive PR @syjer.
  • #542 Improve list-decoration placement. Thanks for PR @syjer and reporting @mndzielski.
  • #458 Fix for list-decorations being output (clipped) in page margin area.
  • #525 Remove unused schema/DTDs. Significantly reduces size of jar. Thanks for PR @syjer.
  • #592 Allow unit (px, cm, em, etc) values in the width/height attributes of linked SVG images. Thanks @DanielWulfert.
  • #594 #458 Fix for more repeating content and PDF/UA crash. Thanks @ThomHurks, @fungc.
  • #599 Fix RuntimeException ocurring on InlineText.setSubstring. Thanks @LAlves91.
  • #605 Fix to make justification work with surrogate pairs. Thanks @EmanuelCozariz.
  • #601 Move CI to Github actions. Thanks @syjer.
  • #597 Generalize data uri support. Thanks @syjer, @Leostat86.
  • #613 Allow adding fonts for SVG, MathML as files instead of input streams to avoid JDK bug. Thanks @syjer, @sureshkumar-ramalingam, @olayinkasf.

1.0.4 (2020-July-25)

  • b88538 Fix for endless loop when using word-wrap: break-word. Thanks for reporting, testing and investigating @swarl. Thanks for tests and debugging @rototor and @syjer.
  • #492 Lots of testing of the line-breaking algorithm to avoid future endless loops. By @danfickle.
  • #515 Pass document CSS styles applying to SVG element to SVG implementation. Thanks for requesting and contributing @amckain92.
  • #514 FIX: Correctly position boxes when justifying rtl lines. Thanks for reporting and testing @lzhy1101.
  • #512 #507 #502 Cleanup code including deleting unused code, generics, etc. Thanks for PRs @syjer.
  • #489 Extensive overhaul of logging including per run diagnostic consumer. Huge thanks @syjer, a lot of work in this PR. See logging page on wiki for more info.
  • #501 Upgrade PDFBOX to 2.0.20 and PDFBox-Graphics2D to 0.26. Thanks for PR @rototor.
  • #490 Fix for NPE when decoding image data url fails. Thanks for PR @syjer and reporting @AlexisCothenet.
  • #516 Add OSGI bundle metadata to MANIFEST.MFs. Thanks for requesting and investigating @zspitzer.

1.0.3 (2020-May-25)

  • IMPORTANT: This release contains fixes for two bugs that may result in endless loops/denial of service when using word-wrap: break-word. If you are using this feature, please upgrade promptly.
  • #483 Fix for endless loop bug with word-wrap: break-word and soft hyphens. Thanks @rototor for PR, @syjer for analysis and @swarl for reporting.
  • #466 Fix for endless loop bug with word-wrap: break-word and zero width boxes. Thanks @syjer for analysis and @AlexisCothenet for reporting.
  • #486 SVG plugin can now provide a list of allowed protocols for external resources and any configured uri resolver/stream handlers will be used. Thanks @syjer for PR and @ieugen for reporting.
  • #480 Fix for link shapes being returned from custom object drawers. Thanks @rototor for PR and @hbergmey for reporting.
  • #485 Implement support for SVG data uris. Thanks @syjer for PR and @adrianrodfer for reporting.
  • #470 Allow mailto: links or any other valid link. Thanks @syjer for PR and @mndzielski for reporting.
  • #464 Honor the direction CSS property. Thanks @AnanasPizza for reporting.
  • #460 Change thrown exception class to more specific IOException. Thanks for PR @leonorader.
  • #459 Implement the rem CSS unit. Thanks to @leonorader for reporting.
  • #211 Images can now be used in the CSS content property. Thanks for requesting @Kuhlware.
  • #445 Fix for not picking up attribute values in Jsoup converted documents. Thanks for reporting @testinfected.
  • #450 Java2D output only: Ability to add fonts via code. Also environment fonts will no longer be used by default. To use environment fonts: builder.useEnvironmentFonts(true).

1.0.2 (2020-February-25)

  • SECURITY Removed Log4J 1.x adaptor as it had CVE-2019-17571 with no updated version available.
  • #448 Implement linear-gradient support for background-image property. By @danfickle. Requested by @rja907.
  • #429 Major overhaul of word-wrap: break-word. Now a word will not be broken unless it is too big for a line by itself. By @danfickle. Thanks for reporting and testing @mndzielski.
  • #433 Do not justify lines ending with <br/> tag. Thanks for reporting @fcorneli.
  • #440 Remove trailing white space for right aligned text to avoid jagged appearance. Thanks for reporting @AnanasPizza.
  • #446 Look for lang attribute on ancestor elements when using lang() selector. Thanks for reporting and tracking down the bug @fungc.
  • #430 Use relative path to license in source jars instead of absolute path. Thanks for reporting @gabro and fixing via PR @syjer.
  • #417 Keep aspect ratio of images with width/height properties as well as min/max width/height properties. Thanks for reporting and basis for fix @swarl.
  • #423 Allow multiple font sources to be specified with format tags. Only use format(truetype). Thanks for requesting @MichaelZaleskovsky and basis for implementation @syjer.
  • #415 Avoid class cast exception if user tries to float table cell. Thanks for reporting @dmartineau99 and PR @syjer.
  • #421 Avoid NPE when justified text is mixed with unjustifiable content. Thanks for reporting @Megingjard and PR @syjer.
  • Updated PDFBOX 2.0.17 to 2.0.19.

1.0.1 (2019-November-18)

  • #413 Handle form problems such as no name on input element without throwing a NPE. Thanks @syjer for PR and @mmatecki for reporting.
  • #412 Add HTML block level elements usch as section to default CSS. Thanks @syjer.
  • #339 Remove the JSoup to DOM converter module. Thanks @kewilson.
  • 0cd098 Fix for letter-spacing support on last line of block with trailing space. Also performance improvements and refactoring. By @danfickle.
  • #410 Fix for wrong bold setting on list item counters. Thanks @syjer for PR fix (and test!) and @acieplinski for reporting.
  • Wiki Configurable text justification settings as part of a justification overhaul that also allows more space to be used inter-char when there are no spaces on the line. By @danfickle. Commits listed in #403.
  • #403 Soft hyphen support. Soft hyphens are now replaced with hard hyphens when used as line ending character. Thanks @sbrunecker.
  • #408 Fix for bookmarks not working with HTML5 parsers such as JSoup. Thanks @syjer for investigating and fixing and @Milchreis for reporting.
  • #404 Upgrade Batik to 1.12 and xmlgraphics-common to 2.4 (both used in SVG module) to avoid CVE in one or both. Thanks @avoiculet.
  • #396 Much faster rendering of boxes using border-radius properties. Thanks @mndzielski.
  • #400 Support for lang and title attrbiutes and abbr tag for accessible PDFs. Thanks @Ignaciort91.
  • #394, #395 Upgrade PDFBOX to 2.0.17 and pdfbox-graphics2d to 0.25. Thanks @cristan, @rototor.
  • #384 Allow user to provide PDFont supplier. Thanks @DSW-PS.
  • #373 Fix regression where both max-width and max-height are provided for images with certain aspect ratios. Thanks @rototor.
  • #380 Much better support for flowing columns including explicit column breaks, floating content, block level nested content. By @danfickle.

1.0.0 (2019-July-23)

  • #372 Much improved sizing support for img, svg and math elements.
  • #344 Use PDFs in img tag: <img src="some.pdf" page="1" alt="Some alt text" />.

0.0.1-RC21 (2019-June-29)

  • #361 The SVG renderer now uses Batik in a more secure mode (no scripts, no external resource requests) by default. If you need the old behavior that allowed external resource requests and possibly scripts, please see the new BatikSVGDrawer constructor (only for trusted SVGs). Thanks @krabbenpuler.
  • #363 Upgrade PDFBOX to 2.0.16. Thanks @rototor.
  • #353 Better error handling around SVGs linked from img tag. Thanks @ieugen.
  • #342 Fixed text-justification/letter-spacing when fallback fonts are in use. Thanks @daliuss.
  • #351 Improved text-justification by removing spaces at ends of lines. Thanks @halcsi.

0.0.1-RC20 (2019-April-26)

IMPORTANT: This release was brought forward due to a CVE in PDFBOX. While not directly affecting this project (it affects parsing of untrusted PDFs), it is better not to have a vulnerable library on your classpath.

  • #349 Upgrade PDF-BOX to 2.0.15 to avoid CVE in 2.0.14. Thanks @BryceMehring.
  • #347 Add document language and title preference for PDF/A documents to satisfy Acrobat Pro validator. Thanks @mattstjean.
  • #339 Mark Jsoup DOM converter module as deprecated (for removal). Please see integration guide for replacement. This module may also pull in an insecure version of Guava so please migrate now.

0.0.1-RC19 (2019-March-18)

  • #336 Fix for broken image links causing an NPE. Thanks @svenfrauen.
  • #334 Allow the user to supply PDPage objects via page supplier. Thanks @DSW-PS.

0.0.1-RC18 (2019-March-10)

  • Please start using the fast renderer (builder.useFastMode()) as the old renderer will be removed in a future version.
  • #180 Fast renderer is finally ready for production. The fast renderer comes with:
    • Nearly 150 automated end-to-end regression tests. This is about 150 more than the old renderer.
    • Improved performance. This renderer scales linearly with the number of pages, compared to the old renderer which scaled with the page count squared.
    • Far better support for transforms, including nested transforms, multiple transforms and transforms interacting with hidden overflow, etc.
    • Better support for hidden overflow, with boxes now not escaping except with accordance to the standard.
    • Support for inserted cut off overflow pages. See Cut-off page support on the wiki.
    • Link areas and their hash link targets now repect transforms.
    • Bookmark targets now respect transforms.
    • Improved page placement for boxes. Now respects overflow and tranform properties.
    • Greater understanding which should make fixes and feature improvements easier.
  • Visual testing API is now available to use in the PDFBOX module. Please see testing your PDF on the wiki. Thanks @red6.
  • #333 Upgraded PDFBox to 2.0.14 and PDFBox-Graphics2D to 0.21.
  • #315, #79 Accessible and tagged PDF support. See PDF Accessibility (PDF UA, WCAG, Section 508) Support on the wiki.
  • #326 Proper support for PDF/A standards with automatic regression testing. See PDF/A Standards Compliance on the wiki.
  • #328 SVG with page rule was crashing in certain circumstances.
  • #324 Better logging with invalid or missing fonts.
  • #320 NPE prevention in case of incorrect font configuration.
  • a145329 Were using incorrect font-metrics in certain situations.
  • #303 Fixed: Table borders are partly transparent.
  • #297 Fixed: Border not printed with "overflow: hidden".
  • #304 Fix warnings for icon font without space inside PDF/A, add tests.
  • #301 Make loading resources from classpath work when openhtmltopdf is a named module.
  • #232 Were using JRE internal APIs.
  • #289 System.out.println("Getting image") in NaiveUserAgent.

Thanks to these people for pull-requests:

  • @rototor
  • @brundipub
  • @zimmi
  • @dnguyenminh

Finally, a big thanks to all issue reporters and extra thanks to those who help out in issues.

OLDER RELEASES

View CHANGELOG.md.

Comments
  • Right side border missing in pdf (for foreign language)

    Right side border missing in pdf (for foreign language)

    I am generating pdf from html. The html file looks good but in my pdf I see the right side border is missing. Please help. Attached the partial image of the same

    Screen Shot 2020-08-04 at 7 10 19 AM
    opened by sunithapremkumar 30
  • Base 64 encoded Image does not load in pdf

    Base 64 encoded Image does not load in pdf

    Hi,

    I have a Base 64 encoded image in my html file. The image I need to have in the pdf. But I get error like

    com.openhtmltopdf.exception WARNING:: When trying to load uri(data:image/png .....) com.openhtmltopdf.load INFO:: URI resolver rejected loading image at (data:image/png ....)

    If Base 64 image is not supported yet, can you please let me know how an image can be converted from html to pdf.

    Thanks, Chandrani

    opened by chandrani0702 29
  • Large HTML File conversion to PDF hangs.

    Large HTML File conversion to PDF hangs.

    Hi,

    I am trying to convert large HTML File approximately 600 pages which is not passing the conversion and hangs.

    Following is my observation after debugging the core. PdfRendererBuilder.class file has following method call.

    1. renderer.layout(); // This action takes significant time but completes the process. 2. renderer.createPDF(); // This action is not completing its execution and hangs the process.

    when I looked into it renderer.createPDF() is trying to create entire PDF in memory (document) and after completion it starts writing to OutputStream.

    Can we write it directly to OutputStream page by page? I think this might solve the problem.

    Following is my code snippet please check the same if I am doing anything wrong here.

    public void exportToPdf(List<Map<String, Object>> data, String template, Map<String, Object> exportData,
                Configuration cfg, String pdfURL) throws Exception   {
            File exportedPdfFile = null;
            File exportedPdfFileTemp = null;
            FileChannel pdfFileSrcIS = null;
            FileChannel pdfFileDestOS = null;
            FileOutputStream tmpFileOS = null;
            BufferedOutputStream tmpFileBOS = null;
            FileInputStream pdfSrcIS = null;
            FileOutputStream exportedPdfFileOs = null;
            try {
                // Create New File
                exportedPdfFileTemp = new File(pdfURL + "_" + TEMP);
                LOGGER.info("### Temp PDF File Name After Creation :::" + pdfURL + "_" + TEMP);
                
                tmpFileOS = new FileOutputStream(exportedPdfFileTemp);
                tmpFileBOS = new BufferedOutputStream(tmpFileOS);
                // Create Builder
                PdfRendererBuilder builder = new PdfRendererBuilder();
                addFonts(builder);
                // Generate HTML Template String
                String htmlTemplateString = generateHtmlFromTemplate(data, template, exportData, cfg);
                // Generate Doc from the HTML string
                Document doc = html5ParseDocument(htmlTemplateString, PDF_GENERATION_TIMEOUT);// builder.withUri(url);
                builder.withW3cDocument(doc, null);
                // Write the PDF to file
                builder.toStream(tmpFileBOS);
                builder.run();
    
                LOGGER.info("::: PDF Generation Successful with :::");
    
                    exportedPdfFile = new File(pdfURL);
                    
                    if (exportedPdfFileTemp.renameTo(exportedPdfFile)) {
                        LOGGER.info("### Temp FILE Renamed To ::: " + pdfURL );
                    } else {
                        LOGGER.info("### Temp FILE Rename Failed Creating New File ::: " + pdfURL);
                        pdfSrcIS = new FileInputStream(exportedPdfFileTemp);
                        pdfFileSrcIS = pdfSrcIS.getChannel();
                        exportedPdfFileOs = new FileOutputStream(exportedPdfFile);  
                        pdfFileDestOS = exportedPdfFileOs.getChannel();
                        LOGGER.info("### Starting Copy Operation ::: " + pdfURL);
                        pdfFileDestOS.transferFrom(pdfFileSrcIS, 0, pdfFileSrcIS.size());
                        LOGGER.info("### Copy Operation Completed ::: " + pdfURL);
                    }
    
                    LOGGER.info("### *** File Created *** ::: " + pdfURL);
                    LOGGER.info("### PDF Created successfully!");
    
            } catch (Exception e) {
                LOGGER.error("Error generating PDF :" + e.getMessage(), e);
                throw e;
            } finally {
                LOGGER.info("### PDF Created successfully with Name ::: " + pdfURL);
                // Close all streams
    
                if (exportedPdfFileOs != null) {
                    org.apache.commons.io.IOUtils.closeQuietly(exportedPdfFileOs);
                }
                if (pdfSrcIS != null) {
                    org.apache.commons.io.IOUtils.closeQuietly(pdfSrcIS);
                }
                
                if (tmpFileBOS != null) {
                    org.apache.commons.io.IOUtils.closeQuietly(tmpFileBOS);
                }
                if (tmpFileOS != null) {
                    org.apache.commons.io.IOUtils.closeQuietly(tmpFileOS);
                }
                // Clean after creation
                try {
                    if (exportedPdfFileTemp.isFile()) {
                        if (exportedPdfFileTemp.delete()) {
                            LOGGER.info("### Temp PDF File :::" + exportedPdfFileTemp.getName() + " is deleted!");
                        } else {
                            LOGGER.error("Temp File Delete operation is failed.");
                        }
                    }
    
                } catch (Exception deleteException) {
                    LOGGER.error("Error Deleting Temp File!  Name :::" + pdfURL + deleteException.getMessage());
                }
            }
        }
    

    In above code snippet it is not completing builder.run(); process and hangs.

    Please help me with the solution.

    Thanks in advance.

    opened by rajaningle 25
  • Thread is stuck during HTML to PDF conversion with nested tables for fairly large HTML

    Thread is stuck during HTML to PDF conversion with nested tables for fairly large HTML

    Update 9/23/20: The first two HTML files I attached are misleading and work as expected. I found that the problem is actually occurring only when the height/max-height of the div enclosing the table is set to "auto": image

    @syjer Try this new HTML file attached, it should reproduce the issue for you as well. Sorry about the confusion with the previous test cases. FYI running this in my minimal test application using this HTML file was 90,087ms which is consistent with the results I see inside of my program. smaller_test_auto_height.txt

    Original Issue/info below, the stack trace thread dump info applies to the "smaller_test_auto_height.txt" test case since my proram was using this "auto" height all along (which I wasn't aware of ?? ):

    Currently our HTML target is email, so we are using a lot of HTML table elements, nested and everything is inline styles. I suspect that I have a thread hanging due to the nested tables. Unfortunately I'm not sure what I can do to work around this issue. I've tried "table-layout: fixed" and assigning column widths as well.

    Update: made sure that it is valid XHTML as well using https://validator.w3.org/: problem_html1.txt

    Here is also a smaller test html that is still painfully slow (~1.5-2 minutes). It is the same content, just reduced the number of table rows to 71 for easier visibility: smaller_test.txt

    If I enable logging I see infinite messages as follow:

    com.openhtmltopdf.cascade FINEST:: min-height, relative= 0.0 (0), absolute= 0.0 using base=460.0
    com.openhtmltopdf.cascade FINEST:: text-indent, relative= 0.0 (0), absolute= 0.0 using base=0.0
    com.openhtmltopdf.cascade FINEST:: min-width, relative= 0.0 (0), absolute= 0.0 using base=0.0
    com.openhtmltopdf.cascade FINEST:: min-width, relative= 0.0 (0), absolute= 0.0 using base=0.0
    com.openhtmltopdf.cascade FINEST:: height, relative= 23.0 (23px), absolute= 460.0 using base=0.0
    com.openhtmltopdf.cascade FINEST:: min-height, relative= 0.0 (0), absolute= 0.0 using base=460.0
    com.openhtmltopdf.cascade FINEST:: text-indent, relative= 0.0 (0), absolute= 0.0 using base=0.0
    com.openhtmltopdf.cascade FINEST:: min-width, relative= 0.0 (0), absolute= 0.0 using base=0.0
    com.openhtmltopdf.cascade FINEST:: min-width, relative= 0.0 (0), absolute= 0.0 using base=0.0
    com.openhtmltopdf.cascade FINEST:: height, relative= 23.0 (23px), absolute= 460.0 using base=0.0
    

    Thread dump shows this stack:

    "http-bio-8080-exec-10" #204 daemon prio=5 os_prio=31 tid=0x00007fa152c59000 nid=0x13803 runnable [0x0000700014582000]
       java.lang.Thread.State: RUNNABLE
            at org.apache.juli.ClassLoaderLogManager.getLogger(ClassLoaderLogManager.java:229)
            - locked <0x00000006c01af2f0> (a org.apache.juli.ClassLoaderLogManager)
            at java.util.logging.LogManager.demandLogger(LogManager.java:551)
            at java.util.logging.Logger.demandLogger(Logger.java:455)
            at java.util.logging.Logger.getLogger(Logger.java:502)
            at com.openhtmltopdf.util.JDKXRLogger.getLogger(JDKXRLogger.java:103)
            at com.openhtmltopdf.util.JDKXRLogger.isLogLevelEnabled(JDKXRLogger.java:75)
            at com.openhtmltopdf.util.XRLog.log(XRLog.java:122)
            at com.openhtmltopdf.util.XRLog.log(XRLog.java:113)
            at com.openhtmltopdf.css.style.derived.LengthValue.calcFloatProportionalValue(LengthValue.java:204)
            at com.openhtmltopdf.css.style.derived.LengthValue.getFloatProportionalTo(LengthValue.java:80)
            at com.openhtmltopdf.css.style.CalculatedStyle.getFloatPropertyProportionalTo(CalculatedStyle.java:437)
            at com.openhtmltopdf.css.style.CalculatedStyle.getMinHeight(CalculatedStyle.java:1174)
            at com.openhtmltopdf.render.BlockBox.getCSSMinHeight(BlockBox.java:1628)
            at com.openhtmltopdf.render.BlockBox.applyCSSMinMaxHeight(BlockBox.java:1172)
            at com.openhtmltopdf.render.BlockBox.layout(BlockBox.java:1074)
            at com.openhtmltopdf.newtable.TableRowBox.layoutCell(TableRowBox.java:452)
            at com.openhtmltopdf.newtable.TableRowBox.layoutChildren(TableRowBox.java:206)
            at com.openhtmltopdf.render.BlockBox.layout(BlockBox.java:1058)
            at com.openhtmltopdf.newtable.TableRowBox.layout(TableRowBox.java:95)
            at com.openhtmltopdf.render.BlockBox.layout(BlockBox.java:973)
            at com.openhtmltopdf.layout.BlockBoxing.layoutBlockChild0(BlockBoxing.java:321)
            at com.openhtmltopdf.layout.BlockBoxing.layoutBlockChild(BlockBoxing.java:299)
            at com.openhtmltopdf.layout.BlockBoxing.layoutContent(BlockBoxing.java:90)
            at com.openhtmltopdf.render.BlockBox.layoutChildren(BlockBox.java:1204)
            at com.openhtmltopdf.newtable.TableSectionBox.layoutChildren(TableSectionBox.java:137)
            at com.openhtmltopdf.render.BlockBox.layout(BlockBox.java:1058)
            at com.openhtmltopdf.newtable.TableSectionBox.layout(TableSectionBox.java:278)
            at com.openhtmltopdf.render.BlockBox.layout(BlockBox.java:973)
            at com.openhtmltopdf.layout.BlockBoxing.layoutBlockChild0(BlockBoxing.java:321)
            at com.openhtmltopdf.layout.BlockBoxing.layoutBlockChild(BlockBoxing.java:299)
            at com.openhtmltopdf.layout.BlockBoxing.layoutContent(BlockBoxing.java:90)
            at com.openhtmltopdf.render.BlockBox.layoutChildren(BlockBox.java:1204)
            at com.openhtmltopdf.newtable.TableBox.layoutChildren(TableBox.java:319)
            at com.openhtmltopdf.render.BlockBox.layout(BlockBox.java:1058)
            at com.openhtmltopdf.render.BlockBox.layout(BlockBox.java:973)
            at com.openhtmltopdf.newtable.TableBox.layoutTable(TableBox.java:284)
            at com.openhtmltopdf.newtable.TableBox.layout(TableBox.java:243)
            at com.openhtmltopdf.layout.BlockBoxing.layoutBlockChild0(BlockBoxing.java:321)
            at com.openhtmltopdf.layout.BlockBoxing.layoutBlockChild(BlockBoxing.java:299)
            at com.openhtmltopdf.layout.BlockBoxing.layoutContent(BlockBoxing.java:109)
            at com.openhtmltopdf.render.BlockBox.layoutChildren(BlockBox.java:1204)
            at com.openhtmltopdf.render.BlockBox.layout(BlockBox.java:1058)
            at com.openhtmltopdf.render.BlockBox.layout(BlockBox.java:973)
            at com.openhtmltopdf.layout.BlockBoxing.layoutBlockChild0(BlockBoxing.java:321)
            at com.openhtmltopdf.layout.BlockBoxing.layoutBlockChild(BlockBoxing.java:299)
            at com.openhtmltopdf.layout.BlockBoxing.layoutContent(BlockBoxing.java:109)
            at com.openhtmltopdf.render.BlockBox.layoutChildren(BlockBox.java:1204)
            at com.openhtmltopdf.render.BlockBox.layout(BlockBox.java:1058)
            at com.openhtmltopdf.newtable.TableRowBox.layoutCell(TableRowBox.java:452)
            at com.openhtmltopdf.newtable.TableRowBox.layoutChildren(TableRowBox.java:206)
            at com.openhtmltopdf.render.BlockBox.layout(BlockBox.java:1058)
            at com.openhtmltopdf.newtable.TableRowBox.layout(TableRowBox.java:95)
            at com.openhtmltopdf.render.BlockBox.layout(BlockBox.java:973)
            at com.openhtmltopdf.layout.BlockBoxing.layoutBlockChild0(BlockBoxing.java:321)
            at com.openhtmltopdf.layout.BlockBoxing.layoutBlockChild(BlockBoxing.java:299)
            at com.openhtmltopdf.layout.BlockBoxing.layoutContent(BlockBoxing.java:103)
            at com.openhtmltopdf.render.BlockBox.layoutChildren(BlockBox.java:1204)
            at com.openhtmltopdf.newtable.TableSectionBox.layoutChildren(TableSectionBox.java:137)
            at com.openhtmltopdf.render.BlockBox.layout(BlockBox.java:1058)
            at com.openhtmltopdf.newtable.TableSectionBox.layout(TableSectionBox.java:278)
            at com.openhtmltopdf.render.BlockBox.layout(BlockBox.java:973)
            at com.openhtmltopdf.layout.BlockBoxing.layoutBlockChild0(BlockBoxing.java:321)
            at com.openhtmltopdf.layout.BlockBoxing.layoutBlockChild(BlockBoxing.java:299)
            at com.openhtmltopdf.layout.BlockBoxing.layoutContent(BlockBoxing.java:103)
            at com.openhtmltopdf.render.BlockBox.layoutChildren(BlockBox.java:1204)
            at com.openhtmltopdf.newtable.TableBox.layoutChildren(TableBox.java:319)
            at com.openhtmltopdf.render.BlockBox.layout(BlockBox.java:1058)
            at com.openhtmltopdf.render.BlockBox.layout(BlockBox.java:973)
            at com.openhtmltopdf.newtable.TableBox.layoutTable(TableBox.java:284)
            at com.openhtmltopdf.newtable.TableBox.layout(TableBox.java:243)
            at com.openhtmltopdf.layout.BlockBoxing.layoutBlockChild0(BlockBoxing.java:321)
            at com.openhtmltopdf.layout.BlockBoxing.layoutBlockChild(BlockBoxing.java:299)
            at com.openhtmltopdf.layout.BlockBoxing.layoutContent(BlockBoxing.java:103)
            at com.openhtmltopdf.render.BlockBox.layoutChildren(BlockBox.java:1204)
            at com.openhtmltopdf.render.BlockBox.layout(BlockBox.java:1058)
            at com.openhtmltopdf.newtable.TableRowBox.layoutCell(TableRowBox.java:452)
            at com.openhtmltopdf.newtable.TableRowBox.layoutChildren(TableRowBox.java:206)
            at com.openhtmltopdf.render.BlockBox.layout(BlockBox.java:1058)
            at com.openhtmltopdf.newtable.TableRowBox.layout(TableRowBox.java:95)
            at com.openhtmltopdf.render.BlockBox.layout(BlockBox.java:973)
            at com.openhtmltopdf.layout.BlockBoxing.layoutBlockChild0(BlockBoxing.java:321)
            at com.openhtmltopdf.layout.BlockBoxing.layoutBlockChild(BlockBoxing.java:299)
            at com.openhtmltopdf.layout.BlockBoxing.layoutContent(BlockBoxing.java:103)
            at com.openhtmltopdf.render.BlockBox.layoutChildren(BlockBox.java:1204)
            at com.openhtmltopdf.newtable.TableSectionBox.layoutChildren(TableSectionBox.java:137)
            at com.openhtmltopdf.render.BlockBox.layout(BlockBox.java:1058)
            at com.openhtmltopdf.newtable.TableSectionBox.layout(TableSectionBox.java:278)
            at com.openhtmltopdf.render.BlockBox.layout(BlockBox.java:973)
            at com.openhtmltopdf.layout.BlockBoxing.layoutBlockChild0(BlockBoxing.java:321)
            at com.openhtmltopdf.layout.BlockBoxing.layoutBlockChild(BlockBoxing.java:299)
            at com.openhtmltopdf.layout.BlockBoxing.layoutContent(BlockBoxing.java:109)
            at com.openhtmltopdf.render.BlockBox.layoutChildren(BlockBox.java:1204)
            at com.openhtmltopdf.newtable.TableBox.layoutChildren(TableBox.java:319)
            at com.openhtmltopdf.render.BlockBox.layout(BlockBox.java:1058)
            at com.openhtmltopdf.render.BlockBox.layout(BlockBox.java:973)
            at com.openhtmltopdf.newtable.TableBox.layoutTable(TableBox.java:284)
            at com.openhtmltopdf.newtable.TableBox.layout(TableBox.java:243)
            at com.openhtmltopdf.layout.BlockBoxing.layoutBlockChild0(BlockBoxing.java:321)
            at com.openhtmltopdf.layout.BlockBoxing.layoutBlockChild(BlockBoxing.java:299)
            at com.openhtmltopdf.layout.BlockBoxing.layoutContent(BlockBoxing.java:109)
            at com.openhtmltopdf.render.BlockBox.layoutChildren(BlockBox.java:1204)
            at com.openhtmltopdf.render.BlockBox.layout(BlockBox.java:1058)
            at com.openhtmltopdf.newtable.TableRowBox.layoutCell(TableRowBox.java:452)
            at com.openhtmltopdf.newtable.TableRowBox.layoutChildren(TableRowBox.java:206)
            at com.openhtmltopdf.render.BlockBox.layout(BlockBox.java:1058)
            at com.openhtmltopdf.newtable.TableRowBox.layout(TableRowBox.java:95)
            at com.openhtmltopdf.render.BlockBox.layout(BlockBox.java:973)
            at com.openhtmltopdf.layout.BlockBoxing.layoutBlockChild0(BlockBoxing.java:321)
            at com.openhtmltopdf.layout.BlockBoxing.layoutBlockChild(BlockBoxing.java:299)
            at com.openhtmltopdf.layout.BlockBoxing.layoutContent(BlockBoxing.java:109)
            at com.openhtmltopdf.render.BlockBox.layoutChildren(BlockBox.java:1204)
            at com.openhtmltopdf.newtable.TableSectionBox.layoutChildren(TableSectionBox.java:137)
            at com.openhtmltopdf.render.BlockBox.layout(BlockBox.java:1058)
            at com.openhtmltopdf.newtable.TableSectionBox.layout(TableSectionBox.java:278)
            at com.openhtmltopdf.render.BlockBox.layout(BlockBox.java:973)
            at com.openhtmltopdf.layout.BlockBoxing.layoutBlockChild0(BlockBoxing.java:321)
            at com.openhtmltopdf.layout.BlockBoxing.layoutBlockChild(BlockBoxing.java:299)
            at com.openhtmltopdf.layout.BlockBoxing.layoutContent(BlockBoxing.java:103)
            at com.openhtmltopdf.render.BlockBox.layoutChildren(BlockBox.java:1204)
            at com.openhtmltopdf.newtable.TableBox.layoutChildren(TableBox.java:319)
            at com.openhtmltopdf.render.BlockBox.layout(BlockBox.java:1058)
            at com.openhtmltopdf.render.BlockBox.layout(BlockBox.java:973)
            at com.openhtmltopdf.newtable.TableBox.layoutTable(TableBox.java:284)
            at com.openhtmltopdf.newtable.TableBox.layout(TableBox.java:243)
            at com.openhtmltopdf.layout.BlockBoxing.layoutBlockChild0(BlockBoxing.java:321)
            at com.openhtmltopdf.layout.BlockBoxing.layoutBlockChild(BlockBoxing.java:299)
            at com.openhtmltopdf.layout.BlockBoxing.layoutContent(BlockBoxing.java:103)
            at com.openhtmltopdf.render.BlockBox.layoutChildren(BlockBox.java:1204)
            at com.openhtmltopdf.render.BlockBox.layout(BlockBox.java:1058)
            at com.openhtmltopdf.newtable.TableRowBox.layoutCell(TableRowBox.java:452)
            at com.openhtmltopdf.newtable.TableRowBox.layoutChildren(TableRowBox.java:206)
            at com.openhtmltopdf.render.BlockBox.layout(BlockBox.java:1058)
            at com.openhtmltopdf.newtable.TableRowBox.layout(TableRowBox.java:95)
            at com.openhtmltopdf.render.BlockBox.layout(BlockBox.java:973)
            at com.openhtmltopdf.layout.BlockBoxing.layoutBlockChild0(BlockBoxing.java:321)
            at com.openhtmltopdf.layout.BlockBoxing.layoutBlockChild(BlockBoxing.java:299)
            at com.openhtmltopdf.layout.BlockBoxing.layoutContent(BlockBoxing.java:103)
            at com.openhtmltopdf.render.BlockBox.layoutChildren(BlockBox.java:1204)
            at com.openhtmltopdf.newtable.TableSectionBox.layoutChildren(TableSectionBox.java:137)
            at com.openhtmltopdf.render.BlockBox.layout(BlockBox.java:1058)
            at com.openhtmltopdf.newtable.TableSectionBox.layout(TableSectionBox.java:278)
            at com.openhtmltopdf.render.BlockBox.layout(BlockBox.java:973)
            at com.openhtmltopdf.layout.BlockBoxing.layoutBlockChild0(BlockBoxing.java:321)
            at com.openhtmltopdf.layout.BlockBoxing.layoutBlockChild(BlockBoxing.java:299)
            at com.openhtmltopdf.layout.BlockBoxing.layoutContent(BlockBoxing.java:103)
            at com.openhtmltopdf.render.BlockBox.layoutChildren(BlockBox.java:1204)
            at com.openhtmltopdf.newtable.TableBox.layoutChildren(TableBox.java:319)
            at com.openhtmltopdf.render.BlockBox.layout(BlockBox.java:1058)
            at com.openhtmltopdf.render.BlockBox.layout(BlockBox.java:973)
            at com.openhtmltopdf.newtable.TableBox.layoutTable(TableBox.java:284)
            at com.openhtmltopdf.newtable.TableBox.layout(TableBox.java:243)
            at com.openhtmltopdf.layout.BlockBoxing.layoutBlockChild0(BlockBoxing.java:321)
            at com.openhtmltopdf.layout.BlockBoxing.layoutBlockChild(BlockBoxing.java:299)
            at com.openhtmltopdf.layout.BlockBoxing.layoutContent(BlockBoxing.java:90)
            at com.openhtmltopdf.render.BlockBox.layoutChildren(BlockBox.java:1204)
            at com.openhtmltopdf.render.BlockBox.layout(BlockBox.java:1058)
            at com.openhtmltopdf.newtable.TableRowBox.layoutCell(TableRowBox.java:452)
            at com.openhtmltopdf.newtable.TableRowBox.layoutChildren(TableRowBox.java:206)
            at com.openhtmltopdf.render.BlockBox.layout(BlockBox.java:1058)
            at com.openhtmltopdf.newtable.TableRowBox.layout(TableRowBox.java:95)
            at com.openhtmltopdf.render.BlockBox.layout(BlockBox.java:973)
            at com.openhtmltopdf.layout.BlockBoxing.layoutBlockChild0(BlockBoxing.java:321)
            at com.openhtmltopdf.layout.BlockBoxing.layoutBlockChild(BlockBoxing.java:299)
            at com.openhtmltopdf.layout.BlockBoxing.layoutContent(BlockBoxing.java:90)
            at com.openhtmltopdf.render.BlockBox.layoutChildren(BlockBox.java:1204)
            at com.openhtmltopdf.newtable.TableSectionBox.layoutChildren(TableSectionBox.java:137)
            at com.openhtmltopdf.render.BlockBox.layout(BlockBox.java:1058)
            at com.openhtmltopdf.newtable.TableSectionBox.layout(TableSectionBox.java:278)
            at com.openhtmltopdf.render.BlockBox.layout(BlockBox.java:973)
            at com.openhtmltopdf.layout.BlockBoxing.layoutBlockChild0(BlockBoxing.java:321)
            at com.openhtmltopdf.layout.BlockBoxing.layoutBlockChild(BlockBoxing.java:299)
            at com.openhtmltopdf.layout.BlockBoxing.layoutContent(BlockBoxing.java:90)
            at com.openhtmltopdf.render.BlockBox.layoutChildren(BlockBox.java:1204)
            at com.openhtmltopdf.newtable.TableBox.layoutChildren(TableBox.java:319)
            at com.openhtmltopdf.render.BlockBox.layout(BlockBox.java:1058)
            at com.openhtmltopdf.render.BlockBox.layout(BlockBox.java:973)
            at com.openhtmltopdf.newtable.TableBox.layoutTable(TableBox.java:284)
            at com.openhtmltopdf.newtable.TableBox.layout(TableBox.java:243)
            at com.openhtmltopdf.layout.BlockBoxing.layoutBlockChild0(BlockBoxing.java:321)
            at com.openhtmltopdf.layout.BlockBoxing.layoutBlockChild(BlockBoxing.java:299)
            at com.openhtmltopdf.layout.BlockBoxing.layoutContent(BlockBoxing.java:90)
            at com.openhtmltopdf.render.BlockBox.layoutChildren(BlockBox.java:1204)
            at com.openhtmltopdf.render.BlockBox.layout(BlockBox.java:1058)
            at com.openhtmltopdf.render.BlockBox.layout(BlockBox.java:973)
            at com.openhtmltopdf.layout.BlockBoxing.layoutBlockChild0(BlockBoxing.java:321)
            at com.openhtmltopdf.layout.BlockBoxing.layoutBlockChild(BlockBoxing.java:299)
            at com.openhtmltopdf.layout.BlockBoxing.layoutContent(BlockBoxing.java:90)
            at com.openhtmltopdf.render.BlockBox.layoutChildren(BlockBox.java:1204)
            at com.openhtmltopdf.render.BlockBox.layout(BlockBox.java:1058)
            at com.openhtmltopdf.render.BlockBox.layout(BlockBox.java:973)
            at com.openhtmltopdf.pdfboxout.PdfBoxRenderer.layout(PdfBoxRenderer.java:344)
            at com.openhtmltopdf.pdfboxout.PdfRendererBuilder.run(PdfRendererBuilder.java:41)
    ...
    

    Question is -- what exactly is the issue and what can I do to work around this if I am pretty much stuck with the current layout? It may not be feasible to get rid of the table nesting.

    opened by swillis12 24
  • Exception in apache.pdfbox/fontbox - null font

    Exception in apache.pdfbox/fontbox - null font

    Hi,

    Got this, have no idea why:

    java.io.IOException: The TrueType font null does not contain a 'cmap' table
            at org.apache.fontbox.ttf.TrueTypeFont.getUnicodeCmapImpl(TrueTypeFont.java:548)
            at org.apache.fontbox.ttf.TrueTypeFont.getUnicodeCmapLookup(TrueTypeFont.java:528)
            at org.apache.fontbox.ttf.TrueTypeFont.getUnicodeCmapLookup(TrueTypeFont.java:514)
            at org.apache.fontbox.ttf.TTFSubsetter.<init>(TTFSubsetter.java:91)
            at org.apache.pdfbox.pdmodel.font.TrueTypeEmbedder.subset(TrueTypeEmbedder.java:321)
            at org.apache.pdfbox.pdmodel.font.PDType0Font.subset(PDType0Font.java:239)
            at com.openhtmltopdf.pdfboxout.PdfBoxFontResolver.close(PdfBoxFontResolver.java:86)
            at com.openhtmltopdf.pdfboxout.PdfBoxRenderer.cleanup(PdfBoxRenderer.java:848)
            at com.openhtmltopdf.pdfboxout.PdfBoxRenderer.close(PdfBoxRenderer.java:870)
            at com.openhtmltopdf.pdfboxout.PdfRendererBuilder.run(PdfRendererBuilder.java:37)
            at web.MakePdf.processRequest(MakePdf.java:97)
            at web.MakePdf.doPost(MakePdf.java:116)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:159)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:97)
            at com.caucho.server.dispatch.ServletFilterChain.doFilter(ServletFilterChain.java:109)
            at web.ur.CheckAccess.doFilter(CheckAccess.java:49)
            at com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:89)
            at com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:156)
            at com.caucho.server.webapp.AccessLogFilterChain.doFilter(AccessLogFilterChain.java:95)
            at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:290)
            at com.caucho.server.hmux.HmuxRequest.handleInvocation(HmuxRequest.java:476)
            at com.caucho.server.hmux.HmuxRequest.handleRequestImpl(HmuxRequest.java:374)
            at com.caucho.server.hmux.HmuxRequest.handleRequest(HmuxRequest.java:341)
            at com.caucho.network.listen.TcpSocketLink.dispatchRequest(TcpSocketLink.java:1362)
            at com.caucho.network.listen.TcpSocketLink.handleRequest(TcpSocketLink.java:1318)
            at com.caucho.network.listen.TcpSocketLink.handleRequestsImpl(TcpSocketLink.java:1302)
            at com.caucho.network.listen.TcpSocketLink.handleRequests(TcpSocketLink.java:1210)
            at com.caucho.network.listen.TcpSocketLink.handleAcceptTaskImpl(TcpSocketLink.java:1006)
            at com.caucho.network.listen.ConnectionTask.runThread(ConnectionTask.java:117)
            at com.caucho.network.listen.ConnectionTask.run(ConnectionTask.java:93)
            at com.caucho.network.listen.SocketLinkThreadLauncher.handleTasks(SocketLinkThreadLauncher.java:169)
            at com.caucho.network.listen.TcpSocketAcceptThread.run(TcpSocketAcceptThread.java:61)
            at com.caucho.env.thread2.ResinThread2.runTasks(ResinThread2.java:173)
            at com.caucho.env.thread2.ResinThread2.run(ResinThread2.java:118)
    

    Probably this Exception#printStackTrace call should be removed, although I don't understand how can font be null:

    public void close() {
    		for (FontDescription fontDescription : _fontCache.values()) {
    			/*
    			 * If the font is not yet subset, we must subset it, otherwise we may leak a
    			 * file handle because the PDType0Font may still have the font file open.
    			 */
    			if (fontDescription._font != null && fontDescription._font.willBeSubset()) {
    				try {
    					fontDescription._font.subset();
    				} catch (IOException e) {
    					e.printStackTrace();
    				}
    			}
    		}
    		_fontCache.clear();
    
    		// Close all still open TrueTypeCollections
    		for (TrueTypeCollection collection : _collectionsToClose) {
    			try {
    				collection.close();
    			} catch (IOException e) {
    				e.printStackTrace();
    			}
    		}
    		_collectionsToClose.clear();
    	}
    
    
    opened by BbIKTOP 24
  • Object Renderer link placement

    Object Renderer link placement

    As outcome of #475 I am now rendering a tree graph using a custom object renderer based on Graphics2D. but I am now having extreme difficulties to getting the hyperlink boxes for the nodes in my graph correctly, which link to description pages in my document. By seeing where the mouspointer turns into a finger icon in Acrobat Reader I can see, that all link shapes seem to cover almost the whole region covered by the object. It does not matter, where I klick, it opens the same link, so this single link covers the whole region.

    The display itself works fine and I am able to scale the graph to fit it in the page width. The graph consists of nodes connected by arrows. Each node is built from a Swing JPanel that lays out JLabels for Node ID, title, node information and outgoing edge ports using GridBagLayout. The nodes themselves are organized in a large JPanel using two nested GridBagLayouts. Again positioning works great and using SwingUtilities.convertRectangle I am able to determine the exact position relative to the main panel of each Title and NodeID label that is supposed to carry a link.

    To collect the link shapes, I have extended the JLabel Component with an Interface that provides the url. So during rendering in the custom object drawer, I am able to collect all linked components after layout completes, calculate their bounding shapes relative to the Graphics 2D and create the link map, with shapes as keys and urls as values.

    I have verified that the positions of the collected shapes match the drawn Ids and titles by drawing them as red boxes at the end of graph drawing. The cover exactly the areas that are supposed to be the hotspots of the links. But if I return the shape-to-url map and let opengtmltopdf even render just the firdt link, its hotspot covers almost the whole page, instead of the title it is supposed to cover.

    I have tried several corrective transformations, even transforms I would expect to result in an extremely small region in the upper left corner on the page, but it does not change anything. It is still the whole region reacting to the click.

    Since it does not seem to matter, how large or small I transform the collected link shapes, I think this is a bug and I do not have a clue, how to get it right.

    opened by hbergmey 19
  • Cache + URL resolver doesn't work as expected

    Cache + URL resolver doesn't work as expected

    Cache + URL resolver doesn't work as expected

                builder.useUriResolver(new NaiveUserAgent.DefaultUriResolver() {
                    @Override
                    public String resolveURI(String baseUri, String uri) {
    
                        String inClassPath = FsPdfGenerator.localResource(uri);
                        if (null != inClassPath) {
                            logger.info("Loading from classpath: "+uri);
                            java.net.URL url = FsPdfGenerator.class.getResource('/' + inClassPath);
                            if (url != null)
                                return url.toExternalForm();
                        }
    
                        return super.resolveURI(baseUri, uri);
                    }
    
                });
    
    • a very simple test cache implementation
    @Singleton
    public class SimpleCache implements FSCache {
    
        private static final Logger logger = LoggerFactory.getLogger(SimpleCache.class);
    
        public static final int MAX_SIZE = 512;
    
        private final Map<FSCacheKey, Object> cache = lruCache(MAX_SIZE);
    
        private static <K,V> Map<K,V> lruCache(final int maxSize) {
            return new LinkedHashMap<K,V>(maxSize*4/3, 0.75f, true) {
                @Override
                protected boolean removeEldestEntry(Map.Entry<K,V> eldest) {
                    return size() > maxSize;
                }
            };
        }
    
        private ReentrantReadWriteLock rwl = new ReentrantReadWriteLock();
    
        public Object get(FSCacheKey cacheKey) {
    
            try {
                rwl.readLock().lock();
                Object obj = cache.get(cacheKey);
                if (logger.isDebugEnabled()) {
                    logger.debug("Requesting: {} of type: {}, got it: {}", cacheKey.getUri(), cacheKey.getClazz().getName(), (obj != null));
                }
                return obj;
            } finally {
                rwl.readLock().unlock();
            }
        }
    
        public void put(FSCacheKey cacheKey, Object obj)  {
            try {
                rwl.writeLock().lock();
                if (logger.isDebugEnabled()) {
                    logger.debug("Putting: {} of type: {}", cacheKey.getUri(), cacheKey.getClazz().getName());
                }
                cache.put(cacheKey, obj);
            } finally {
                rwl.writeLock().unlock();
            }
    
        }
    }
    

    In log you can see next messages: com.openhtmltopdf.css-parse WARNING:: Couldn't parse stylesheet at URI file:/G:/Programme/tomcat/tomcat8.lst/webapps/ROOT/WEB-INF/classes/styles/resources/standard.css:

    Stream closed
    java.io.IOException: Stream closed
    	at sun.nio.cs.StreamDecoder.ensureOpen(StreamDecoder.java:46)
    	at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:148)
    	at java.io.InputStreamReader.read(InputStreamReader.java:184)
    	at com.openhtmltopdf.css.parser.Lexer.zzRefill(Lexer.java:1634)
    
    
    java.io.IOException: COSStream has been closed and cannot be read. Perhaps its enclosing PDDocument has been closed?
    	at org.apache.pdfbox.cos.COSStream.checkClosed(COSStream.java:82)
    	at org.apache.pdfbox.cos.COSStream.createRawInputStream(COSStream.java:130)
    	at org.apache.pdfbox.pdfwriter.COSWriter.visitFromStream(COSWriter.java:1203)
    	at org.apache.pdfbox.cos.COSStream.accept(COSStream.java:388)
    
    opened by delafer 19
  • com.openhtmltopdf.render.ContentLimitContainer failing in updateTop method in some cases.

    com.openhtmltopdf.render.ContentLimitContainer failing in updateTop method in some cases.

    I am not able to get this issue as it is happening in one particular setup. It is working on other setups. Can you please help me to understand this methods purpose. So I can understand where I need to check.

    It is failing with no exception message.

    #Class Name::com.openhtmltopdf.render.ContentLimitContainer:: Method Name::updateTop:: Line Number::69#

    opened by adilxoxo 18
  • Another Chinese character issue

    Another Chinese character issue

    Hi there,

    I was using the Flying Saucer library before and it all went ok until I upgrade my Spring framework to v5 so that I have to look for a newer library to generate PDF with Chinese in it.

    I had read quite a few posts and tried many ways, but still seeing ###. Not sure what is going on. Do I miss any step? Please help.

    My css file: @CHARSET "UTF-8"; @font-face { font-family: "Arial Unicode MS"; src: url('arialuni.ttf'); }

    • { font-family: "Arial Unicode MS",sans-serif; }

    HTML file:

    Testing

    每星期三
    Every Wednesday

    Java: public static void main(String[] args) throws Exception { try (OutputStream os = new FileOutputStream("E:/Temp/out.pdf")) { PdfRendererBuilder builder = new PdfRendererBuilder(); // builder.useFont(new File("E:/Temp/arialuni.ttf"),"Arial Unicode MS"); builder.useFastMode(); builder.withUri("file:///E:/Temp/index.html"); builder.toStream(os); builder.run(); } }

    Result:

    out

    question 
    opened by rkhlin 16
  • OutOfMemoryError for HTML with long line(s)

    OutOfMemoryError for HTML with long line(s)

    Good evening

    Version 1.0.2 The following HTML sent to my application produces a hell of an OutOfMemoryError:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml"><head><title>lineOfDeath</title></head><body><div class="nl2go_preheader" style="display: none !important; mso-hide:all !important; mso-line-height-rule: exactly; visibility: hidden !important; line-height: 0px !important; font-size: 0px !important;">Wohoo, I have some very important news<div style="display: none; max-height: 0px; overflow: hidden;">&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌</div><br><img src="http://news.some.url/5fhrqwkz-tb0bc4v7-wmg82uhc-11n6.gif" style="display:none" width="1" height="1" alt="" title=""></div> <table cellspacing="0" cellpadding="0" border="0" role="presentation" style="background-color: #C4C4C4; width: 100%;" class="nl2go-body-table" width="100%"> <tr> <td align="center" class="r0-c"> <table cellspacing="0" cellpadding="0" border="0" role="presentation" width="660" style="table-layout: fixed; width: 660px;" class="r1-o">  <tr> <td style="background-color: #ffffff;" valign="top" class="r2-i"> <table width="100%" cellspacing="0" cellpadding="0" border="0" role="presentation"> <tr> <td class="r3-c"> <table cellspacing="0" cellpadding="0" border="0" role="presentation" width="100%" style="table-layout: fixed; width: 100%;" class="r4-o"> <!-- --> <tr class="nl2go-responsive-hide"> <td style="font-size: 8px; line-height: 8px; background-color: #C4C4C4;" height="8">­</td> </tr> <tr> <td style="background-color: #C4C4C4;" class="r5-i"> <table width="100%" cellspacing="0" cellpadding="0" border="0" role="presentation"> <tr> <th width="100%" valign="top" class="r6-c"> <table cellspacing="0" cellpadding="0" border="0" role="presentation" width="100%" style="table-layout: fixed; width: 100%;" class="r4-o"> <!-- --> <tr> <td style="" valign="top" class="r7-i"> <table width="100%" cellspacing="0" cellpadding="0" border="0" role="presentation"> <tr> <td class="r8-c" align="left"> <table cellspacing="0" cellpadding="0" border="0" role="presentation" width="100%" style="table-layout: fixed; width: 100%;" class="r9-o">  <tr> <td align="center" valign="top" style="line-height: 16px; text-align: center; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 15px;" class="r10-i nl2go-default-textstyle"> <span class="nl2go_class_12_dark-blue_reg" style="color: #1E3650; font-family: Arial, Helvetica, sans-serif; font-size: 12px;">I am the newsletter of death <a href="http://news.some.url/5fhrqwkz-wmg82uhc-sa8xybo2-pvk" style="color: #4a769a; text-decoration: none;"><span class="nl2go_class_12_ocher_reg_u" style="color: #977537; font-family: Arial, Helvetica, sans-serif; font-size: 12px; text-decoration: underline;">hier</span><span class="nl2go_class_12_ocher_reg_u" style="color: #977537; font-family: Arial, Helvetica, sans-serif; font-size: 12px; text-decoration: underline;">.</span></a></span> </td> </tr> </table> </td> </tr> </table> </td> </tr> </table> </th> </tr> </table> </td> </tr> <tr class="nl2go-responsive-hide"> <td style="font-size: 8px; line-height: 8px; background-color: #C4C4C4;" height="8">­</td> </tr> </table> </td> </tr> <tr> <td class="r11-c" align="center"> <table cellspacing="0" cellpadding="0" border="0" role="presentation" width="100%" style="table-layout: fixed; width: 100%;" class="r12-o"> <!-- --> <tr class="nl2go-responsive-hide"> <td style="font-size: 10px; line-height: 10px;" height="10" width="10">­</td> <td style="font-size: 10px; line-height: 10px;" height="10">­</td> <td style="font-size: 10px; line-height: 10px;" height="10" width="10">­</td> </tr> <tr> <td style="font-size: 0px; line-height: 0px;" class="nl2go-responsive-hide" width="10">­</td> <td style="" class="r13-i"> <table width="100%" cellspacing="0" cellpadding="0" border="0" role="presentation"> <tr> <th width="" valign="top" class="r6-c"> <table cellspacing="0" cellpadding="0" border="0" role="presentation" width="100%" style="table-layout: fixed; width: 100%;" class="r14-o"> <!-- --> <tr> <td style="font-size: 0px; line-height: 0px;" class="nl2go-responsive-hide" width="10">­</td> <td style="" valign="top" class="r15-i"> <table width="100%" cellspacing="0" cellpadding="0" border="0" role="presentation"> <tr> <td class="r16-c" align="center"> <table cellspacing="0" cellpadding="0" border="0" role="presentation" width="171" style="table-layout: fixed; width: 171px;" class="r17-o">  <tr> <td style="font-size: 0px; line-height: 0px;" class=""> <img src="http://news.some.url/lbp9n0eb/s_5fhrqwkz/files/HeaderLogo_1.png" width="171" border="0" style="display: block; width: 100%;" class=""> </td> </tr> </table> </td> </tr> </table> </td> <td style="font-size: 0px; line-height: 0px;" class="nl2go-responsive-hide" width="10">­</td> <td style="font-size: 0px; line-height: 0px;" class="nl2go-responsive-hide" width="20">­</td> </tr> </table> </th> <th width="66.67%" valign="top" class="r6-c"> <table cellspacing="0" cellpadding="0" border="0" role="presentation" width="100%" style="table-layout: fixed; width: 100%;" class="r4-o"> <!-- --> <tr> <td style="font-size: 0px; line-height: 0px;" class="nl2go-responsive-hide" width="10">­</td> <td style="" valign="top" class="r15-i"> <table width="100%" cellspacing="0" cellpadding="0" border="0" role="presentation"> <tr> <td class="r18-c" align="center"> <table cellspacing="0" cellpadding="0" border="0" role="presentation" width="100%" style="table-layout: fixed; width: 100%;" class="r12-o">  <tr class="nl2go-responsive-hide"> <td style="font-size: 10px; line-height: 10px;" height="10">­</td> <td style="font-size: 10px; line-height: 10px;" height="10" width="10">­</td> </tr> <tr> <td style="" valign="top" class="r19-i"> <table width="100%" cellspacing="0" cellpadding="0" border="0" role="presentation"> <tr> <td class="r20-c" align="center"> <table cellspacing="0" cellpadding="0" border="0" role="presentation" width="100%" style="table-layout: fixed; width: 100%;" class=""> <!-- --> <tr class="nl2go-responsive-hide"> <td style="font-size: 10px; line-height: 10px;" height="10">­</td> </tr> <tr> <td style="" class=""> <table width="100%" cellspacing="0" cellpadding="0" border="0" role="presentation"> <tr> <th width="50%" valign="top" class="r21-c"> <table cellspacing="0" cellpadding="0" border="0" role="presentation" width="100%" style="table-layout: fixed; width: 100%;" class="r4-o"> <!-- --> <tr> <td style="" valign="top" class="r7-i"> <table width="100%" cellspacing="0" cellpadding="0" border="0" role="presentation"> <tr> <td class="r22-c" align="right"> <table cellspacing="0" cellpadding="0" border="0" role="presentation" width="100" style="table-layout: fixed; width: 100px;" class="r23-o">  <tr> <td align="right" valign="top" style="text-align: right; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 15px;" class="r24-i nl2go-default-textstyle"> <font color="#4a769a"><span style="font-size: 12px;"><a href="http://news.some.url/5fhrqwkz-wmg82uhc-yn4ivcoz-xdy" style="color: #4a769a; text-decoration: none;">K</a></span></font><a href="http://news.some.url/5fhrqwkz-wmg82uhc-5z8jvpxe-11uc" style="color: #4a769a; text-decoration: none;"><font color="#4a769a"><span style="font-size: 12px;">ommentierte Mustereingaben</span></font></a> </td> </tr> </table> </td> </tr> </table> </td> </tr> </table> </th> <th width="50%" valign="top" class="r21-c"> <table cellspacing="0" cellpadding="0" border="0" role="presentation" width="100%" style="table-layout: fixed; width: 100%;" class="r4-o"> <!-- --> <tr> <td style="" valign="top" class="r7-i"> <table width="100%" cellspacing="0" cellpadding="0" border="0" role="presentation"> <tr> <td class="r22-c" align="right"> <table cellspacing="0" cellpadding="0" border="0" role="presentation" width="100" style="table-layout: fixed; width: 100px;" class="r23-o">  <tr> <td align="right" valign="top" style="text-align: right; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 15px;" class="r24-i nl2go-default-textstyle"> <font color="#4a769a"><span style="font-size: 12px;"><a href="http://news.some.url/5fhrqwkz-wmg82uhc-73ogv4gy-1bjh" style="color: #4a769a; text-decoration: none;">Some-<br>thing</a></span></font> </td> </tr> </table> </td> </tr> </table> </td> </tr> </table> </th> </tr> </table> </td> </tr> <tr class="nl2go-responsive-hide"> <td style="font-size: 10px; line-height: 10px;" height="10">­</td> </tr> </table> </td> </tr> </table> </td> <td style="font-size: 0px; line-height: 0px;" class="nl2go-responsive-hide" width="10">­</td> </tr> <tr class="nl2go-responsive-hide"> <td style="font-size: 10px; line-height: 10px;" height="10">­</td> <td style="font-size: 10px; line-height: 10px;" height="10" width="10">­</td> </tr> </table> </td> </tr> </table> </td> <td style="font-size: 0px; line-height: 0px;" class="nl2go-responsive-hide" width="10">­</td> </tr> </table> </th> </tr> </table> </td> <td style="font-size: 0px; line-height: 0px;" class="nl2go-responsive-hide" width="10">­</td> </tr> <tr class="nl2go-responsive-hide"> <td style="font-size: 10px; line-height: 10px;" height="10" width="10">­</td> <td style="font-size: 10px; line-height: 10px;" height="10">­</td> <td style="font-size: 10px; line-height: 10px;" height="10" width="10">­</td> </tr> </table> </td> </tr> <tr> <td class="r25-c"> <table cellspacing="0" cellpadding="0" border="0" role="presentation" width="100%" style="table-layout: fixed; width: 100%;" class="r4-o"> <!-- --> <tr> <td style="font-size: 0px; line-height: 0px;" class=""> <img src="http://news.some.url/3odbztg3/s_5fhrqwkz/files/Schulthess_Neutral_Header_660.png" width="" border="0" style="display: block; width: 100%;" class=""> </td> </tr> </table> </td> </tr> <tr> <td class="r22-c" align="right"> <table cellspacing="0" cellpadding="0" border="0" role="presentation" width="100%" style="table-layout: fixed; width: 100%;" class="r23-o">  <tr class="nl2go-responsive-hide"> <td style="font-size: 20px; line-height: 20px;" height="20" width="20">­</td> <td style="font-size: 20px; line-height: 20px;" height="20">­</td> <td style="font-size: 20px; line-height: 20px;" height="20" width="20">­</td> </tr> <tr> <td style="font-size: 0px; line-height: 0px;" class="nl2go-responsive-hide" width="20">­</td> <td align="right" valign="top" style="text-align: right; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 15px;" class="r26-i nl2go-default-textstyle"> Location, Date </td> <td style="font-size: 0px; line-height: 0px;" class="nl2go-responsive-hide" width="20">­</td> </tr> </table> </td> </tr> <tr> <td class="r3-c"> <table cellspacing="0" cellpadding="0" border="0" role="presentation" width="100%" style="table-layout: fixed; width: 100%;" class="r4-o"> <!-- --> <tr class="nl2go-responsive-hide"> <td style="font-size: 20px; line-height: 20px;" height="20" width="20">­</td> <td style="font-size: 20px; line-height: 20px;" height="20">­</td> <td style="font-size: 20px; line-height: 20px;" height="20" width="20">­</td> </tr> <tr> <td style="font-size: 0px; line-height: 0px;" class="nl2go-responsive-hide" width="20">­</td> <td style="" class="r27-i"> <table width="100%" cellspacing="0" cellpadding="0" border="0" role="presentation"> <tr> <th width="100%" valign="top" class="r6-c"> <table cellspacing="0" cellpadding="0" border="0" role="presentation" width="100%" style="table-layout: fixed; width: 100%;" class="r4-o"> <!-- --> <tr> <td style="" valign="top" class="r7-i"> <table width="100%" cellspacing="0" cellpadding="0" border="0" role="presentation"> <tr> <td class="r8-c" align="left"> <table cellspacing="0" cellpadding="0" border="0" role="presentation" width="100%" style="table-layout: fixed; width: 100%;" class="r9-o">  <tr> <td align="left" valign="top" style="line-height: 26px; text-align: left; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 15px;" class="r10-i nl2go-default-textstyle"> <font color="#4a769a"><span style="font-size: 22px;"><b>Something</b></span></font> </td> </tr> </table> </td> </tr> </table> </td> </tr> </table> </th> </tr> </table> </td> <td style="font-size: 0px; line-height: 0px;" class="nl2go-responsive-hide" width="20">­</td> </tr> </table> </td> </tr> <tr> <td class="r8-c" align="left"> <table cellspacing="0" cellpadding="0" border="0" role="presentation" width="100%" style="table-layout: fixed; width: 100%;" class="r9-o">  <tr class="nl2go-responsive-hide"> <td style="font-size: 20px; line-height: 20px;" height="20" width="20">­</td> <td style="font-size: 20px; line-height: 20px;" height="20">­</td> <td style="font-size: 20px; line-height: 20px;" height="20" width="20">­</td> </tr> <tr> <td style="font-size: 0px; line-height: 0px;" class="nl2go-responsive-hide" width="20">­</td> <td align="left" valign="top" style="line-height: 20px; text-align: left; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 15px;" class="r28-i nl2go-default-textstyle"> <span style="color: rgb(51, 51, 51); font-size: 15px;">Hello</span><br><br>There is&nbsp;<span style="font-weight: bold;">Some</span> text&nbsp;<span style="font-weight: bold;">More of it</span>. Still very long.<br>And important <a href="http://news.some.url/5fhrqwkz-wmg82uhc-bmo3i836-12zm" style="color: #4a769a; text-decoration: none;">Bundle </a>available.<br><br>I like tables.&nbsp;<br><br>And rows!<br><br><span style="color: rgb(51, 51, 51); font-size: 15px;">Yeah<br>Greeting</span> </td> <td style="font-size: 0px; line-height: 0px;" class="nl2go-responsive-hide" width="20">­</td> </tr> </table> </td> </tr> <tr> <td class="r3-c"> <table cellspacing="0" cellpadding="0" border="0" role="presentation" width="100%" style="table-layout: fixed; width: 100%;" class="r4-o"> <!-- --> <tr class="nl2go-responsive-hide"> <td style="font-size: 20px; line-height: 20px;" height="20" width="20">­</td> <td style="font-size: 20px; line-height: 20px;" height="20">­</td> <td style="font-size: 20px; line-height: 20px;" height="20" width="20">­</td> </tr> <tr> <td style="font-size: 0px; line-height: 0px;" class="nl2go-responsive-hide" width="20">­</td> <td style="" class="r27-i"> <table width="100%" cellspacing="0" cellpadding="0" border="0" role="presentation"> <tr> <th width="100%" valign="top" class="r6-c"> <table cellspacing="0" cellpadding="0" border="0" role="presentation" width="100%" style="table-layout: fixed; width: 100%;" class="r4-o"> <!-- --> <tr> <td style="" valign="top" class="r7-i"> <table width="100%" cellspacing="0" cellpadding="0" border="0" role="presentation"> <tr> <td class="r18-c" align="center"> <table cellspacing="0" cellpadding="0" border="0" role="presentation" width="620" style="table-layout: fixed;" class="r12-o">  <tr> <td style="height: 4px;" class=""> <table width="100%" cellspacing="0" cellpadding="0" border="0" role="presentation"> <tr> <td><table width="100%" cellspacing="0" cellpadding="0" border="0" role="presentation" valign="" class="" height="4" style="border-top-style: solid; background-clip: border-box; border-top-color: #4A769A; border-top-width: 4px; font-size: 4px; line-height: 4px;"> <tr> <td height="0" style="font-size: 0px; line-height: 0px;">­</td> </tr> </table></td> </tr> </table> </td> </tr> </table> </td> </tr> </table> </td> </tr> </table> </th> </tr> </table> </td> <td style="font-size: 0px; line-height: 0px;" class="nl2go-responsive-hide" width="20">­</td> </tr> </table> </td> </tr> <tr> <td class="r3-c"></td></tr></table></td></tr></table></td></tr></table></body></html></body></html>
    
    java.lang.StringBuilder.toString(Unknown Source)   at 
    com.openhtmltopdf.css.newmatch.CascadedStyle.getFingerprint(CascadedStyle.java:242)       at 
    com.openhtmltopdf.css.style.CalculatedStyle.deriveStyle(CalculatedStyle.java:185)  at 
    com.openhtmltopdf.layout.SharedContext.getStyle(SharedContext.java:503)    at 
    com.openhtmltopdf.layout.SharedContext.getStyle(SharedContext.java:482)    at 
    com.openhtmltopdf.layout.BoxBuilder.createChildren(BoxBuilder.java:1093)  at 
    com.openhtmltopdf.layout.BoxBuilder.createChildren(BoxBuilder.java:130)    at 
    com.openhtmltopdf.render.BlockBox.ensureChildren(BlockBox.java:1184)       at 
    com.openhtmltopdf.layout.BoxBuilder.createChildren(BoxBuilder.java:1194)   at 
    com.openhtmltopdf.layout.BoxBuilder.createChildren(BoxBuilder.java:130)    at 
    com.openhtmltopdf.render.BlockBox.ensureChildren(BlockBox.java:1184)       at 
    com.openhtmltopdf.render.BlockBox.isVerticalMarginsAdjoin(BlockBox.java:1523)     at 
    com.openhtmltopdf.render.BlockBox.collapseMargins(BlockBox.java:1342)      at 
    com.openhtmltopdf.render.BlockBox.layout(BlockBox.java:1022)      at 
    com.openhtmltopdf.render.BlockBox.layout(BlockBox.java:973)       at 
    com.openhtmltopdf.pdfboxout.PdfBoxRenderer.layout(PdfBoxRenderer.java:335) at 
    com.openhtmltopdf.pdfboxout.PdfRendererBuilder.run(PdfRendererBuilder.java:40)     at
    myCode
    

    Seems that the incredibly long line is the problem. After reformatting / pretty printing it, everything is fine. Is this fixable / preventable? An OutOfMemoryError is never nice.

    Greetings and thank you for looking into it Joe

    opened by swarl 16
  • Add support for fillable form elements (basic features)

    Add support for fillable form elements (basic features)

    This issues is extended with "basic features", as more advanced features and elements (like drop-downs or definition of text content types) are covered in a separate issue

    As in the current flying saucer version, input elements should not only be rendered, but also be created as AcroForm elements in the resulting PDF (note that the implementation in flying saucer has some limitations though - e.g. radioboxes are not yet implemented, and css styles are a bit quirky still). In a first implementation, the following elements should be considered:

    • HTML <input type="text" name="..." value="..."> : a text form field should be rendered, one line only. If a value is provided in the value attribute, it should be pre-filled with that value. The name attribute should be taken as value for the "name" property of the form field.
    • HTML <textarea name="..." value="..."> : a multi-line text form field should be rendered. The hight of the form field should be created based on the css style. If no "height" style can be determined from the css, then it should be calculated based on the rows attribute value, multiplied by the line hight and paddings / line spacings. If the <textarea> element has a node child, the form field should be pre-filled with the text content of that child node. The name attribute should be taken as value for the "name" property of the form field.
    • HTML <input type="radio" name="..." value="..." checked="true"> : a radio form field should be rendered. The value from the _id attribute should be taken as group-id for the radio boxes. The "name" property of the form field should be composed out of the name attribute, extended by a "." and the running number of the element within the group (e.g. if the name is "mysection.myoptions" then the form element name of the first radio button with this name will be "mysection.myoptions.1"). The "option" value of the form element is to be taken directly from the value attribute of the <input> element. The option should be selected by default, if the checked attribute in the <input> element is set respectively.
    • HTML <input type="checkbox" name="..." value="..."> : a checkbox form field should be created. The name attribute should be taken as value for the "name" property of the form field. The form field value should be taken over from the value property of the <input> element. The checkbox should be checked by default, if the checked attribute in the <input> element is set respectively.

    For all the above elements, basic styling for borders (width, color), background-color, inner padding to content and font settings should be applied (for checkboxes and radio buttons, the dot/check sign is rendered in the font-color - so even there it does count)

    opened by ngns 16
  • Border-radius on background-color is ignored

    Border-radius on background-color is ignored

    Hey!

    issue: Have a element with a background-color and a border-radius, but the radius is not applied. It only works for a border property.

    Is this a limitation, is there a work around?

    opened by francisco4challenge 0
  • Large document can not pass PDF/A-1A conformance

    Large document can not pass PDF/A-1A conformance

    We are having issues with large documents. It seems that these large documents keep failing PDF/A-1A conformance even after being tagged as PDF/A-1A. We are getting this error -> syntax problem : real value out of range (too high).

    Has anyone ever had this type issue before ?

    opened by danny00747 0
  • Support for additional structure types for PDF tagging

    Support for additional structure types for PDF tagging

    When checking a document with <code> tags, I noticed that they are just represented as span. There seems to be a matching structure type – I'm not aware whether it might have been a later addition – but I don't see it used in the PdfBoxAccessibilityHelper. Is this the correct place to look? Browsing a bit through the code I don't see how to customize or subclass this. Is there a way to do this?

    opened by PRGfx 0
  • Bump snakeyaml from 1.26 to 1.32 in /openhtmltopdf-templates

    Bump snakeyaml from 1.26 to 1.32 in /openhtmltopdf-templates

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • Ability to ignore HTML attributes

    Ability to ignore HTML attributes

    Hello,

    I'm using openhtmltopdf to generate PDF pages from a received email. Outlook emails generate an @page CSS selector by default, which breaks PDF formatting. Could there be support for ignoring certain attributes when rendering PDFs?

    Many thanks, Josh

    opened by joshuajaharwood 0
The Apache PDFBox library is an open source Java tool for working with PDF documents

Apache PDFBox The Apache PDFBox library is an open source Java tool for working with PDF documents. This project allows creation of new PDF documents,

The Apache Software Foundation 1.8k Dec 31, 2022
Core Java Library + PDF/A, xtra and XML Worker

iText 5 is EOL, and has been replaced by iText 7. Only security fixes will be added Known Security Issues org.apache.santuario:xmlsec vul

iText 1.4k Jan 9, 2023
Extract tables from PDF files

tabula-java tabula-java is a library for extracting tables from PDF files — it is the table extraction engine that powers Tabula (repo). You can use t

Tabula 1.5k Jan 9, 2023
Java reporting library for creating dynamic report designs at runtime

Master Development Dynamic Reports DynamicReports is an open source Java reporting library based on JasperReports. It allows to create dynamic report

Dynamic Reports 165 Dec 28, 2022
XML/XHTML and CSS 2.1 renderer in pure Java

Flying Saucer OVERVIEW Flying Saucer is a pure-Java library for rendering arbitrary well-formed XML (or XHTML) using CSS 2.1 for layout and formatting

null 1.8k Jan 2, 2023
This project allows the exchange of files between your local disk and a D64 image (Commodore 64 image disk) . Ce projet permet l'échange de fichiers entre votre disque local et une image D64 (Image de disquette du Commodore 64).

DiskToolC64 Ce projet permet l'échange de fichiers entre votre disque local et une image D64 (Image de disquette du Commodore 64). Introduction Les fi

Eddy BRIERE 3 Oct 12, 2022
hella-html is a library that makes it hella easy to generate dynamic HTML in vanilla Java.

Hella easy HTML in Java hella-html is a library that makes it hella easy to generate dynamic HTML in vanilla Java. Very lightweight and fast, the prim

null 1 Nov 23, 2022
jsoup: the Java HTML parser, built for HTML editing, cleaning, scraping, and XSS safety.

jsoup: Java HTML Parser jsoup is a Java library for working with real-world HTML. It provides a very convenient API for fetching URLs and extracting a

Jonathan Hedley 9.9k Jan 4, 2023
Welcome to the EHS robotics club's GitHub repository, this will also be used as our primary community center and means of communication. Also be sure to join our remind for on the go updates @EHSFTC21

NOTICE This repository contains the public FTC SDK for the Ultimate Goal (2020-2021) competition season. Formerly this software project was hosted her

null 5 Feb 25, 2022
Section B of Assignment 1. Setup project and collaborate on GitHub by writing test fixtures.

Task Each member (including the team leader) should create a branch (use student number as the branch name) and include a small program in the branch

Quinn Frost 1 Apr 6, 2022
Simple Java image-scaling library implementing Chris Campbell's incremental scaling algorithm as well as Java2D's "best-practices" image-scaling techniques.

imgscalr - Java Image-Scaling Library http://www.thebuzzmedia.com/software/imgscalr-java-image-scaling-library/ Changelog --------- 4.2 * Added sup

Riyad Kalla 1.1k Jan 5, 2023
A little tool that converts SVG paths to JavaFX paths

SVGPathConverter The SVGPathConverter is a little tool that helps you converting SVG paths to JavaFX paths. It has two methods, one to format a SVG pa

Gerrit Grunwald 9 Dec 29, 2021
Java SVG renderer

JSVG - A Java SVG implementation The SVG logo rendered using JSVG JSVG is an SVG user agent using AWT graphics. Its aim is to provide a small and fast

Jannis Weis 30 Dec 13, 2022
Nokogiri (鋸) is a Rubygem providing HTML, XML, SAX, and Reader parsers with XPath and CSS selector support.

Nokogiri Nokogiri (鋸) makes it easy and painless to work with XML and HTML from Ruby. It provides a sensible, easy-to-understand API for reading, writ

Sparkle Motion 6k Jan 8, 2023
Z is a Java library providing accessible, consistent function combinators.

Fearless function combination in Java Techniques Unlock your functional programming potential with these combination techniques: Fusion Z.fuse(fn1, fn

J.R. 27 Jun 13, 2022
Extract text from a PDF (pdf to text). Api for PHP/JS/Python and others.

Extract text from a PDF (pdf to text). API in docker. Why did we create this project? In the Laravel project, it was necessary to extract texts from l

dotcode.moscow 6 May 13, 2022
A distributed lock that supports the use of Redis and Zookeeper, out of the box, fast and easy to use

lock-spring-boot-starter A distributed lock that supports the use of Redis and Zookeeper, out of the box, fast and easy to use 一款基于 Redis 和 Zookeeper

Pear Stack 9 Oct 15, 2022
Hadoop library for large-scale data processing, now an Apache Incubator project

Apache DataFu Follow @apachedatafu Apache DataFu is a collection of libraries for working with large-scale data in Hadoop. The project was inspired by

LinkedIn's Attic 589 Apr 1, 2022