Odds and Ends, and YAPS on VFP PDF

by Lisa Nicholls Tue, June 22 2010 10:25

I've still got a bunch of questions tee'd up to answer, and no time to do it.  Why?

Derek and Lila got married two weeks ago!  Jonah continues to be absorbingly interesting! And Paul Zygielbaum turned 60 last week, which was a matter of great joy and moment to his family and friends for many reasons.

BTW, although I didn't publish any news about this when it happened, Derek doesn't work for EFF any more. Here's a sample of what he's up to now.  Lots more where this one comes from.  Derek and Lila, who is equally cool, prodigiously talented, and committed to making the world a better place, met during the EFF period, though, so that's just one more reason for me to thank EFF  ;-).

But mostly, my work hours
just don't permit much time here.

I steal just enough time
for family events,
and a little gardening.

I am trying to do something about my work schedule, and I hope to start posting answers to your questions, especially Ehud's latest conundrum since he's come up with another corker, soon.

Here are a few random notes to grease the skids and get me back into practice.

1. Adrian's helpful notes on PDFs

Adrian H has written to say:

We had trouble when upgrading our installation to GS v8.71, using the "silent install" of GS from a DB table.
VFP adds a .txt extension to filenames with no extension, which made Ghostscript unhappy.
Here's a mod to Lisa's prg that creates/replaces the installer table directly in the DBC and nixes the bogus .txt extensions.

GS v8.71, incidentally, allows copying text from the generated PDF. GS v7 produced garbled text on copy/paste.

  ... and he includes a modification to the "quick and dirty CreateInstallDBF.PRG" program that I added to the article, to show the basic principle of what needs to be included in an Install.DBF for GhostScript.

Please do use Adrian's mods, in the blog post comment he wrote, if you plan to use that particular PRG to create your install DBF -- actually I will repeat them here for the purposes of syntax coloring and stuff -- -- although there are many ways to do so. You may already have created your own method of defining the files that you wish to deploy in production and scarfing them up in a DBF/FPT form, my PRG was just supposed to describe the required steps briefly.

* CREATEINSTALLDBF.PRG
* >L<'s Q&D program
* for gathering the GhostScript
* files required for installation
* (c) Lisa Slater Nicholls
* Modified by Adrian [adrianh at midcoast.com]

LOCAL
lcTopDir, lcFile
PRIVATE ALL LIKE j*
CLOSE DATABASES
= MESSAGEBOX ("Open the database and Specify the table in the next dialogs...")
OPEN DATABASE

? jcInstall= PUTFILE ("Install dbf...","GSinstall","dbf")

IF EMPTY
   (jcInstall) = MESSAGEBOX ("User cancelled")
   RETURN
ENDIF

DROP TABLE JUSTSTEM(jcInstall)


CREATE TABLE
(jcInstall) (filename c(120), DIR c(10), contents m NOCPTRANS )

= MESSAGEBOX ( "Find dir for GS Executable in next dialog...")
lcTopDir = GETDIR ()
lcTopDir = ADDBS (lcTopDir)

SET NOCPTRANS TO
contents
DO GetFiles WITH lcTopDir, ""
DO GetFiles WITH lcTopDir, "fonts\"
DO GetFiles WITH lcTopDir, "lib\"
jQuery1520962885844600045_1342192883884 CHR (7)
= MESSAGEBOX ("Mission accomplished...")
RETURN

PROCEDURE
   GetFiles(tTopDir, tSubDir)

   LOCAL lcFile, lcDir
   lcDir = tTopDir + tSubDir 
   lcFile = SYS(2000,FORCEPATH ("*.*",lcDir))
   DO WHILE NOT EMPTY (lcFile)
      INSERT INTO (jcInstall)(filename, DIR) ;
         VALUES
(JUSTFNAME (lcFile),tSubDir)
      APPEND MEMO contents ;
         FROM (FORCEPATH (lcFile,lcDir))

      *If the filename does not have an extension,
      *VFP forces the file extension to ".txt" when
      *you COPY MEMO to create the files later. VFP will
      *not force a file extension when the name ends in "dot."

      jcName=
JUSTFNAME (lcFile)

      IF !("." $ jcName)

         REPLACEfilename
WITH jcName+"."
      ENDIF
      lcFile =
SYS(2000,FORCEPATH ("*.*",lcDir),1)
   ENDDO
RETURN

Crazy like a fox

Notice Adrian's last recommendation, about GS v7 versus GS v8.71.

It's good advice... but don't throw away the GS v7 version. Consider the "garbled text" as a feature, not a limitation; it's a primitive way to make your PDF non-copy-able. There is a PDF switch for doing this, and it's probably possible to add that switch to the GS command line script that PDFClass and PDFListener build for you, but I don't off-hand know what it is, and it would take a bit of work and testing for you to incorporate it properly.

You can get both versions here.

2. When life, or your garden, hands you ornamental plums...

That photograph at the top of this entry isn't cherries, but I decided to treat them that way anyway.  It was a little extra work, but the result tastes like lingonberry jam and is great with yogurt. 

Luckily I have a cherry pitter -- although I subscribe to Alton Brown's theory that no unitasking tool except a fire extinguisher should be permitted in a kitchen, cherry pitters don't count.  They're in constant use in our house -- to pit olives.  (FWIW: I understand that Alton eventually found a second use for fire extinguishers, too.)

FYI: I make a mean tea from lavendar from our beautiful and decorative garden, too, but C and I are slowly adding intended-edibles to the landscape.  I mean, fun is fun, but come on.

Did you know that, maybe a hundred years ago, you wouldn't have needed a cherry pitter at all?  A button hook would have done.  Just another example of technology deteriorating.

3. Cherries no relation

Speaking of technological devolution... don't get me started on Bing the Merciless.  It's not only the name that comes up short.  And it's not only my son's job that keeps me with Google.  Sigh.

 

Tags:

General TechSpeak | Life | Visual FoxPro | YAPS

Comments (5) -

8/15/2010 5:28:43 AM #

Metin &#199;inaroglu

Thanks for this excellent reading.

Metin Çinaroglu United States

9/7/2010 7:57:41 AM #

Amber

Hmm I thought the code you provided would help me solve my problems but it seems I am too tired to understand anything(1 AM here). Will come back tomorrow hopefully with clear mind.

Amber Malaysia

5/12/2011 8:16:45 AM #

ko&#231;luk

PDFs tend to be very frustrating, both for the document author as well as the resulting viewer.

koçluk Turkey

7/25/2011 1:37:44 AM #

flats

Thanks for that PDF stuff!!

flats United States

1/15/2012 10:42:25 AM #

Toner

PDF are good for sending it in it´s original view, but it´s frustrating that a overwork on it is not so easy when recived.

Toner Germany