Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HtmlParser: maybe there should be a new line between title and body #706

Closed
ObsisMc opened this issue Apr 16, 2022 · 1 comment · Fixed by #714
Closed

HtmlParser: maybe there should be a new line between title and body #706

ObsisMc opened this issue Apr 16, 2022 · 1 comment · Fixed by #714
Labels
Milestone

Comments

@ObsisMc
Copy link

ObsisMc commented Apr 16, 2022

My html has title and after parsing, the title is in the first line of body. I think at least it should change a line.

To Reproduce
The code is the same as sample ParseHelloHtml.java.

public static void main(String[] args) {
        System.out.println("Parse Hello World");

        // step 1: creation of a document-object
        try (Document document = new Document()) {
            PdfWriter.getInstance(document, new FileOutputStream("test.pdf"));
            // step 2: we open the document
            document.open();
            // step 3: parsing the HTML document to convert it in PDF
            HtmlParser.parse(document, ParseHelloHtml.class.getClassLoader().getResourceAsStream("com/lowagie/examples/html/test.html"));
        } catch (DocumentException | IOException de) {
            System.err.println(de.getMessage());
        }
    }

Html is following.

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8"/>
    <title>Title</title>
</head>
<body>
<p>This is a test.</p>
</body>
</html>

Current behavior
图片

Expected behavior
I think it should change line at least.
图片

@ObsisMc ObsisMc added the bug label Apr 16, 2022
@chappyer
Copy link

Good issue! I'll fix this and submit a Pull Request soon.

@asturio asturio linked a pull request May 11, 2022 that will close this issue
1 task
@asturio asturio added this to the 1.3.28 milestone May 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants