Thread View: adobe.acrobat.sdk
1 messages
1 total messages
Started by rnwcoates
Wed, 29 Apr 2009 15:43
PrintPagesSilent not working
Author: rnwcoates
Date: Wed, 29 Apr 2009 15:43
Date: Wed, 29 Apr 2009 15:43
64 lines
3112 bytes
3112 bytes
I have tried the SDK PrintPages and PrintPagesSilent functions with no
results. I do not get a printed page, a dialog box, or an error. This
is running via a simple Windows Forms C# application that displays a
form with a single button. That button calls the class function shown
below.
I can open Acrobat, open a document, and click the print button to
print to the default printer, so I would assume that the Acrobat setup
is not an issue.
Thanks for any help!
- Randy
using System;
using System.Collections.Generic;
using System.Text;
using System.Diagnostics;
using Acrobat;
namespace TestAdobePrinting
{
/// <summary>
/// Prints a PDF file to a given printer using the Adobe SDK.
/// </summary>
class PDFPrinterSDK
{
public static void PrintPDF(string pdfFilePath)
{
CAcroApp acrobat = new AcroAppClass();
acrobat.Hide();
try
{
CAcroAVDoc avdoc = new AcroAVDocClass();
if (avdoc.Open(pdfFilePath, ""))
{
CAcroPDDoc pddoc = (CAcroPDDoc)avdoc.GetPDDoc();
int numPages = pddoc.GetNumPages();
if (! avdoc.PrintPages(0, numPages - 1, 3, 1, 0))
{
// error occurred
throw new ApplicationException("Report did not
print due to Adobe error.");
}
}
else
{
throw new ApplicationException("Adobe SDK cannot
open the file " + pdfFilePath);
}
}
catch (Exception ex)
{
throw ex;
}
finally
{
acrobat.CloseAllDocs();
acrobat.Exit();
acrobat = null;
}
}
}
}
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads