Export leaflet map as PDF to server - leaflet

I use Leaflet to display basemaps, wms layers, multipoints, multipolygons and multilinestrings. Is there a way with JavaScript to directly, upon button click, save screenshot of map as PDF with document header and footer (image in the middle) on the server?
Today I am able to save screenshot as PDF locally on my computer with help of Leaflet plugin browser-print and print-save it as a PDF. I can then upload the file to the server and all is well. However, I want to skip this manual part of printing map as pdf, save it locally and then upload it.

You can try this package works great:
https://github.com/grinat/leaflet-simple-map-screenshoter
I used it with Vue.js and make it a screenshot from WMS and Geo maps as well.
Send the data like base64image on a server and there I use https://github.com/puppeteer/puppeteer to create a PDF.

Related

Interactive dynamic online Map using QGIS

I am want to deploy a map from QGIS to a website. I am using a plugin called "Leaflet" which works perfectly with my map layers by generating HTML code to add in my website's HTML code. The problem is whenever I want to change something in my map layers, I have to generate a new HTML code and add it again in my website.
Is there a way to automate the whole process? Is it possible to connect my whole QGIS project to my website or something similar?
Thanks in advance

In TinyMCE is there a feature to allow pasting images when using the backend image load handler which saves uploaded images on the server?

I'm using the image upload script with a backend URL to rename uploaded images stored on the server. It seems to work well with both file uploads and also drag-and-drop.
Without that backend handling you can paste images directly into the editor, but they get saved as base64 with the post in the db itself which is not great for a lot of reasons.
If I use the image upload script as I am now, it seems it blocks the pasting of images directly into the editor. That's safest, I guess, but I was wondering if there was a way of allowing it, but treating the pasted image like a drag-and-drop image, for example, so we could have the convenience of pasting images but still have them saved with unique filenames on the server instead of being embedded as base64 with the rest of the source of the post?
Thanks.

How to optimize GeoJSON file size before uploading to Mapbox Studio

I have a GeoJSON file that I'd like to upload to Mapbox Studio as a tileset, so that I can use this custom data as a layer in my map style. The file is larger than the 300MB Studio upload limit. I know that I could use the Uploads API to upload it instead, or use Mapbox Tiling Service to both optimize the data with a recipe, and upload it as a tileset, but I'm less familiar with the command line.
Is there another option to remove some data properties I don't need from my GeoJSON file (so that I can reduce the size below 300 MB) and then upload it to Mapbox Studio as a tileset?
Following comments from 2018 on this GIS Stack Exchange post, I was able to:
Add my GeoJSON file as a new Vector Layer in QGIS,
Select "Open Attribute Table" and click the "Delete field" icon mentioned in this documentation (see screenshot below). I then selected about half of my file's fields (which I don't need) and deleted them.
I right-clicked on my layer and exported it.
This cut my file size in half, and I was able to upload to Studio on the tilesets page in my Mapbox account!
It looks like another viable option to remove unnecessary fields using QGIS would be to go to Layer > Save As and only select certain fields I want to include (see screenshot below), and export the layer before uploading the optimized file to Studio.

How to generate chart and save as Jpeg by using Gwt visualization API

GWT,Java framework. I wanted to generate chart and save it as jpeg file for sending report's graph to user's email.
I am using GWT visualization api to generate chart for fron-end view. But I wanted to generate chart and save it as jpg in server side.
can any one help me that How to save file as jpeg in server side by using GWT visualization api?
I know a script which can export SVG chart to other format. Do you users' browsers support SVG ?

How to read PDF file from right to left on iOS

I am working on a basic project that reads pdf files from a server and show them on the screen.
The issue is that i want to read that files from right to left as a page.
Like Massimo Cafaro say :
If you want to extract some content from a pdf file, then you may want to read the following:
Parsing PDF Content
from the Quartz 2D programming guide.
Basically, you will use a CGPDFScanner object to parse the contents, which works as follows. You register a few callbacks that will be automatically invoked by Quartz 2D upon encountering some pdf operators in the pdf stream. After this initial step, you then actually start parsing the pdf stream.
Taking a brief look at your code, it appears that you are not following the steps required to parse the pdf content of the page you get through CGPDFDocumentGetPage(). You need first to setup the callbacks using CGPDFOperatorTableCreate() and CGPDFOperatorTableSetCallback(), then you get the page, you need to create a content stream using that page (using CGPDFContentStreamCreateWithPage()) and then instantiate a CGPDFScanner through CGPDFScannerCreate() and actually start scanning through CGPDFScannerScan().
The "Parsing PDF Content" section of the document pointed out by the above URL gives you all of the information required to implement pdf parsing.
if you don't try anything you can start with this project link