Closed birjubhatt closed 1 year 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.
This is happening at my side , when I am creating pdf with multiple page and putting custom header and footer in each page .
Solved the problem by making changes the line for ( int i = 0 ; i < self.numberOfPages ; i++ ) to for ( int i = 0 ; i < self.numberOfPages - 1 ; i++ ) in the function
Note : You can pass value from Javascript code like
let options = { html: htmlCode, type: 'default', fileName :new Date().getTime(), directory: 'Documents', }; // passing " type: 'default' " as extra param to put condition in the native code
Then used the "type" params in iOS Native code in below function like
*- (NSData) printToPDF:(NSInteger)_numberOfPages backgroundColor:(UIColor)_bgColor pdfType:(NSString)_pdfType
NSInteger pdfPageCount = self.numberOfPages; if([_pdfType isEqualToString:@"custom"]){ pdfPageCount = pdfPageCount - 1; } for ( int i = 0 ; i < pdfPageCount ; i++ ) await RNHTMLtoPDF.convert(options)
when i create pdf in ios that will add one empty page in end of pdf ...and while check android that time its work fine
let options = { html:
${DynamicHTML(res, name, logo, symbol)}
, fileName: "Products_Pdf_Images", directory: "Documents", };};
function DynamicHTML(res, name, logo, symbol) { var html = `
`; console.log("product .length " + product.length); for (let i = 0; i < product.length; i++) { console.log("i :" + i);return html; }