Fix calculations for pages with bleeds set
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
Activity
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 thePDF_SETTINGS
one and theCropBox
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)
added 4 commits
-
218a764b...2e995afc - 2 commits from branch
tools:master
- 6bd3d0b8 - Merge remote changes
- cfc07b9c - preferCSSPageSize *does* work after all
By Sam Korn on 2019-07-17T11:10:43 (imported from GitLab)
-
218a764b...2e995afc - 2 commits from branch
@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)
mentioned in commit 17f68e9b
By Fred Chasen on 2019-10-13T18:25:20 (imported from GitLab)