how to fix scale 1:4000 to export map in PDF ol3refresh the map Ol3 (Openlayers3)nothing is displayed in my...

Why zero tolerance on nudity in space?

Is there a weight limit to Feather Fall?

SET NOCOUNT Error in handling SQL call after upgrade

Quickly creating a sparse array

Is it a fallacy if someone claims they need an explanation for every word of your argument to the point where they don't understand common terms?

Can a hotel cancel a confirmed reservation?

kill -0 <PID> は何をするのでしょうか?

Consequences of lack of rigour

Am I a Rude Number?

Is there a Linux system call to create a “view” of a range of a file?

Play Zip, Zap, Zop

Why publish a research paper when a blog post or a lecture slide can have more citation count than a journal paper?

How does Leonard in "Memento" remember reading and writing?

Is it possible to grant users sftp access without shell access? If yes, how is it implemented?

Is a new Boolean field better than a null reference when a value can be meaningfully absent?

What incentives do banks have to gather up loans into pools (backed by Ginnie Mae)and selling them?

Is using an 'empty' metaphor considered bad style?

A Missing Symbol for This Logo

How to deal with an incendiary email that was recalled

Flipping axis on a LogPlot

Absorbing damage with Planeswalker

What to look for when criticizing poetry?

Odd 74HCT1G125 behaviour

A starship is travelling at 0.9c and collides with a small rock. Will it leave a clean hole through, or will more happen?



how to fix scale 1:4000 to export map in PDF ol3


refresh the map Ol3 (Openlayers3)nothing is displayed in my ol3 mapHow to set the maxBound for the map in OL3Export PDF from OpenLayers map with jsPDFHow print map in ol3 with top resolution?Keep the same space between lines in OL3 despite scaleOL3 how group feature?ol3 OSM map stylingol3 zoom with defined scaleHow to give user input scale to export map in pdf ol3













0















This is my code to export map in pdf but i want to fix this map in 1:4000 scale the n export or print it to pdf.



var dims = {
a0: [1189, 841],
a1: [841, 594],
a2: [594, 420],
a3: [420, 297],
a4: [297, 210],
a5: [210, 148]
};

var exportElement = document.getElementById("export-pdf");
exportElement.addEventListener('click', function(e) {
console.log("hi");
if (exportElement.className.indexOf('disabled') > -1) {
return;
}
exportElement.className += ' disabled';

var format = document.getElementById('format').value;
var resolution = document.getElementById('resolution').value;
var buttonLabelElement = document.getElementById('button-label');
var label = buttonLabelElement.innerText;
var dim = dims[format];
var width = Math.round(dim[0] * resolution / 25.4);
var height = Math.round(dim[1] * resolution / 25.4);
var size = /** @type {ol.Size} */ (map.getSize());
var extent = map.getView().calculateExtent(size);

map.once('postcompose', function(event) {
//var tileQueue = map.getTileQueue();

// To prevent potential unexpected division-by-zero
// behaviour, tileTotalCount must be larger than 0.

//var tileTotalCount = tileQueue.getCount() || 1;
var interval;
interval = setInterval(function() {
//var tileCount = tileQueue.getCount();
//var ratio = 1 - tileCount / tileTotalCount;
//buttonLabelElement.innerText = ' ' + (100 * ratio).toFixed(1) + '%';
//if (ratio == 1 && !tileQueue.getTilesLoading()) {
clearInterval(interval);
buttonLabelElement.innerText = label;
var canvas = event.context.canvas;
var data = canvas.toDataURL('image/jpeg');
var pdf = new jsPDF('landscape', undefined, format);
pdf.addImage(data, 'JPEG', 0, 0, dim[0], dim[1]);
pdf.save('map.pdf');
map.setSize(size);
map.getView().fit(extent, size);
map.renderSync();
exportElement.className =
exportElement.className.replace(' disabled', '');
// }
}, 100);
});

map.setSize([width, height]);
map.getView().fit(extent, /** @type {ol.Size} */ (map.getSize()));
map.renderSync();

}, false);


any help would be highly appriciated.









share



























    0















    This is my code to export map in pdf but i want to fix this map in 1:4000 scale the n export or print it to pdf.



    var dims = {
    a0: [1189, 841],
    a1: [841, 594],
    a2: [594, 420],
    a3: [420, 297],
    a4: [297, 210],
    a5: [210, 148]
    };

    var exportElement = document.getElementById("export-pdf");
    exportElement.addEventListener('click', function(e) {
    console.log("hi");
    if (exportElement.className.indexOf('disabled') > -1) {
    return;
    }
    exportElement.className += ' disabled';

    var format = document.getElementById('format').value;
    var resolution = document.getElementById('resolution').value;
    var buttonLabelElement = document.getElementById('button-label');
    var label = buttonLabelElement.innerText;
    var dim = dims[format];
    var width = Math.round(dim[0] * resolution / 25.4);
    var height = Math.round(dim[1] * resolution / 25.4);
    var size = /** @type {ol.Size} */ (map.getSize());
    var extent = map.getView().calculateExtent(size);

    map.once('postcompose', function(event) {
    //var tileQueue = map.getTileQueue();

    // To prevent potential unexpected division-by-zero
    // behaviour, tileTotalCount must be larger than 0.

    //var tileTotalCount = tileQueue.getCount() || 1;
    var interval;
    interval = setInterval(function() {
    //var tileCount = tileQueue.getCount();
    //var ratio = 1 - tileCount / tileTotalCount;
    //buttonLabelElement.innerText = ' ' + (100 * ratio).toFixed(1) + '%';
    //if (ratio == 1 && !tileQueue.getTilesLoading()) {
    clearInterval(interval);
    buttonLabelElement.innerText = label;
    var canvas = event.context.canvas;
    var data = canvas.toDataURL('image/jpeg');
    var pdf = new jsPDF('landscape', undefined, format);
    pdf.addImage(data, 'JPEG', 0, 0, dim[0], dim[1]);
    pdf.save('map.pdf');
    map.setSize(size);
    map.getView().fit(extent, size);
    map.renderSync();
    exportElement.className =
    exportElement.className.replace(' disabled', '');
    // }
    }, 100);
    });

    map.setSize([width, height]);
    map.getView().fit(extent, /** @type {ol.Size} */ (map.getSize()));
    map.renderSync();

    }, false);


    any help would be highly appriciated.









    share

























      0












      0








      0








      This is my code to export map in pdf but i want to fix this map in 1:4000 scale the n export or print it to pdf.



      var dims = {
      a0: [1189, 841],
      a1: [841, 594],
      a2: [594, 420],
      a3: [420, 297],
      a4: [297, 210],
      a5: [210, 148]
      };

      var exportElement = document.getElementById("export-pdf");
      exportElement.addEventListener('click', function(e) {
      console.log("hi");
      if (exportElement.className.indexOf('disabled') > -1) {
      return;
      }
      exportElement.className += ' disabled';

      var format = document.getElementById('format').value;
      var resolution = document.getElementById('resolution').value;
      var buttonLabelElement = document.getElementById('button-label');
      var label = buttonLabelElement.innerText;
      var dim = dims[format];
      var width = Math.round(dim[0] * resolution / 25.4);
      var height = Math.round(dim[1] * resolution / 25.4);
      var size = /** @type {ol.Size} */ (map.getSize());
      var extent = map.getView().calculateExtent(size);

      map.once('postcompose', function(event) {
      //var tileQueue = map.getTileQueue();

      // To prevent potential unexpected division-by-zero
      // behaviour, tileTotalCount must be larger than 0.

      //var tileTotalCount = tileQueue.getCount() || 1;
      var interval;
      interval = setInterval(function() {
      //var tileCount = tileQueue.getCount();
      //var ratio = 1 - tileCount / tileTotalCount;
      //buttonLabelElement.innerText = ' ' + (100 * ratio).toFixed(1) + '%';
      //if (ratio == 1 && !tileQueue.getTilesLoading()) {
      clearInterval(interval);
      buttonLabelElement.innerText = label;
      var canvas = event.context.canvas;
      var data = canvas.toDataURL('image/jpeg');
      var pdf = new jsPDF('landscape', undefined, format);
      pdf.addImage(data, 'JPEG', 0, 0, dim[0], dim[1]);
      pdf.save('map.pdf');
      map.setSize(size);
      map.getView().fit(extent, size);
      map.renderSync();
      exportElement.className =
      exportElement.className.replace(' disabled', '');
      // }
      }, 100);
      });

      map.setSize([width, height]);
      map.getView().fit(extent, /** @type {ol.Size} */ (map.getSize()));
      map.renderSync();

      }, false);


      any help would be highly appriciated.









      share














      This is my code to export map in pdf but i want to fix this map in 1:4000 scale the n export or print it to pdf.



      var dims = {
      a0: [1189, 841],
      a1: [841, 594],
      a2: [594, 420],
      a3: [420, 297],
      a4: [297, 210],
      a5: [210, 148]
      };

      var exportElement = document.getElementById("export-pdf");
      exportElement.addEventListener('click', function(e) {
      console.log("hi");
      if (exportElement.className.indexOf('disabled') > -1) {
      return;
      }
      exportElement.className += ' disabled';

      var format = document.getElementById('format').value;
      var resolution = document.getElementById('resolution').value;
      var buttonLabelElement = document.getElementById('button-label');
      var label = buttonLabelElement.innerText;
      var dim = dims[format];
      var width = Math.round(dim[0] * resolution / 25.4);
      var height = Math.round(dim[1] * resolution / 25.4);
      var size = /** @type {ol.Size} */ (map.getSize());
      var extent = map.getView().calculateExtent(size);

      map.once('postcompose', function(event) {
      //var tileQueue = map.getTileQueue();

      // To prevent potential unexpected division-by-zero
      // behaviour, tileTotalCount must be larger than 0.

      //var tileTotalCount = tileQueue.getCount() || 1;
      var interval;
      interval = setInterval(function() {
      //var tileCount = tileQueue.getCount();
      //var ratio = 1 - tileCount / tileTotalCount;
      //buttonLabelElement.innerText = ' ' + (100 * ratio).toFixed(1) + '%';
      //if (ratio == 1 && !tileQueue.getTilesLoading()) {
      clearInterval(interval);
      buttonLabelElement.innerText = label;
      var canvas = event.context.canvas;
      var data = canvas.toDataURL('image/jpeg');
      var pdf = new jsPDF('landscape', undefined, format);
      pdf.addImage(data, 'JPEG', 0, 0, dim[0], dim[1]);
      pdf.save('map.pdf');
      map.setSize(size);
      map.getView().fit(extent, size);
      map.renderSync();
      exportElement.className =
      exportElement.className.replace(' disabled', '');
      // }
      }, 100);
      });

      map.setSize([width, height]);
      map.getView().fit(extent, /** @type {ol.Size} */ (map.getSize()));
      map.renderSync();

      }, false);


      any help would be highly appriciated.







      openlayers





      share












      share










      share



      share










      asked 4 mins ago









      sanju vermasanju verma

      225




      225






















          0






          active

          oldest

          votes











          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "79"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f313842%2fhow-to-fix-scale-14000-to-export-map-in-pdf-ol3%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Geographic Information Systems Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f313842%2fhow-to-fix-scale-14000-to-export-map-in-pdf-ol3%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Щит и меч (фильм) Содержание Названия серий | Сюжет |...

          Венесуэла на летних Олимпийских играх 2000 Содержание Состав...

          Meter-Bus Содержание Параметры шины | Стандартизация |...