-
Notifications
You must be signed in to change notification settings - Fork 463
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can we add US Letter to the PrintDialog page sizes? #757
Comments
In case this is helpful to anyone else, I've been able to add a paper size on the client side with the following hack: printControl.paperSize['US LETTER'] = [200,215]; // this is actually somewhat smaller than US Letter, but seems to be necessary to get the scale bar & N arrow to print. This may be machine-dependent; I haven't done that testing yet.
printControl.setSize('US Letter'); // makes it the default option in the dialog
map.addControl(printControl);
$('li.ol-size select').append('<option value="US LETTER">US Letter - 8.5x11 in</option>'); // makes the option available in the dropdown This is good enough for my purposes! If anyone does pick up adding the size to the basic package, I think that this line: ol-ext/src/control/PrintDialog.js Line 827 in c86c5e7
might also need to be changed, because it seems to bake in the assumption that size names have no lowercase characters, which works well for ISO 216 sizes but would mean that US Letter would have to be spelled out as "US LETTER". |
I've added the 'US Letter' size to the PrintControl. |
NB: you can add your own size // Add new size
ol.control.PrintDialog.prototype.paperSize['My size'] = [100,100];
// New control
var printControl = new ol.control.PrintDialog(); |
Thank you! And this is a much tidier way to add a custom size than the sample code I posted. |
Hooray! Thank you for including this in https://github.com/Viglino/ol-ext/releases/tag/v3.2.24 It took me a couple of weeks to get around to testing the update, but it's all working nicely and I've removed my custom size code from my project. Closing this issue as it's fully resolved. |
* origin/master: [BUG] WMS dialog position Update index.html [UPD] add edugeo [BUILD] Don't call forEach on selectcluserfeatures if that doesn't exist [VER] [UPD] + [LINT] [ADD] bdtopo vtile [BUILD] [ADD] Paper SVG filter Update README.md [UPD] optional opacity [BUILD] [ADD] US letter Viglino#757 [BUG] displacement on new version [BUILD] [UPD] fold
This would be convenient for users in the US & Canada, and I think it's an easy change but I don't have all the tooling installed to do it properly myself. I think it would just involve adding one more item to the list here:
ol-ext/src/control/PrintDialog.js
Lines 720 to 730 in c86c5e7
'US Letter': [215.9,279.4]
(and if the size needs to be in integers I think it would be safer to round down to avoid rescaling).The text was updated successfully, but these errors were encountered: