SHARE
TWEET

Untitled

a guest May 22nd, 2019 68 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. from qgis.core import (QgsProject, QgsLayoutExporter, QgsApplication)
  2.  
  3.  
  4. QgsApplication.setPrefixPath("C:/OSGeo4W64/apps/qgis", True)
  5.  
  6. gui_flag = False
  7. app = QgsApplication([], gui_flag)
  8.  
  9. app.initQgis()
  10.  
  11. project_path = '//192.168.172.131/38262/I/2015PN37-T3C/19-avoisinants/SIG/L15 T3_MAP_v10_20190315_QGIS3.qgz'
  12.  
  13. project_instance = QgsProject.instance()
  14. project_instance.setFileName(project_path)
  15. project_instance.read()
  16.  
  17. manager = QgsProject.instance().layoutManager()
  18. tun_list = ["TR1","TR2"]
  19. for tun in tun_list:  
  20.     layout = manager.layoutByName(tun)
  21.            
  22.     exporter = QgsLayoutExporter(layout)
  23.     exporter.exportToPdf('e:\\Users\\louis.monnier\\Desktop\\L15-T3C\\Suivi ouvrages\\TR1\\DonnĂ©es tunnelier\\qgis_%s.pdf'%(tun), QgsLayoutExporter.PdfExportSettings())
  24.  
  25. app.exitQgis()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top