Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public ResponseEntity<byte []> getInfo(
- @PathVariable("id") String distributorId, @PathVariable("country")
- String country) throws JSONException, IOException,
- URISyntaxException, ParseException, DocumentException {
- logger.trace(START);
- ByteArrayOutputStream myDetails =
- enrollmentService.getInfo(id,country);
- HttpHeaders headers = new HttpHeaders();
- headers.setContentType(MediaType.parseMediaType("application/pdf"));
- String filename = "output.pdf";
- headers.setContentDispositionFormData(filename, filename);
- headers.setCacheControl("must-revalidate, post-check=0, pre-check=0");
- byte[] sos=myDetails.toByteArray();
- return new ResponseEntity<>(sos,headers, sos == null ?
- HttpStatus.NO_CONTENT : HttpStatus.OK );
- }
- getInfo(distributorId: string,
- country:string,month:number,year:number): Observable<any> {
- let url='Some sample url';
- return this._http.
- get(url, { responseType: ResponseContentType.ArrayBuffer })
- .map((response: Response) => response.arrayBuffer())
- .map((arrayBuffer: ArrayBuffer) => new Uint8Array(arrayBuffer))
- .catch(this.handleErrorObservable);
- }
- RangeError: byte length of Uint16Array should be a multiple of 2
- at new Uint16Array (native)
Add Comment
Please, Sign In to add comment