question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Manual paging support?

See original GitHub issue

I jump into a problem currently: set paging manually Eg: (assume I predefined page size, as options width and height). I have 2 chapters, I need each chapter to be placed on separate pages. If chapter 1 height > options.height then it will render 2 pages, 1st page is full of content, 2nd page is remaining content, the rest is blank. Chapter 2 will start from 3rd page.

How can we solve this problem? I gonna modify native code but I’m not familiar with Objective C

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

4reactions
esuttoncommented, Dec 7, 2017

@dzuncoi Using CSS seems to work for page breaks on iOS and Android.

Disclaimer: I am not a CSS or HTML expert and this may be bad or wrong advice.

const cssStyleSheet = `
<style type="text/css" >
div.img {
    display: block;
    max-width:230px;
    max-height:230px;
    width: auto;
    height: auto;
    page-break-before: auto; 
    page-break-after: auto; 
    page-break-inside: avoid;     
}
img {
  page-break-before: auto; 
  page-break-after: auto; 
  page-break-inside: avoid; 
}
</style>`;

let html = `<!DOCTYPE html><head><title>${borePlan.name}</title>${cssStyleSheet}</head>`;
htmlText += '<h1>This is Page One</h1';
...
htmlText += pageBreakWithPageNumberBefore();
htmlText += '<h1>This is Page Two</h1';
...
let _globalPageNumber = 0;
function pageBreakWithPageNumberBefore() {
  _globalPageNumber += 1;
  return `<p style="page-break-before: always;" align=center>Page ${_globalPageNumber}</p>`;
}

Question: Any advice on how to make PDF generate as landscape on Android?

I have it working on iOS but Android stays in portrait.

Perhaps Android has different units for page size?

This works on iOS

const options = {
    height: 800, /* Optional: 800 sets the height of the DOCUMENT that will be produced, Default: 612 */
    width: 1056, /* Optional: 1056 sets the width of the DOCUMENT that will produced, Default: 792 */
    padding: 24 /* Optional: 24 is the # of pixels between the outer paper edge and
};
2reactions
christopherdrocommented, Jan 22, 2018

@esutton A PR would be great! We can expose an option to set the document size and default to A4.

You should be able to open one up directly from your forked repo.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Support - Digital Paging Company
If you have any questions, please contact support. ... VP-200 Amplified Charger User Manual · VP-200 Programming User Manual ... E-Pager 903.
Read more >
Paging user guides - Spok Inc.
Paging user guides. Find user guides and downloads to help support your messaging device or wireless service. If you can't find what you're...
Read more >
Pagertec Support
PAGING SYSTEM MANUALS ... Please find your system and click on the guide for more instructions. If you have additional questions please contact...
Read more >
Simple Paging User Manual - Barix Help Center
1 Introduction. 1.1 About this document. This document explains the Barix Simple Paging Solution; explaining the main system concepts and how to set...
Read more >
Paging System Manual - Squarespace
The WaveWare paging encoder supports batch paging, where multiple messages can be included in a single key up cycle on a radio. Batch...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found