My database has a table with links to PDF documents. Can I send those PDFs to the printer from within my application?
TIA,
Tracy
My database has a table with links to PDF documents. Can I send those PDFs to the printer from within my application?
TIA,
Tracy
I finally figured this one out...
First, declare an External Function:
FUNCTION long ShellExecute (uint ihwnd, string lpszOp, string lpszFile, string lpszParams, string lpszDir, int wShowCmd ) LIBRARY "Shell32.dll" ALIAS FOR "ShellExecuteW"
Then call that function:
shellexecute(handle(this), "print", ls_filename, ls_null, ls_null, 0)
On my computer, shellexecute() opens an Acrobat Reader to do the printing... minimized in the task bar. Not sure what it would do if I didn't have Reader installed... can't really test that. The 0 tells the program launched to hide the window, probably why it's showing minimized in my task bar?
~~~Tracy
To print PDFs without having acrobat reader installed, I use a .NET library called RawPrint. Here is a link to the PowerBuilder example and the CSharp project:
Hi Tracy;
The easiest way (and what I do) is to use PB's "iNET" object class and the HyperLinkToURL() command to download the related PDF file into the App User's default web browser. Then from there, they can print all or part of the the PDF, change its size, font, orientation, etc as they desire from the browsers internal PDF / Print functionality.
Food for thought! ;-)
HTH ... Chris
Possible - yes. But you probably need to use some tricks:
Option 1: Use the run() function to print the PDF from command line (Adobe Reader or another PDF tool required) - just google "windows print pdf from command line".
Option 2: Embed Adobe Reader as OLE object (so you even have a print preview) - a print button is integrated in the OLE.
Hope this helps.
I think there's no PB native way to do this - or does anyone know a way?