I am using a base64 to display my PDF in a new window in the browser:
let pdfCall$ = this._sdkService.getSDK().api.invPdf.get({ query: { invId: inv.invId }});
let pdfDisposable = pdfCall$.subscribe((invPdf: InvPdf) => {
window.open('data:application/pdf;base64,' + invPdf.pdfString);
},
InvoicePDF class:
export class InvoicePdf {
public pdfString: string;
constructor(pdfString: string) {
this.pdfString = pdfString;
}
}
This is working for all browsers needed except IE11 and Edge.
We are using Angular2 so I am wondering what's the best library to make this work on all browser, I have take a look at PDF.JS and ViewerJS, but there is not enough documentation to make it work on Angular2. Do I need an external library or can this be done natively, maybe use a decorder and embedded to the HTML?
The response needs to be in a key/value pair, JSON format.