Monday 31 December 2012

Nelson Section map in production [2]

I have pasted about half the maps so far into the document so progress is being made. Unfortunately when I saved this as a PDF, a further conversion stage has resulted in unacceptable additional style changes that are departing too far from where the map was originally. It is starting to look like, if I want to produce a PDF format map, I will have to look at ways it can be output using the PDF export capability directly from Qgis. Otherwise there is too much lost in the conversions of various stages of the map into a document format.

I have done a bit more experimentation and have exported a map as a PDF. It was then opened in Word, and then published back to PDF format. The result was that the styles were still being preserved much closer to the original styles, even allowing for the conversions that have occurred. Creating a multi page version in Word copying and pasting the original graphic still produced the much higher style. The problem seems to be in the conversion of, firstly, Qgis to SVG, which is known to have significant issues, and secondly, SVG to EMF from Inkscape to Word. Then a further problem occurs with the conversion of EMF in Word to PDF, which is probably now EPS format. Word seems to be handling the conversion from EPS to EMF and back to EPS a lot better, and therefore we have to assume that Inkscape isn’t doing its part of the conversion very well, apart from the Qgis to SVG problem.

At this stage I thought I would take a look at how Inkscape handles PDF files, which it can also open. The file looked exactly right in Inkscape when opened, but again lost detail in the clipboard conversion to EMF for Word, where it looks like the other EMFs. When I saved from Inkscape to an EPS and then tried to paste it in Word, it could not be displayed in Word. The save to EMF file format revealed where the main problem is occurring – Inkscape’s extremely limited EMF conversion support is obviously the problem.

It appears I will have to revisit my scenario of using Acrobat or another PDF authoring tool if I want to produce the maps in PDF format. There are just a lot of issues with SVG because Word can’t import SVG and Inkscape can’t convert it to EMF satisfactorily, then Word has another problem converting the EMF back into whatever it puts into PDFs (EPS?). Part of the problem is that Qgis can’t produce multiple page map outputs. If I could produce the multipage document as one PDF and then bring it into Word things would go much better overall.

Well after some more experimentation it has been determined what will happen (what will have to happen) is that all 60 of the SVGs I already produced will have to be redone as PDFs. Then each is individually opened in Word, and the graphic copied and pasted into the map document (also in Word). Then this is saved and later produced as a PDF again. There are going to be far fewer problems, but it means the map document release will be delayed by another day, probably it will come out tomorrow. Whether Inkscape is going to be of use for print production or not is really still moot. The reason I stuck with it so far is that the SVG conversion of the Waiau Branch map sample wasn’t too bad, and in fact it looked far more like the original than the stuff in Word. This is all because I didn’t convert the SVG to EMF for Word at any stage so the result was much more realistic. We could still use Inkscape and SVGs as an intermediate to produce pages of a printed map, provided there is no need to convert to another format, so this will have to be looked at in further detail as part of the Q5 development, if Qgis is used to produce those maps. Inkscape can also work with PDF files, but it can’t save SVGs acceptably in PDF format, so whether it can edit a PDF satisfactorily without losing detail will remain to be seen.

I have done a little bit of experimentation since then and it looks like Inkscape can open and edit a PDF satisfactorily, but it can only work with single page PDFs. So you could edit the PDFs as they come of out Qgis, save them back to PDF and have a satisfactory outcome, provided that the PDF format supports the same kind of Inkscape capabilities as using SVG does. It looks very much as though this is the case. Therefore the next post in the Quail replacement series will be about the rotational capabilities, from exporting to PDF, and using Inkscape to edit the PDF then save it back to PDF again.

Progress is now being made with the maps using the new PDFs. The main issue is that Word takes over a minute to open each PDF and convert it. Therefore it takes about two minutes for each of the 52 PDFs to open, extract the image and paste it into the map document. There are now 52 maps which is down from 60 in the original edition so that the complete document will be about 30 pages.