cesarvr / pdf-generator

Cordova plugin to generate pdf in the client-side
MIT License
106 stars 62 forks source link

Is it possible to remove default print page margins? #7

Closed Purushoth-ltr closed 7 years ago

Purushoth-ltr commented 7 years ago

I need to remove a4 page default margins so that i can generate a pdf of full page. How can i remove the margins when converting the html to pdf?

cesarvr commented 7 years ago

If you mean the default margin (≈25mm) , sorry you can't you are constrained to the Webview way of doing the printing from HTML to PDF.

Purushoth-ltr commented 7 years ago

Thanks for the reply. Actually i removed the margins, but i don't know whether its the correct way. In the following function i removed the default margins and it worked.

- (id)initWithPageSize:(BNPageSize)pageSize isLandscape:(BOOL)landscape {
    if (self = [super init]) {
        self.pageSize = pageSize;
        self.landscape = landscape;

        // Default 1/4" margins
        self.topAndBottomMarginSize = 0.0f * 0.0f;
        self.leftAndRightMarginSize = 0.0f * 0.0f;
    }
    return self;
}
cesarvr commented 7 years ago

Interesting... can you please share a screenshot with the results you wanted achieved?, some trivial example if you can

Purushoth-ltr commented 7 years ago

I intended to print a report in IOS. Initially i got the pdf like this screenshot 1 with page margins. screen shot 2017-02-02 at 6 17 31 am

Screenshot 2 without margins. screen shot 2017-02-02 at 6 02 45 am

Sorry for the poor images.

cesarvr commented 7 years ago

Ahh I get the idea, thats very nice use case I will try to add that as an option for IOS. Thanks!.

Purushoth-ltr commented 7 years ago

Thank you too @cesarvr

parasyris commented 5 years ago

Hi @cesarvr , did you add this as an option for iOS? Thanks!

jazzbpn commented 5 years ago

Problem remains unsolved at iOS.