Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5f8799f

Browse files
committed
Fixes as per code review comments
1 parent 145e974 commit 5f8799f

File tree

2 files changed

+3
-10
lines changed

2 files changed

+3
-10
lines changed

news/2 Fixes/9403.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
If require, use a custom paper size when exporting plots to `PDF`
1+
Use a custom paper size when exporting plots to `PDF`

src/client/datascience/plotting/plotViewer.ts

+2-9
Original file line numberDiff line numberDiff line change
@@ -169,15 +169,8 @@ export class PlotViewer extends WebViewHost<IPlotViewerMapping> implements IPlot
169169
);
170170
const options: Record<string, {}> = {};
171171
if (dimensions && dimensions.width && dimensions.height) {
172-
const LetterSize = { width: 612, height: 792.0 }; //https://github.com/foliojs/pdfkit/blob/master/lib/page.js#L62
173-
// If the default LETTER size is smaller than image, then use a custom paper size.
174-
// This ensuresimages are not cropped.
175-
if (dimensions.width > LetterSize.width || dimensions.height > LetterSize.height) {
176-
options.size = [
177-
Math.max(dimensions.width, LetterSize.width),
178-
Math.max(dimensions.height, LetterSize.height)
179-
];
180-
}
172+
// Ensure image fits, hence use our own size.
173+
options.size = [dimensions.width, dimensions.height];
181174
}
182175
const doc = new pdfkit(options);
183176

0 commit comments

Comments
 (0)