Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
dselgo_eidex
Partner - Creator III
Partner - Creator III

exportPdf documentSize clarification

Hello, I am trying to use the exportPdf method defined here. My question is about the documentSize parameter. The documentation says that you can provide one of the given strings or provide a custom size. However, it is not documented what this ObjectMetricSize is supposed to be. Furthermore, there is another parameter called objectSize which uses an ObjectPixelSize without documenting what it should be.

My assumption is that both are objects with height and width properties, but I can't say for sure.

Can anyone add any clarification?

Labels (3)
1 Solution

Accepted Solutions
fos
Employee
Employee

Hi,

Yes, you are correct. They are both objects with height and width properties:

		/**
		 * @typedef ObjectMetricSize {object} - Describes the size, in millimeters (mm), of a 2D object.
		 * @property {number} height - Object height in millimeters (mm).
		 * @property {number} width - Object width in millimeters (mm).
		 */

		/**
		 * @typedef ObjectPixelSize {object} - Describes the size, in pixels, of a 2D object.
		 * @property {number} height - Object height in pixels.
		 * @property {number} width - Object width in pixels.
		 */

Thanks for reporting this.

View solution in original post

5 Replies
fos
Employee
Employee

Hi,

Yes, you are correct. They are both objects with height and width properties:

		/**
		 * @typedef ObjectMetricSize {object} - Describes the size, in millimeters (mm), of a 2D object.
		 * @property {number} height - Object height in millimeters (mm).
		 * @property {number} width - Object width in millimeters (mm).
		 */

		/**
		 * @typedef ObjectPixelSize {object} - Describes the size, in pixels, of a 2D object.
		 * @property {number} height - Object height in pixels.
		 * @property {number} width - Object width in pixels.
		 */

Thanks for reporting this.

dselgo_eidex
Partner - Creator III
Partner - Creator III
Author

Thanks for the clarification. I did notice something else though while testing. The strings that you can provide for documentSize don't seem to have any effect (or I'm doing something wrong). Curiously though, when I provide a document size (even just the A3 size), it does create the correct document size. I've attached images showing the settings that I am passing to exportPdf and the generated pdf.

dselgo_eidex
Partner - Creator III
Partner - Creator III
Author

And the PDFs

fos
Employee
Employee

It looks like there is a slight mismatch between the docs and the code here. It should work if you use lower case strings in the documentSize parameter:

vis.exportPdf({ documentSize: 'a3' }).then(console.log);
dselgo_eidex
Partner - Creator III
Partner - Creator III
Author

Ah, that makes sense. Thanks Smiley Very Happy