PDF from a map in a Python script

Hello,
I am trying to make a PDF from a map in a stand alone python script - does anyone have any examples of how to do this?

I have tried the gxapi.GXPDF3D.export_2d() function and this does produce a pdf, but it is tiny. I don't understand how this function is supposed to works as there is no place to input a page size.
import geosoft.gxpy as gxpy
import geosoft.gxapi.GXPDF3D as PDF3D

gxc = gxpy.gx.GXpy()
PDF3D.export_2d('test.map','test.pdf',0,0,0)

Any other options or suggestions?

Thanks,
Dave

Comments

  • Hi Dave,

    Another option might be in the geosoft.gxpy.map module in the documentation.

    If you have a geosoft map file you can open it create a map object by using the open method.
    Then if you use the image_file method you can save the map to an image. There are various formats. PDF does not appear to be one, but you could save it as a PNG (default) and then use another python library (such as img2pdf) to convert the PNG to a PDF. The image_file method lets you set the size of the map in pixels so hopefully will overcome the small map issue.

    I hope this helps.

    Cheers
    Sean
  • Thanks Sean, good idea. Just skip the PDF3D_export_2d() by using another python library to get the pdf out. To be clear, when I said the function was making a tiny PDF I didn't mean just a small one, but rather just a file name. The page size was as close to a zero page size as I imagine a PDF will allow (like 0.04 X 0.04 inches)
This discussion has been closed.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!