in

Archived Data Techniques Forums

Printing a pdf file to the Faxman printer

Last post 04-14-2005 3:14 PM by BabaFoo. 13 replies.
Page 1 of 1 (14 items)
Sort Posts: Previous Next
  • 11-09-2004 7:46 AM

    Printing a pdf file to the Faxman printer

    Just found a very useful piece of code by Rusha for using OLE to print doc files directly to the FaxMan printer.

    Any ideas on how to do the same thing with pdf files please?
  • 11-09-2004 8:07 AM In reply to

    Re: Printing a pdf file to the Faxman printer

    Personaly, I use a control call Pegasus ImageXpress to convert the PDF to a TIFF file. After that, FaxMan can convert the TIFF file to his own format with the method 'ImportFiles'.

    With that kind of solution, you don't need to "print" anything. It's faster and safer.

    Hope this can help !!
  • 11-09-2004 11:56 AM In reply to

    Re: Printing a pdf file to the Faxman printer

    Seems like you can host the Acrobat reader OCX and print to your FaxMan printer driver using that, or, here are some command line args for printing w/ the Acrobat EXE:

    USING COMMAND LINES WITH ACROBAT AND ACROBAT READER UNDER WINDOWS

    http://partners.adobe.com

    These are unsupported command lines, but have worked for some developers.  there is no documentation for these commmands other than what is listed below.  You can display and print a PDF file using command lines with Acrobat and Acrobat Reader.

    AcroRd32.exe filename --Executes the Reader and displays a file.

    AcroRd32.exe /p filename --Executes the Reader and prints a file.

    AcroRd32.exe /t path printername drivername portname --Initiates Acrobat Reader, prints a file while suppressing the Acrobat print dialog box, then terminates Reader.

    The four parameters of the /t option evaluate to path, printername, drivername, and protname (all strings).

    printername -- The name of you printer.

    drivername -- Your printer driver's name.  Whatever appears in the Driver Used box when you view your printer's properties.

    portname -- The printer's port, portname cannot contain any "/" characters; if it does, output is routed to the default port for that printer.

    If using Acrobat, substitute Acrobat.exe in place of AcroRd32.exe in the command line.
    support@data-tech.com
  • 11-10-2004 3:37 AM In reply to

    Re: Printing a pdf file to the Faxman printer

    Thank you Rusha. I had already found and tried most of the command line stuff, and yes it works, but it is a little complicated to gather all the necessary information programmatically on an unknown computer. Your code for doc files is excellent.

    I couldn't find a reference to an Acrobat Reader OCX which sounds ideal. I will look further, but if you have more info it would be appreciated.  
  • 11-10-2004 12:31 PM In reply to

    Re: Printing a pdf file to the Faxman printer

    Hi,
    When you install the free Acrobat Reader (www.adobe.com), you should get the following directory structure (or very similar)
    C:\Program Files\Adobe\Acrobat 6.0\Reader\ActiveX\pdf.ocx

    You can put this pdf.ocx on a form and use it to load PDF files from disk and print them. 
    support@data-tech.com
  • 11-11-2004 5:27 PM In reply to

    Re: Printing a pdf file to the Faxman printer

    You are quite right! I shall now try it. Thank you again.
  • 11-16-2004 5:54 AM In reply to

    Re: Printing a pdf file to the Faxman printer

    Just to say for the benefit of others that I have had no success with pdf.ocx despite trying for a day or two. I have added the control as a component and all seems fine, but printing to the Faxmen printer driver using .LoadFile and .printAll and providing a suitable filename in the usual way just does not work. Messages like 'Could not find Acrobat plug-in' and 'Could not find Adobe external window handler'. I suspect there is more to using pdf.ocx than just using it, but there is absolutely nothing I can find on the Adobe website.
  • 11-16-2004 10:42 AM In reply to

    Re: Printing a pdf file to the Faxman printer

    Jim,
    It may be worth your while to try printing via the command line, using the example I provided above.
    support@data-tech.com
  • 11-20-2004 4:38 AM In reply to

    Re: Printing a pdf file to the Faxman printer

    In the end neither pdf printing idea really worked reliably, and I have ended up buying an ActiveX control Xpdfviewer which is working well.

    However, I am having trouble with Rusha's OLE doc file printing code. It works well until one needs to print an outgoing fax or another type of file to the Faxman printer, when a 'Printer error' dialog appears. It seems not to be relinquishing control of the printer. Any ideas?

    Incidentally, the 'CreateObject' lines needs to be
         Set WordApp = CreateObject("Word.Application")
         Set WordDoc = WordApp.WordBasic
    At least, they do for mine to work - or am I missing something?

    John

  • 11-23-2004 10:31 AM In reply to

    Re: Printing a pdf file to the Faxman printer

    I've got a solution for printing a PDF. The code below is in C# .Net :

    ProcessStartInfo info = new ProcessStartInfo();
    info.WorkingDirectory = @"C:\Program Files\Adobe\Acrobat 6.0\Reader\";
    info.FileName = @"C:\Program Files\Adobe\Acrobat 6.0\Reader\AcroRd32.exe";
    info.Arguments = @"/p /h C:\Temp\tmp1540.pdf";
    info.CreateNoWindow =
    true;
    info.UseShellExecute =
    false;

    Process process =
    new Process();
    process.EnableRaisingEvents =
    true;
    process.StartInfo = info;
    process.Start();
    process.WaitForInputIdle(30000);
    process.CloseMainWindow();

    Hope this can help !


  • 11-30-2004 10:23 AM In reply to

    Re: Printing a pdf file to the Faxman printer

    Thank you Ymethot. I shall try to translate to VB. The new bit seems to be the /h argument which I haven't found before - can you explain please?
  • 11-30-2004 3:45 PM In reply to

    Re: Printing a pdf file to the Faxman printer

    Ok, I made somes changes since I posted on the forum, here's the new code followed with explanation :

    ProcessStartInfo info = new ProcessStartInfo();
    info.WorkingDirectory = workingDirectory;
    info.FileName = fileName;
    info.Arguments = @"/p /h " + BuildFilesName(_pdfFiles);
    // Print in hidden mode
    info.UseShellExecute = false;
    info.CreateNoWindow =
    true;

    Process process =
    new Process();
    process.EnableRaisingEvents =
    true;
    process.StartInfo = info;
    process.Start();
    process.WaitForExit(20000);
    // Wait until Acrobat reader has started
    process.CloseMainWindow();


    - The /p /h tells to acrobat reader to print in hidden mode.
    - The CreateNoWindow indicate that I want to start the process in a new window.
    - The UseShellExecute indicate that I don't want to use the operating system shell.
    - The EnabledRaisingEvent tells that I want to be informed of what's happening with the process that run Acrobat Reader. (I don't use any event for now)
    - The WaitForExit(20000) tells to the process to wait 20 seconds before to exit the window. In my application, 20 seconds was enough to let Acrobat reader starts the printing operation.

    So When the 20 seconds delay expired, the process will call the exit command on the window. In our case, the windows is Acrobat Reader, so he will be close automatically.

    Hope this help.
  • 01-07-2005 4:15 AM In reply to

    Re: Printing a pdf file to the Faxman printer

    I realise this is slightly off topic - but I'm having a similar problem and this is the closest site I've found to answering my query - my question is, using the technique suggested above, how do I set Abode to print in Duplex mode?

    Thanks for your time
  • 04-14-2005 3:14 PM In reply to

    Re: Printing a pdf file to the Faxman printer

    couple of things ...

    1) Thanks for the code.
    2) /p /h seems to spawn acrobat but does not hide the acrobat application, only the pdf document is not openned (hidden with /h?)
    3) how do you know when the process (thread) has finished printing the pdf file?

    thanks again.


Page 1 of 1 (14 items)
Copyright 2009 Data Techniques, Inc. All Rights Reserved.