# How to save pdf as xaml

**URL:** <https://community.postman.com/t/how-to-save-pdf-as-xaml/13893>\
**Category:** Help Hub\
**Tags:** tests, variables\
**Created:** [July 5, 2020, 7:38am UTC](https://community.postman.com/t/how-to-save-pdf-as-xaml/13893 "2020-07-05T07:38:13Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![momotaha22](https://avatars.discourse-cdn.com/v4/letter/m/b487fb/32.png) [@momotaha22](https://community.postman.com/u/momotaha22)\
**Post date:** [July 5, 2020, 7:38am UTC](https://community.postman.com/t/how-to-save-pdf-as-xaml/13893/1 "2020-07-05T07:38:13Z")

</div>

So I have this endpoint that is used to download a PDF. I can click Send and Download and if I save the response with the PDF extension, it writes to the file.

Is there anyway I can havdsadse the PDF created using the Collection runner or Newman? So that if instead of just sending the request it Sends and Downloads as well?

---

<div class="post-metadata">

**Author:** ![danny-dainton](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/danny-dainton/32/29401_2.png) [@danny-dainton](https://community.postman.com/u/danny-dainton)\
**Post date:** [July 5, 2020, 8:01am UTC](https://community.postman.com/t/how-to-save-pdf-as-xaml/13893/2 "2020-07-05T08:01:12Z")

</div>

Hey @momotaha22

Is there anything here that can help?

> [@Endpoint downloads PDF. How to do this via Collection Runner or Newman?](https://community.postman.com/t/endpoint-downloads-pdf-how-to-do-this-via-collection-runner-or-newman/13405/7):
>
> Hey @russellg, I know it’s basic but would this help if you’re running it with Newman as a library? const newman = require('newman'), fs = require('fs'); newman.run({ collection: '\<Collection File\>' }).on('request', (err, args) =\> { fs.writeFileSync(`./${args.item.name}.pdf`, args.response.stream, 'binary'); }) I was just using this Dummy request that returned a PDF and it seemed to work:
