<@UAY8PEV1B> yes, you can use `N/render` to genera...
# suitescript
m
@Karan yes, you can use
N/render
to generate the PDF and
context.response.writeFile
to write it to the response
k
Hi @michoel, I am trying the following code -
Copy code
var transactionFile = render.transaction({
                entityId: cashSaleId,
                printMode: render.PrintMode.PDF
            });

            context.response.writeFile(transactionFile, true);
Am i doing something wrong here ?
m
That looks more or less correct, except that you aren't using the documented options syntax (ie.
context.response.writeFile({ file: transactionFile, isInline: true})
but the API does usually accept that undocumented version. What happens when you try that?
k
A file was downloaded automatically by Chrome but it was corrupted or something
Am I supposed to use a Template as well ?
m
No that should use the default template connected to the form
Are you writing anything else to the response as well?
k
No...that's pretty much it.