PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Thu Jul 18, 2024 7:21 am

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Tue Mar 06, 2012 3:02 pm 
Offline

Joined: Sat Mar 26, 2011 2:24 am
Posts: 6
I have a simple C# utility that invokes PDFSharp to send a PDF file to a printer. However, it seems to behave inconsistently on a Windows 7 machine. Here's the code

Code:
PdfFilePrinter.AdobeReaderPath = "C:\\Program Files\\Adobe\\Reader 10.0\\Reader\\AcroRd32.exe";
PdfFilePrinter printer = new PdfFilePrinter(fileToPrint, printerName);
try
{
   printer.Print();


When testing I launch the utility from the command line several times in a row processing a bunch of PDF files one file at a time. During some of these runs, a small Adobe window pops up (see attachment). Unless I manually close this window, printer.Print() will never complete, which is a problem since I need to batch process hundreds of files at a time.

When this happens seems to be random. Sometimes it happens when the 1st test file is being processed and sometimes it's the 5th or the 7th.

How can I either ensure that this window does not appear or suppress it automatically if it does?


Attachments:
adobe_screen.jpg
adobe_screen.jpg [ 51.58 KiB | Viewed 4046 times ]
Top
 Profile  
Reply with quote  
PostPosted: Tue Mar 06, 2012 3:46 pm 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3101
Location: Cologne, Germany
Hi!
ilyaz wrote:
When testing I launch the utility from the command line several times in a row processing a bunch of PDF files one file at a time.
The source code of PdfFilePrinter is included.
It was developed for Adobe Reader 7 and contains a hack: if no instance of Adobe Reader is running, it starts a new one.

So if you create several PdfFilePrinters in a very short time, more than one of them may find there's no Adobe Reader running - and more than one gets started (one loading invisible, others loading with a Window).

If that is the problem, then you'd better have one process that does all the printing - and the command line utility only adds print jobs to the queue of this service.

PdfFilePrinter is just a helper that calls Adobe Reader with some command-line parameters. You can vary the code and/or the command-line parameters to see if that makes a difference.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 22 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group