MathGroup Archive 2008

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Import syntax question

  • To: mathgroup at smc.vnet.net
  • Subject: [mg85496] Re: Import syntax question
  • From: Mark Fisher <particlefilter at gmail.com>
  • Date: Wed, 13 Feb 2008 04:03:50 -0500 (EST)
  • References: <fomk40$hv9$1@smc.vnet.net> <fopbm9$buh$1@smc.vnet.net>

On Feb 11, 6:31 am, David Reiss <dbre... at gmail.com> wrote:
> Of course you could do something like
>
> Import["file.pdf", #]&/@ {"Author", "Title"}
>
> though it does call Import twice....
>
> --David
> A WorkLife FrameWork
> E x t e n d i n g MATHEMATICA's Reach...http://scientificarts.com/worklife/
>
> On Feb 10, 5:36=A0am, Mark Fisher <particlefil... at gmail.com> wrote:
>
> > Hi all,
>
> > I find Import wonderful but frustrating. For example, I can get
> > individual items such as "Author" and "Title" in separate calls:
>
> > Import["file.pdf", "Author"]
> > Import["file.pdf", "Title"]
>
> > but I can't get a list as in
>
> > Import["file.pdf", {"Author", "Title"}]
>
> > Instead I get an error message that say "Title" is not present (which
> > seems misleading at best, since I already accessed it above). Is that
> > syntax supposed to work or not? (Frankly, I'm having a hard time
> > figuring out what the proper generic syntax is for Import, especially
> > since there are so few examples in the documentation.)
>
> > BTW, I found out I can use
>
> > {"Author", "Title"} /. Import["file.pdf", "Rules"]
>
> > Is that what I "should" be doing? (It seems like overkill since Import
> > has to import a bunch more stuff that I don't want, at least in this
> > example.)
>
> > --Mark

I sent an email to support and got a response that told me how to do
it:

Import["file.pdf", {{"Author", "Title"}}]

It was pointed out to me that there is an example on the PDF
documentation page that illustrates this. It was also pointed out that
the Import documentation page states that

Import[..., {expr1, expr2, ...}]

is for importing subexpressions of (sub)expressions. What was not
pointed out, however, is that (as far as I can tell) the correct
syntax is *not* noted on the Import page nor is it stated outside of
scattered examples (to my knowledge).

--Mark


  • Prev by Date: Re: Fitting experimental data
  • Next by Date: Troubles with HarmonicNumber, empty sums, and Zeta
  • Previous by thread: Re: Import syntax question
  • Next by thread: Import pdf problem