×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Report Writer and Acrobat

Report Writer and Acrobat

Report Writer and Acrobat

(OP)
Hi All,
Thanks heaps for al the help in getting me going in the report writer.
I have everything working in it that I wanted, but there is one more small thing I'm hoping to fix. Our default printer is Acrobat (which we have installed on the machines, so no issues about it, we just set the printer type). But when we print to Acrobat, that launches the Save dialog, which is also ok, but it always defaults the file name to the name of the reportform. Is there a way to have it use some other value (like expense title) as the default for the file name?

Best Regards,
Scott
MSc ISM, MIET, MASHRAE, CDCP, CDCS, CDCE, CTDC, CTIA, ATS

"Everything should be made as simple as possible, and no simpler."hammer

RE: Report Writer and Acrobat

(OP)
Hi Tore,
Well, we already have Acrobat, I'm trying to avoid using additional 3rd party tools.
If there is no way to do it, then we'll just tolerate it.

Best Regards,
Scott
MSc ISM, MIET, MASHRAE, CDCP, CDCS, CDCE, CTDC, CTIA, ATS

"Everything should be made as simple as possible, and no simpler."hammer

RE: Report Writer and Acrobat

Indeed look at the pdf options of foxypreviewer

Acrobat: http://mattslay.com/adobe-acrobat-pdf-printer-outp...
Not sure it's working with current Acrobat or needs the Distiller version, not just the

An alternative is Bullzip PDF printer - search Bullzip threads in this forum, you'll find something
Typically what's asked is to prevent the save as dialog.

In many cases, it's good the user knows where the file results. So you could simply use the output to hardwired output folder and then let users specify the final destination with PUTFILE and copy or move the output pdf file to the chosen folder and name.

Also, PDFCreator has an extensive configuration, that allows you to determine a default name put together from some tokens:

Not sure what token is easiest to influence, the thing you have under your control is the FRX name, so you could simply copy the report file with the desired name and make use of the <InputFileName> token as part of the output file name, like "Expense <InputFileName>" and "pass" over the Expense title with the FRX file name.

When you want interaction, this PDF printer driver gives you the best options, you can have such a default name and you can have a save as dialog suggesting that default name or you can also automatically save as you want and more options about mailing or viewing the result are possible (see the other tabs like Auto-Save and Actions. From that perspective, it's my favorite PDF printer.

Foxypreviwer is somewhat interesting and somewhat unfortunate in really generating the PDF file itself with a pdf DLL. This opens up many possibilities but also is limited to reports, you don't have a general PDF printer usable by users in Office or elsewhere, too.

Most often the wish is to not get a save as dialog, but then users still need to know where to get the PDF, so you likely end up automatically starting the viewer and the user saves the PDF with it's Save As function. Of course, you could also open up the folder with PDFs from your application, when you specify it, but that's just one of many aspects.

My final recommendation still is PDFCreator despite how nice Foxypreviewer is in general and despite how interesting it is to see into its source code report listener and pdf library usage.

Bye, Olaf.

Olaf Doschke Software Engineering
https://www.doschke.name

RE: Report Writer and Acrobat

Scott, you say you have intalled Acrobat on every machine. So you won't want to start looking for alternatives. I would only say that every PDF driver I have ever used has some way of setting the default output filename. This might be a simple parameter setting, or it might involve delving into an INI file or suchlike, but it's always been present.

Whether it is worth switching to a different system just to overcome this minor problem is up to you to decide.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads

RE: Report Writer and Acrobat

(OP)
Hi Mike,
Thanks, I mean, Acrobat isn't cheap, and we have the full version. It's great because we do a lot of stuff with it beyond just VFP and it's great as a printer. The one down side I've seen so far is that for our expense report, we actually have 2 forms, one that runs a detail, and a second that prints images of the receipts. It would be great to be able to combine them as a PDF at print time, but it doesn't work that way. Then we have to combine them after using Acrobat Binder, which is an extra step, but workable. But that may drive me to go to another option, though I'm not sure that's going to solve this problem either. Wish there was a way to "continue" a report to another one that's really part of the same. When you send them to a printer, it's fine, but when they go to files and each one needs a file name, it's more painful.

Best Regards,
Scott
MSc ISM, MIET, MASHRAE, CDCP, CDCS, CDCE, CTDC, CTIA, ATS

"Everything should be made as simple as possible, and no simpler."hammer

RE: Report Writer and Acrobat

(OP)
Hi Tore,
Okay, you may have convinced me to give it another try. I tried Foxypreviewer a few years back but wasn't a big fan. I think I still have the download here somewhere, and if not I'll go get another one.

Best Regards,
Scott
MSc ISM, MIET, MASHRAE, CDCP, CDCS, CDCE, CTDC, CTIA, ATS

"Everything should be made as simple as possible, and no simpler."hammer

RE: Report Writer and Acrobat

Scott, I had a very similar requirement with an invoicing system. I had to print some of the invoices in two parts: one with a summary of jobs, and another with the details of each job. I solved it by using XFRX. That enabled me to do the reports directly in VFP, as normal FRXs, but to output them to PDFs. It all worked with no user interaction.

I don't know if this is still true, but the licensing costs for XFRX worked out much cheaper than for Acrobat, as I only needed a single developer's licence.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads

RE: Report Writer and Acrobat

I vote with Mike.
Xfrx is a fantastic investment, well worth it.

Regards

Griff
Keep Smileing

There are 10 kinds of people in the world, those who understand binary and those who don't.

I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are !good for you.

RE: Report Writer and Acrobat

Yes, in regard of foxypreviewer it would be a waste of time to go back to the old download you have. Get the latest version of it. There is no newer VFP SP and Hotfix, so the app files of Foxpro included in the foxypreviewer download may be the same, but foxypreviewers advanced functionality are within other components like its print toolbar and that is an active project. So go get the latest.

Bye, Olaf.

Olaf Doschke Software Engineering
https://www.doschke.name

RE: Report Writer and Acrobat

In regard of having the Acrobat Distiller product or Acrobat Writer or Acrobat PDF Server, whatever full version you mean, there should be ways to easily specify output folder at least. And if you know that you can always take the PDF file from there and prompt users for a path and name where they want to store it.

I remember even a corporation in the DAX was refusing to pay the prices of Acrobat for their server version and was looking for a solution to use the free Acrobat printer. It always boiled down to use something else that wasn't trying to make money from being the major vendor and maintainer of PDF standards. I also recommended another brand as we tested quite a lot, CIB PDF brewer was the only printer (including Acrobat), which printed Excel Sheet footers. Something perhaps not often used, but it speaks for itself. This was way back over 10 years ago, so things likely changed.

I agree there are different quality levels of PDF, in the simplest case you just put graphics output of everything including text into a PDF file and act quite like the simplest a GDI printer output which of course on paper makes no difference, but in PDF has the big impact of being able to select text or not, but even foxyPreviewers output is rendering text so you get a good output in that regard. It simply is limited to FRX printing and does not integrate as printer driver usable in other applications.

You also have the choice to let user save PDF or Word or Excel or print to a normal printer from the preview toolbar and not just by setting up the current printer, so that's a foxyPreviwer advantage. Here's the toolbars configuration dialog PDF options:


I already agreed in that aspect a PDF printer is an advantage, especially of the PDF output is good and configurable up to actions done with it.

Bye, Olaf.

Olaf Doschke Software Engineering
https://www.doschke.name

RE: Report Writer and Acrobat

I see I'm also 5 versions behind. current foxyPreviwer is 2.99z36. Makes me wonder why this project doesn't declare v3.00 by now.

But you see there is (slight) progress in the project. The http://www.foxypreviewer.com/p/downloads.html page provides a version history.

Bye, Olaf.

Olaf Doschke Software Engineering
https://www.doschke.name

RE: Report Writer and Acrobat

(OP)
Ah, thanks for the links and comments. I'll give this a try. I can see it being helpful in simplifying the overall process. Thanks all for this.

Best Regards,
Scott
MSc ISM, MIET, MASHRAE, CDCP, CDCS, CDCE, CTDC, CTIA, ATS

"Everything should be made as simple as possible, and no simpler."hammer

RE: Report Writer and Acrobat

The alternatives already discussed above are good and you should use them if possible. However, if you must use Acrobat then please see the following example code. It only works if the application can write to the Windows Registry.

CODE --> VFP

*/ Opens a Registry key
DECLARE INTEGER RegOpenKey IN Win32API ;
	Integer nHKey, String @cSubKey, Integer @nResult

*/ Sets a registry key.  Also creates the entry if it does not exist
DECLARE INTEGER RegSetValueEx IN Win32API ;
	Integer hKey, String lpszValueName, Integer dwReserved,;
	Integer fdwType, String lpbData, Integer cbData

*/ Closes a Registry key
DECLARE INTEGER RegCloseKey IN Win32API INTEGER hKey

*/ Check if Windows is 64bit
DECLARE INTEGER IsWow64Process IN Win32API INTEGER hProcess, INTEGER @Wow64Process
DECLARE INTEGER GetCurrentProcess IN Win32API

CREATE CURSOR tmp(ref N(10), firstname C(20), lastname C(20))
SELECT "tmp"
APPEND BLANK
REPLACE tmp.ref WITH 1, tmp.firstname WITH "Mickey", tmp.lastname WITH "Mouse"
APPEND BLANK
REPLACE tmp.ref WITH 2, tmp.firstname WITH "Donald", tmp.lastname WITH "Duck"
APPEND BLANK
REPLACE tmp.ref WITH 3, tmp.firstname WITH "Scrooge", tmp.lastname WITH "McDuck"

*/ For the example printing to work you need to create a report and save it as "c:\temp\report1.frx".
*/ The report itself can just have fields tmp.ref, tmp.firstname, tmp.lastname.
*/ Note that the function adobe_init has to called each time the report is run.  This is necessary because
*/ after printing, Acrobat clears the Registry entry set by adobe_init.
SET PRINTER TO NAME "ADOBE PDF"
=adobe_init("c:\temp\Mickey.pdf")
REPORT FORM "c:\temp\report1.frx" FOR tmp.ref = 1 NOCONSOLE TO PRINTER

SET PRINTER TO NAME "ADOBE PDF"
=adobe_init("c:\temp\Donald.pdf")
REPORT FORM "c:\temp\report1.frx" FOR tmp.ref = 2 NOCONSOLE TO PRINTER

SET PRINTER TO NAME "ADOBE PDF"
=adobe_init("c:\temp\Scrooge.pdf")
REPORT FORM "c:\temp\report1.frx" FOR tmp.ref = 3 NOCONSOLE TO PRINTER

*-----------------------------------------------------------------------------------

FUNCTION adobe_init
*/ In the "Adobe PDF" printer driver properties you must also set :
*/ - Spool print documents so program finishes printing faster
*/ - Start printing after last page is spooled
*/ - Print spooled documents first

LPARAMETERS lcFilePathAndName
LOCAL lnKeyRef, lcRegPath, lcExePathAndName, lnWin64

lnKeyRef = 0
lcRegPath = "Software\Adobe\Acrobat Distiller\PrinterJobControl"

lnWin64 = 0
=IsWow64Process( GetCurrentProcess(), @lnWin64)

*/ In Windows x86 we have to set the calling .exe file path and name in PrinterJobControl.  
*/ The .exe name and path will vary depending on the application.

*/ If the application doing the printing is 32 bit and running on Windows 64 bit then we have to
*/ always set the calling .exe file path and name as "C:\Windows\splwow64.exe" in PrinterJobControl. 
*/ Should Windows be installed to a different folder then change "C:\Windows\" as appropriate!
IF lnWin64 = 0
	lcExePathAndName = HOME()+"vfp9.exe"
ELSE
	lcExePathAndName = "C:\Windows\splwow64.exe"
ENDIF

RegOpenKey(2147483649,lcRegPath,@lnKeyRef)
RegSetValueEx(lnKeyRef,lcExePathAndName,0,1,lcFilePathAndName,LEN(lcFilePathAndName))

*/ Close the registry key 
RegCloseKey(2147483649)
ENDFUNC 

RE: Report Writer and Acrobat

If I am just mass producing PDFs without user interaction, can FoxyPreviewer still be used? An example would be as we create printed invoice copies for our shipping department to work from, we also create a PDF simultaneously from the same Foxpro report to have for our customer service agents to view when needed. The folder and file name are programatically determined on the fly.

I would be creating somewhere over 8,000 PDF's per day.

Thanks in advance.

RE: Report Writer and Acrobat

Sure, no problem.

RE: Report Writer and Acrobat

Foxtrotter,
8000 PDF's per day? Meaning < 4 sec per PDF, I doubt you can do that with FP, unless you have a very fast printer and a small document to be rendered into PDF.
Better test with 10 first.
Regards,
Koen

RE: Report Writer and Acrobat

It must be a pretty huge company to produce 8,000 invoices per day. It's wonderful that they run their business with VFP.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads

RE: Report Writer and Acrobat

A day has 24*60*60 = 86400 seconds, with 8000 PDFs that's 10.8 seconds per PDF and you can raise the available time per PDF and reduce the overall processing time, if you use multiple processes or even servers.

PDFCreatore configured for autosaving and not showing progress created 10 PDFs of Tools\Filespec\90frx.frx in about 10 seconds. So if the invoices are not complex and mostly single page, I assume you could even process larger batches, by this estimation a computer like mine (not the newest) would do the job in ca. 3 hours.

Bye, Olaf.

Olaf Doschke Software Engineering
https://www.doschke.name

RE: Report Writer and Acrobat

Olaf,
A day has 24 hours sure, but, at least here in Holland, we usualy have only 8 working hours. We also need to sleep, eat, care for our children a.s.o.
Regards,
Koen

RE: Report Writer and Acrobat

Yes, but this isn't done by employees, but by scheduled or always running tasks, you can use the whole day. With 1second per invoice you get to about 3 hours, so this could run during night and send PDFs next morning after review of the process, whatever. But you shouldn't make working hours a limitation for software.

Bye, Olaf.

Olaf Doschke Software Engineering
https://www.doschke.name

RE: Report Writer and Acrobat

Yes, generally the invoice is one page. I currently am averaging somewhere around 2 seconds per PDF creation using XFRX. With invoices which are small, I have to setup an automatic restart of the app at around 2000 invoices created in order not to crash the app. I think there may be a memory leak somewhere. In creating our pay statements, I create around 30,000 PDF reports which are multiple reports appending into one PDF file. I have only been able to run around 300 of these before crashing and they average somewhere around 5-8 seconds depending on the size of the report. Using the old eReports software, I don't have this issue of crashing but I can't get it to run on any of the newer OS's because of having images in the PDF (it causes an error). I can't really get support on eReports anymore even though I was able to contact Jim Eddins back earlier this year but it is no longer supported. I have 3 VM's running Windows XP in order to generate these PDF statements over the course of several days. I just need a new solution that is fast and works reliably on newer OS's. I know that's a lot to ask from older software but hey, for our main order entry application we are still running a Fox 2.6 app that creates all these orders running in the USA and the UK. bigsmile

I will say, we are on the move to a new ERP system being customized to handle all of our order entry and customer management as well. Should be finished in the next year but work still has to continue on this system until replaced.

Cheers

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close