christopherdro / react-native-html-to-pdf

Convert html strings to PDF documents using React Native
MIT License
429 stars 267 forks source link

last line is cutting off to the next page #253

Open vignesh511989 opened 2 years ago

vignesh511989 commented 2 years ago

Hi,

I'm creating multi page pdf from html. Last line from the first page is cutting off and flowing into the next page.

Is there any way to fix this please.

thanks Vignesh

Screen Shot 2021-12-05 at 9 22 02 AM
christopherdro commented 2 years ago

Is this an issue on both iOS and Android? Is the paper size selected the same dimensions as what you have set?

Big-Vi commented 2 years ago

Thanks for looking into this. I've only tried this on IOS so far. Below is my options.

const createPDF = async (ID, newResumeFields) => { let options = { html: returnResumeHTML(newResumeFields), fileName: 'filename', directory: 'Documents', padding: 40, bgColor: '#ffffff', height: 792, width: 612, }; return await RNHTMLtoPDF.convert(options); };

ZainabShakeel commented 2 years ago

how did you able to create PDf ? this code does not work for me .. it shows RNHTMLtoPDF undefined async createPDF() { let options = { html: '

PDF TEST

', fileName: 'test', directory: 'Documents', };

let file = await RNHTMLtoPDF.convert(options)
// console.log(file.filePath);
alert(file.filePath);

}

TechSaq commented 2 years ago

how did you able to create PDf ? this code does not work for me .. it shows RNHTMLtoPDF undefined async createPDF() { let options = { html: '

PDF TEST

', fileName: 'test', directory: 'Documents', };

let file = await RNHTMLtoPDF.convert(options)
// console.log(file.filePath);
alert(file.filePath);

}

First you should verify react-native-html-to-pdf is installed properly and you are importing correctly.

If everything is okay, you can try the following way.

let options = {
    html: htmlString,
    fileName: 'Pdf file name',
    base64: true,
  };
  let file = await RNHTMLtoPDF.convert(options);

And if you are generating PDF, you might want to save it or open it. In this RNFetchBlob can help you.

If you need further any help, you can mail me ans2sqb@gmail.com

sidorchukandrew commented 2 years ago

This is happening for me on Android

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

kapilavaiya commented 2 years ago

i also got the same problem

vijeethLooperex commented 1 year ago

same issue

mansilaad commented 1 year ago

Same issue

BraveEvidence commented 1 year ago

This will help https://www.youtube.com/watch?v=4CBUXv8d0I0

yuanyixiaomei commented 1 year ago

same issue :My html page data is generated in a loop

yuanyixiaomei commented 1 year ago

.pageBody { // display: flex; // flex-direction: column; border-radius: 10px; border: 1px solid #ccc; } When I comment out the elastic box in my style

stale[bot] commented 4 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

lucsoftsl commented 3 months ago

Same issue

Gavru4 commented 2 months ago

Same issue