Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

General field holds .pdf - Would like to force the pdf to print 2

Status
Not open for further replies.

CMcC

Programmer
Feb 5, 2002
196
US
Hello.

I have a general field that contains an adobe pdf.
I have been trying to find out how to force the pdf to print if the general field is not empty.

do I have to StrtoFile or something? Any suggestions are appreciated!

Cmcc
 
Can you change the field type to be a binary memo - because if you can, life will be simpler!

Regards

Griff
Keep [Smile]ing

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

A binary memo field will hold a pdf?

Cmcc
 
I am using VFP 7 so I cannot take advantage of BLOB.
Cmcc
 
Yes,

To get the pdf into the field you use

Code:
Replace MyTable.MyField with FiletoStr("c:\myInputfolder\mypdf.pdf")

And to get it out you can then use:
Code:
STRTOFILE(MyTable.MyField,"C:\MyOutputFolder\MyNewPDF.PDF")

The general field is a pain - and neither the general or the binary memo is recommended where you might have large amounts of data or need to change the contents very often.

Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.
 
Thank you. I will try this and let you know how it goes. I appreciate your help. This is a small file that only holds a few static pdfs, so not too worried about changing or storing large files.

Cmcc
 
CmCC,

If you possibly can, you should ditch the General field. Instead, use a character field to hold the path and filenames of the PDF files.

Not only will that be much more efficient and practical, but it means that you will be able to happily print the PDFs by using ShellExecute() or some similar method.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro tips, advice, training, consultancy
Custom software for your business
 
Hello Mike. I tried the solution Griff suggested, and I got the error - string is too long to fit.

I will try your suggestion now. Thank you!
Cmcc
 
Hmm

What size if you PDF?

Mike is right that for large lists of images (or other files) storing the filename is better (with a section of the path to allow for moving it to a different share/path)

But for a binary memo you should be able to store a sigle image of least 1 GB (half the max of 2GB)

Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.
 
Mike - that was ALOT easier. ShellExecute worked perfectly Now, need to find the code to close the PDF once opened and printed.
Cmcc

 
Thanks to both of you for your time and wisdom!

Happy 4th of July as well.

Cmcc
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top