Moshe,
1) Agreed on dispensing with the picklist, although, in all honesty, a
robust version of the code should have it, as the goal for any such snippet
is to minimize the effort involved in going from a dataset to the final
product, and having to remove layers from a file has the potential to get
repetitive. That said, I'm all for it not being around for now. Mike,
Larry, you've both got immediate applications for this code. Any thoughts?
2) Interesting, but I suspect we'll need the printer preset for the layout
to work anyway (try seeing what happens when you make a layout with a paper
printer, draw a view, and change the printer to PDF Creator. I always get a
strange shift in map view location to be offcenter, even if the paper size
of my printer matches the size for the PDF printer). Thus, if we can
require that as part of our spec for the user when building a template, and
then directly use the printer from there, this would be ideal.
3) I'm actually not sure why we need to create separate layouts. Can we
not set the map view to our map, and refresh it programmatically, or is
there some other reason I'm missing?
4) I like the solution of the legend as a separate layer. In Acrobat you
can set the layer to always display, or make it part of the base layer,
etc. Should be nice.
4.5) Text & Searchable Text. Sadly, before I had to leave my
maptitude/acrobat setup on friday I didn't have time to explore this
completely. Here is what I have.
One of the great joys of PDFs is that text is searchable, and as such, that
labels, if converted to text, are also searchable. Unfortunately, when
testing, I was unable to get automatic labels into the PDF (this may have
been my system which was in desperate need of a reboot towards the end of
the day), and only could get searchable labels by producing a series of
manual labels, turning off the layer, refreshing the layout (now showing
only the labels), and printing to PDF. This AnnotationLayer PDF, once
brought into Acrobat, was searched when one uses the find function in
Acrobat. You will *not *see this behaviour in the current Proof of
Concept uploaded as that was based on PNGs, rather than directly being
output to PDFs. Note that if someone wants to have some annotations
searchable, and others not searchable (eg: don't search in the
boilerplates), the solution is to have some be images, and others text.
Problems with Searchable Text.
a) Does it work for Automatic labels? If it does, it seriously raises
question if what follows is necessary. I still think it'd be nice, but
maybe not necessary. Certainly for zoom controlled annotations we'll need
them in separate layers. I suppose if it does work, the ideal would be to
have a variable that would say whether or not to separate annotations from
layers or not.
b) In any case, in theory, one wants searchable text to be in its own
separate layer.
Annotations are great, but they can easily hide data. Especially if
multiple layers have annotations.Thus... I guess...
- Turn on layer,
- show labels
- (if necessary?... should be able to spec that if you want a label
layer, create them as part of your base map and have them on,
thus, we check
to see if we should create labels by seeing if they're already there),
- convert to graphics,
- turn off layer,
- refresh layout,
- print,
- delete all graphics in map
- turn on layer,
- turn off labels (if necessary?),
- refresh layout,
- print,
- turn off layer,
rinse repeat. Every layer (or every layer with labels) would thus get a
separate annotation PDF produced.
c) Acrobat Search pans, not zooms. This is an ugly problem, even in a full
GIS. What should it zoom to? This can be dealt with by using bookmarks in
Acrobat rather than encouraging searching, but this is only a partial
solution. Not a maptitude problem, in any case. A better zooming solution
may be the key. The ideal of course, would be a way to use Acrobat (which
does know font size), to display at font size rather than zooming. Not
quite sure how that is accomplished though.
5) Legends... I'm not quite clear on how determining legend placement will
work. How can it be in a template, if the user cannot have it in a template
because there is no filled map?
I do like the line of thinking with the layout naming scheme and the legend
logic (and layer order placement). Should make potential scripting easier
for the other side of things. Very nice. Also, I'm sure you're right about
PDF Creator, but as you pointed out, Acrobat can do this, and for the moment
we are assuming users will have acrobat handy (although, using iText would
allow this to function without a copy of Acrobat... which would mean
Maptitude layered PDF support using only maptitude and free products).
In any case, very cool.
Thanks a lot,
Josh
On Jan 12, 2008 11:31 PM, Moshe Haspel <[EMAIL PROTECTED]> wrote:
> Josh,
>
> Great points.
>
> Re assumptions, and your comments:
>
> 1) It looks like we are moving toward a model where the user gets the
> map (and possibly a layout) exactly the way he/she wants it, then we
> use those documents as models when printing the layers. So unless
> anyone thinks we should do otherwise, I think we can dispense with the
> layers picklist?
>
> 2) You can get a list of installed printers with GetPrinters()
> e.g.
> printers = GetPrinters()
> ShowArray(printers)
> Not sure how to use that info though... needs more research
>
> 3) This is a great idea. If the user designs a layout, we can probably
> get the info we need using some combination of GetLayoutOptions() and
> LayoutProperties()
>
> GetLayoutOptions() has a SetLayoutOptions() counterpart. And
> LayoutProperties() may even let us handle the printer issue.
>
> Try this with an open layout:
> properties = LayoutProperties()
> ShowArray(props)
>
> Again, needs more research.
>
> But the important thing is that if the user places the map to his/her
> preferred size, etc. we can get that info via GetAnnotation() and use
> it when creating the separate layouts!
>
> 4) Actually, I don't think it needs to be that complicated. We'll
> always want the legend to show up, so we just put it on its own
> layer-- the last one that gets drawn. Legend placement, like map
> placement, can be solved via GetAnnotation()-- find out where the user
> put it in the layout template.
>
> The big problem that I had was that you can't place a legend in a
> layout without placing its corresponding map in the layout as well. Or
> if it is possible, I have no idea how. In fact, if you place a map and
> legend in a layout, then remove the map, the legend goes bye-bye as
> well! Your solution is brilliant-- just place the map off of the page.
>
> Re: labels, we can convert automatic labels to "freehand" with:
> ConvertAutomaticToManualLabels(map_name)
> HideMapLabels(map_name)
>
> Then we can select them all and delete them with:
> annots = SelectAllAnnotations("map|"+map_name)
> DropSelectedAnnotations(annots)
>
> Could you explain a bit more about the searchable text issue?
>
> Re: Printing invisibly, I'm sure there is a setting somewhere in the
> program that allows you to turn off "prompt for file name" or some
> such. I know you can do this in Acrobat. Acrobat uses the window name
> as the default name for the PDF; the script is gives each layout a
> unique name so that the printing from the second time through the loop
> won't overwrite the printing from the first time. In fact, the layouts
> are named 01, 02, ... so that they will appear in alphabetical order.
>
> I'm posting a new version (v0.11) that has some legend handling logic.
> Again, the paper size/shape, map placement and size, legend placement
> are just arbitrary things I chose for proof of concept. We'll need to
> deal with them eventually.
>
>
> --- In [email protected] <Maptitude%40yahoogroups.com>, "Josh
> Rosenthal" <[EMAIL PROTECTED]> wrote:
> >
> > Moshe,
> >
> > Thanks for taking up the torch. I haven't tried out the code and
> will do so
> > monday when I get back to a friendly copy of maptitude. A few
> thoughts.
> > *
> > Assumptions:*
> > 1), 2) good. (I'll try and see if PDF Creator uses a reliably standard
> > printer install name we could assume and work with to avoid requiring
> > constant changing of default printers, and just set the name as a
> variable.
> > Earlier testing indicated it did, and that one could use the Acrobat PDF
> > converter printer equally, but I'll look at that again later.)
> >
> > 3) Rather than assume paper size, could we assume an open layout with an
> > empty map frame. This should allow a user to build their own templates
> > controlling paper size and layout annotations they might want. We might
> > also have the system create a print with the map frame empty just
> showing
> > any annotations on the layout itself for use as the initial PDF.
> >
> > 4) Conceptually, the Legend behavior is problematic. Strictly
> speaking, we
> > want to somehow capture the complete legend, with all layers, but
> we'd want
> > that to be able to be displayed on all layers (or on our annotation
> layer?),
> > and allow user control of location in the template, (or only display the
> > relevant part, but in a related but not overlapping location). Not
> sure how
> > that could be done, to display a legend that doesn't actually
> represent the
> > frame shown?. For now, it makes sense to leave it out, I guess. (Could
> > one, in theory, create a map frame, thus generating the legend, and then
> > hide it by moving it out of sight, or deleting it, and still retain the
> > legend?)
> >
> > *Structure Notes:*
> > Given (3) above, Loop 2 would then change the layers and (after the
> first
> > time) refresh the frame rather than opening a layout. In theory we
> could do
> > this by opening a layout arbitrarily named (ie: "PDFLtemplate.lay")
> rather
> > than using an open layout.
> >
> > *Labels:*
> > Also... so far, I've only had searchable labels work when I make
> them manual
> > labels, ie: objects. This requires more testing, but how could we
> capture
> > those on their own layer(s) without having them show up in multiple
> layers,
> > or otherwise getting lost.
> > Possible solution: For each "On" layer, print twice. First time, as
> > normal. Second time, turn on the layer, convert labels to graphics,
> turn
> > off labels, refresh layout, and print. How we keep track of those
> > annotations to delete them before we iterate, I'm not sure of.
> >
> > *Printing Invisibly*:
> > Printing from PDF Creator currently requires user involvement (entering
> > name, created by, save locations, etc). I know in theory there are
> ways to
> > use it in assorted batched work. Anyone out there have any
> experience in
> > this?
> >
> > That said, I like it!
> >
> > Next step (which may be beyond me, but I'll take a look and at least
> try to
> > get a sense of how it should be done) would be to script the acrobat
> side of
> > things.
> >
> > Thanks a lot!
> >
> > Josh Rosenthal
> > GIS Supervisor
> > Massachusetts Historical Commission
> >
> > On Jan 11, 2008 5:29 PM, Moshe Haspel <[EMAIL PROTECTED]> wrote:
> >
> > > --- In [email protected]
> > > <Maptitude%40yahoogroups.com><Maptitude%40yahoogroups.com>,
> "Josh
> > > Rosenthal" <maric423@> >
> > >
> > >
> > > Anyone want to write a DK script to cycle through a user selected
> > > subset of layers in a map, use a layout as a template and using
> > > Printer=PDFCreator produce all the component layers?
> > >
> > > ==
> > >
> > > I'll take the first crack at this... A little unfair because I am
> > > tearing off some of the easiest parts.
> > >
> > > For the purposes of a quick solution, I am going to assume:
> > > 1) All non-hidden layers in the map should be printed
> > > 2) PDFCreator is selected as the default printer in windows
> > > 3) The map is to be on an 8.5x11 "paper"
> > > 4) There is no map legend
> > > 5) Other stuff I haven't considered yet???
> > >
> > > We can always relax these assumptions later.
> > >
> > > The code (which I will upload to the Files area as "Layers2PDF
> > > v0.1.rsc") loops through all layers three times:
> > >
> > > Loop 1: For each layer, store whether it is "hidden" or "shown." Then
> > > hide it.
> > >
> > > Loop 2: For layers that were found to be "shown" in Loop 1, show each
> > > one by one, open a layout, put the map with just that layer shown in
> > > the layout, and print. Then hide the layer again.
> > >
> > > Loop 3: Restore all layers to their original status.
> > >
> > >
> > >
> >
>
>
>