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

Page break does not seem to increase document height #31

Closed
williambowsher opened this issue Sep 8, 2017 · 7 comments
Closed

Page break does not seem to increase document height #31

williambowsher opened this issue Sep 8, 2017 · 7 comments

Comments

@williambowsher
Copy link

williambowsher commented Sep 8, 2017

When I use the page break functionality, they are placed exactly where I want them, but the document gets cropped at the bottom by the amount of space added by the page breaks.

Unfortunately this is resulting in an approval element being omitted from the pdf.

form_nopagebreaks.pdf
form_pagebreaks.pdf

Below is the code we use to save the html element as a PDF

`viewModel.SaveHtml2Pdf = function() {
var element = $('div.data-entry-form:first');
var source = element[0];

var username = $('a.user-name:first').text().replace(/\s+/g, '').replace(/"/g, '');
var friendlyForm = friendlyFormName(viewModel.FormType());
var formid = viewModel.FormData.Id();

html2pdf(source,{
    margin: 20,
    filename: 'complianceform.pdf',
    image: { type: 'jpeg', quality: 1 },
    html2canvas: { dpi: 300, letterRendering: true },
    jsPDF: { unit: 'mm', format: 'A4', orientation: 'portrait' },
    jsPDFProperties: {
        title: 'CAFE Compliance Form',
        subject: friendlyForm + ' - ' + formid,
        author: username,
        keywords: 'CAFE, cafe, compliance, ' + friendlyForm,
        creator: 'CAFE'
    },
    title: 'CAFE - ' + friendlyForm + ' - ' + username
});

};`

@williambowsher
Copy link
Author

Think this issue is not related to the html2pdf code but related to the html2canvas cropping the image.

@eKoopmans
Copy link
Owner

Hi @scriptmonkey69, sorry again for the delay. This looks like the offscreen rendering bug. Try the version of html2canvas in the /vendor/ directory of this package, it might resolve your problem. More info here.

@williambowsher
Copy link
Author

williambowsher commented Sep 18, 2017 via email

@eKoopmans
Copy link
Owner

Great, happy to help! Is it safe to close the issue?

@williambowsher
Copy link
Author

williambowsher commented Sep 19, 2017 via email

@jCabigting
Copy link

Hi @eKoopmans, I'm having this issue but for some reason I can't find the /vendor/ folder that you're pointing to. Has it been removed? And is there a permanent fix for this issue?

@eKoopmans
Copy link
Owner

Hi @jCabigting, sorry for the long delay.

There's no longer a /vendor/ directory, instead my suggestion would be to make sure you're using the "bundled" version of the package, html2pdf.bundle.js. That has the latest version of html2canvas and jsPDF bundled in. The issue described above had to do with an older version of html2canvas that should be resolved now.

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