Open sherifdarwish opened 6 years ago
I found this issue but it is talking about IOS only https://github.com/cesarvr/pdf-generator/issues/7
Hi I try to add attribute as you mention the print method is ignoring it, so I'll need more time to solve this if you find a solution feel free to send a pull request 👍.
It looks like is a bug in Android API https://issuetracker.google.com/issues/69352609, hope you find a workaround.
Thanks
I found some java android apps doing the same printing directly and not having the same margin
It end out that they use a web view inside relative layout and this layout have some xml property to clear any padding around
I was not able to apply the same concept for our generated web view
I will try to share some sample soon for this
Regards
On Dec 13, 2017 9:40 PM, "Cesar Valdez" notifications@github.com wrote:
It looks like is a bug in Android API https://issuetracker.google. com/issues/69352609, hope you find a workaround.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/cesarvr/pdf-generator/issues/54#issuecomment-351482996, or mute the thread https://github.com/notifications/unsubscribe-auth/ADSGurnA05blfSGuIH72A1DZG52ZOzpYks5tABoUgaJpZM4Qc36A .
Hi I'm having the same problem.. need to remove the extra padding added to the pdf. Any solution on that?
Thanks!
Found a solution if someone is still interested: it seems it's related to web-view css proprieties: I added this in my css or in style region of the html page: @page{ margin-left: 0px; margin-right: 0px; margin-top: 0px; margin-bottom: 0px; padding:0px; }
And for IOS, there are some margins inserted by default in code in file "cordova-pdf-generator\src\ios\BNHtmlPdfKit.m"
(id)init { if (self = [super init]) { self.pageSize = [BNHtmlPdfKit defaultPageSize]; self.landscape = NO;
// Default 1/4" margins
self.topAndBottomMarginSize =0.25f * 72.0f;
self.leftAndRightMarginSize = 0.25f * 72.0f;
}
return self;
}
Set these two to 0: self.topAndBottomMarginSize =0; self.leftAndRightMarginSize = 0;
The same in next 3 functions.
thanks for sharing @sharutza
Hi, I'm having the same problem. I tried the @sharutza, the app did not get the style
Is there any help for android. I am also having the same problem.
Hi,
I am trying to control the pdf page margin as my CSS & HTML removes any margins or padding but the resulting PDF or PDF Preview always shows white margin around my content, this screen shows what i am trying to do
I also noticed that print attributes were not set in case of saving the PDF file and i tried to set it in File output by updating PrintAttributes in printManager but this did not fix my problem