Skip to content
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

Export-Import PDF Metadata - Geospatial data not written to output #42

Open
twestley opened this issue Apr 1, 2023 · 5 comments
Open

Comments

@twestley
Copy link

twestley commented Apr 1, 2023

I tried scaling a CalTopo PDF map with geospatial data. The scaling works; I like it.

But the output file was missing the geospatial data.

@tavinus
Copy link
Owner

tavinus commented Apr 7, 2023

Any examples? Maybe changing the mode could help. We depend on Ghostscript. If it is possible in GS, we can do it...

@twestley
Copy link
Author

twestley commented Apr 25, 2023

Thanks for responding. The attached script, scale.txt, generates a PDF file but fails to reproduce the spatial data in it. What am I doing wrong? (I'm using Avenza Maps on iPhone to determine whether I've got spatial data or not.)

scale.txt -i AmherstPeanut.pdf -o AmherstPeanut-scaled.pdf -s 0.9

AmherstPeanut.pdf
scale.txt

@tavinus
Copy link
Owner

tavinus commented May 23, 2023

From this post, it seems like Ghostscript will never preserve metadata.
https://unix.stackexchange.com/questions/50475/how-to-make-ghostscript-not-wipe-pdf-metadata

However, you can use exiftool or pdftk to copy the metadata from one pdf to another (needs to be tested). You will probably need to install them in your system though. There are examples on the link above. You could replace the whole gs call in the pdftk example with the pdfscale call if you want.

Maybe this could be added as an optional feature to pdfscale.

@twestley
Copy link
Author

Thanks for looking at this. After trying qpdf, pdftk, pdfunite, and pdfjam, I discovered that qpdf works to overlay a legend pdf on a map pdf:

qpdf --overlay legend.pdf --repeat=1 -- map.pdf combined.pdf

The geospatial data is retained in combined.pdf above so problem solved.

@tavinus
Copy link
Owner

tavinus commented May 29, 2023

Pretty interesting. I may have a look into this when I have some time. Maybe we can automate this process within pdfScale (external tool install will be needed though).

@tavinus tavinus changed the title Geospatial data not written to output Export-Import PDF Metadata - Geospatial data not written to output Jul 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants