Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to implement batch print pdf file programmatically

2,217 views
Skip to first unread message

Audison...@gmail.com

unread,
Jul 27, 2006, 8:53:08 AM7/27/06
to
I'm a newbie to PDF related Programming. Now I want to implement a
function : given a batch of pdf files which may be located locally or
on some place in the network pionted to by a URL. Once scheduled a task
and submit it, then I can wait for these to be printed. For this
target, I surfed on the web, but can't find a library or product that
suit my need and free from charge, and also full granted license for
any purpose and can be use evreywhere? Can anyone give me a hint to
implement this function and any related library which can has
implemented related function and only little effor need to fulfill the
ultimate task and no commercial-usage limitation. And My preferred
language is C++ or Java. Thanks a lot.

QuoVadis

unread,
Jul 27, 2006, 11:00:26 AM7/27/06
to
You can use Ghostscript to print PDF files from the command line.

gswin32c.exe -dNOSAFER -dNOPAUSE -dBATCH -sDEVICE=mswinpr2
-sOutputFile="\\spool" "c:\myfile.pdf"

You can also do that with the Ghostscript-API (gsdll32.dll, you should
find C++ examples on the Ghostscript website).

As alternative, you can print PDFs with the Adobe Reader in two ways:

1.) Via Command Line
start acrord32.exe /p /h c:\test.pdf
Unfortunately the Adobe Reader doesn't close itself after printing.

2.) Via DDE
I attached a VB6-Module which does exactly that. Porting that to C++
shuoldn't be a problem.

Regards

Marcus


Audison...@gmail.com schrieb:

modPrintPDF.bas

Hans-Werner Hilse

unread,
Jul 27, 2006, 11:16:54 AM7/27/06
to
Hi,

On Thu, 27 Jul 2006 17:00:26 +0200 QuoVadis <nbs...@directbox.com>
wrote:

> You can use Ghostscript to print PDF files from the command line.

Would have been my suggestion (or xpdf) if the OP has not said he was
searching for a free _and_ in the same moment commercially usable
software. Ghostscript is GPL/AFPL. Xpdf is GPL. So both require to
publish the source of a deriving application or to contact the devs for
an idividual licence, but that would probably not come for free.

Well, you could ignore Ghostscript's licence, like those cheap
Distiller substitutes. But that's not fair and one would deserve to get
sued for that.

OTOH, ghostscript could be included as-is, if that's possible. That
does not apply to embedding Ghostscript.

-hwh

Audison...@gmail.com

unread,
Jul 27, 2006, 12:24:09 PM7/27/06
to

Then If I only use the GhostScript-API, not the Product GhostScript,
does it also has any commercial usage restriction?

Aandi Inston

unread,
Jul 27, 2006, 1:01:53 PM7/27/06
to
Audison...@gmail.com wrote:


>Then If I only use the GhostScript-API, not the Product GhostScript,
>does it also has any commercial usage restriction?

An API to a product is a way of talking to the product.

For example, to use the Windows API, you must have Windows installed,
with whatever licensing issues it comes with.

Similarly, to use the GhostScript API, you must have GhostScript
installed, and its licensing terms apply.

The GhostScript API is not a separate thing in itself.

It may be worth noting that printing a PDF is a vastly complex task,
representing perhaps 2-10 years of full time programming. Someone who
has gone to that trouble is likely to put at least some conditions on
reuse of their code.
----------------------------------------
Aandi Inston qu...@dial.pipex.com http://www.quite.com
Please support usenet! Post replies and follow-ups, don't e-mail them.

QuoVadis

unread,
Jul 27, 2006, 1:28:41 PM7/27/06
to
Hans-Werner Hilse schrieb:

> Would have been my suggestion (or xpdf) if the OP has not said he was
> searching for a free _and_ in the same moment commercially usable
> software. Ghostscript is GPL/AFPL. Xpdf is GPL.

Calling GS from the command line rather than using the API is IMHO no violation of the GPL nor the AFPL, as you do do not alter the code of GS at all
or do a static linking of the dll (but corrct me if I'm wrong).

> OTOH, ghostscript could be included as-is, if that's possible. That
> does not apply to embedding Ghostscript.

Making the user d/l and install GS shouldn't be a problem either.

Another option for your product could be a user-defined shell call using a placeholder like %1 for the PDF, so your end users can use any printing
system that suites their needs (GS, Adobe Reader by cmdline or DDE).

Regards

Marcus


> Hi,
>
> On Thu, 27 Jul 2006 17:00:26 +0200 QuoVadis <nbs...@directbox.com>
> wrote:
>
>> You can use Ghostscript to print PDF files from the command line.
>

chicks

unread,
Jul 27, 2006, 1:44:22 PM7/27/06
to
QuoVadis wrote:

> ... Adobe Reader by cmdline or DDE

Such as pdfp here: http://www.esnips.com/web/PDFTools

Automating Reader is a very good way to print PDF with high quality, so
long as you realize the limitations. Reader can't be fully automated,
since it displays error messages which must be responded to manually by
an operator. Therefore it can't be automated as a Windows Service or
on a headless server.

entrepreneur...@gmail.com

unread,
Nov 5, 2014, 3:07:29 AM11/5/14
to
Total PDF Printer is invaluable to print many pdf files in batches.

Total PDF Printer can also print by file date/time order. It saves you time greately when you need to print pdf files of certain date or time and do not want to sort them out manually. You may set different printing options (select printer or tray, or set duplex printing).

It is great to print multipage PDF files. When you print several PDF files with lots of pages in each you get a stock of paper in the printer's tray. It's a hard task to sort these paper sheets out. So Total PDF Printer allows you to print a "separator sheet". This separator will help you to sort one printed PDF from the other.



http://www.coolutils.com/TotalPDFPrinter
0 new messages