Skip to content
Snippets Groups Projects

Fix calculations for pages with bleeds set

Merged Boris Budini requested to merge master into master

Currently attempting to use pagedjs-cli to output a page with bleeds makes an almighty mess. This is because

(a) The PDF_SETTINGS object is used rather than the correct settings object. This merge request removes the PDF_SETTINGS object. (b) Puppeteer's preferCSSPageSize doesn't work with bleeds, because Chromium doesn't support them. This merge request calculates the page size from the first page in the PDF instead. (c) The calculations for the CropBox in the output were all wrong. These are now corrected.

pagedjs-cli now renders the same as in the browser for all the HTML files I am currently using.

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • preferCSSPageSize was the only way I could get well sized PDFs out of Chrome - Currently the pdf postprocesser will clean up the bleeds and crops for the outputed pdf.

    Did you get a chance to try that? I'm open to using a different method if we can get similar results straight from puppeteer.

    By Fred Chasen on 2019-07-16T17:06:36 (imported from GitLab)

  • Having looked at this again, I think I made a mistake. preferCSSPageSize works fine even with bleeds, as you say. The fixes needed are just the PDF_SETTINGS one and the CropBox one.

    I'm afraid I'm not great at Git yet, but I'll try to get an updated pull request in today...

    By Sam Korn on 2019-07-17T10:37:30 (imported from GitLab)

  • Boris Budini added 4 commits

    added 4 commits

    Compare with previous version

    By Sam Korn on 2019-07-17T11:10:43 (imported from GitLab)

  • @fchasen I've updated the pull request – hopefully this is what is needed now.

    The problem in the post-processor was that the bleed box calculations were being done wrong. This PR fixes it.

    By Sam Korn on 2019-07-17T11:14:02 (imported from GitLab)

  • merged

    By Fred Chasen on 2019-10-13T18:25:19 (imported from GitLab)

  • Boris Budini mentioned in commit 17f68e9b

    mentioned in commit 17f68e9b

    By Fred Chasen on 2019-10-13T18:25:20 (imported from GitLab)

Please register or sign in to reply