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

HTML to PDF not rendered properly/completely #166

Closed
ghost opened this issue Jan 8, 2018 · 3 comments
Closed

HTML to PDF not rendered properly/completely #166

ghost opened this issue Jan 8, 2018 · 3 comments

Comments

@ghost
Copy link

ghost commented Jan 8, 2018

Hi,

I'm using your lib to generate PDF out of HTML (both attached pdf+html.zip). Can you take a look and let me know why the html is not completely rendered in the PDF?

My code is as follows:
` private void createPDFwithOpenPDF(String content, String pdf) throws Exception {

    PdfRendererBuilder builder = new PdfRendererBuilder();
    OutputStream os = new FileOutputStream(pdf);

    org.jsoup.nodes.Document doc = Jsoup.parse(content);

    Document d = DOMBuilder.jsoup2DOM(doc);
    builder.withW3cDocument(d, "http://localhost:8080");
    builder.toStream(os);
    builder.run();
}`

Thanks

@rototor
Copy link
Contributor

rototor commented Jan 19, 2018

@mnenchev You mean: Why is the table truncated?

You are using 900px for the width. I don't know the factor for pixel to inch/cm by mind, but there is a certain factor. And 900px is wider than A4 portrait minus 20 % margin (left+right). You should use cm or in (for inch) here.
Or maybe you want to use 100% instead of 900px?

@NewWorldNewCode
Copy link

Hi,

I'm using your lib to generate PDF out of HTML (both attached pdf+html.zip). Can you take a look and let me know why the html is not completely rendered in the PDF?

My code is as follows:
` private void createPDFwithOpenPDF(String content, String pdf) throws Exception {

    PdfRendererBuilder builder = new PdfRendererBuilder();
    OutputStream os = new FileOutputStream(pdf);

    org.jsoup.nodes.Document doc = Jsoup.parse(content);

    Document d = DOMBuilder.jsoup2DOM(doc);
    builder.withW3cDocument(d, "http://localhost:8080");
    builder.toStream(os);
    builder.run();
}`

Thanks

Hi,can you help me why "中文字符"displays #,how can I render html to pdf normally?

@danfickle
Copy link
Owner

@sungmore please see fonts page on wiki.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants