Changing default PDF options & fixing issue with changing canvas size in export
Change default PDF options in Report Builder
You can easily change some PDF options like file name or file size of the PDF list and orientation.
More options you can find in this official documentation, like https://pdfmake.github.io/docs/0.1/document-definition-object/page/ or https://pdfmake.github.io/docs/0.1/document-definition-object/document-medatadata/ (see docDefinition section)
SR.pdfOptions({
pageSize: {
width: 773.86,
height: 1094.46
},
pageOrientation: 'landscape',
pageMargins:[50,90,30,80],
info: {
title:'Actonic Report Tool',
author: 'john doe'
},
filename: issue.key + ' - Report.pdf',
});
In general, this is the most common option that we use.
pageSize: {
width: 773.86,
height: 1094.46
},
If you specify the correct points values, it will be like more dpi of the list.
“pageOrientation
“ - orientation of the page, can be “landscape
” or “portrait
“.
“pageMargins
” - default margins of the page, [left, top, right, bottom]
or [horizontal, vertical]
or just a number for equal margins
“info
“ section - you can provide meta for PDF, which users will see in the options, that you will see in the options of the PDF viewers.
“filename
“ - name of the exported PDF. You can manage individually, except for some system limitations, like file name should not contain more than 255 characters or special symbols, etc. (see https://docs.microsoft.com/en-us/rest/api/storageservices/naming-and-referencing-shares--directories--files--and-metadata ).
You can also provide “pdfOptions
”. It means that you can use any field of the issue, like “ issue.key + " - " + issue.fields[“customfield_12345] + ".pdf"
”
Fixing issue with changing canvas size in the PDF export
If a user has a scaling window, then he will have problems with exporting canvas elements to the PDF.
We have several solutions to this problem.
We implemented a default handler, that should help users to set width/height sizes of the block.
Example that should work:
<div style="width:500px;">
<canvas id="myChart"></canvas>
</div>
2. Also, you can use this workaround:
scale = 1 could help to achieve better results.
How do I hide an element when printing to PDF
Use "pdf-hidden-block"
class, like: