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

Can SDK print to DC?

23 views
Skip to first unread message

Pete d'Oronzio

unread,
Jun 26, 2003, 10:20:15 AM6/26/03
to
Hi there!
I've been waiting for a plugin or new feature to be available, that hasn't materialized, so I think it's time to bite the bullet and create it. Before I start (I've never seen the Acrobat SDK) I thought I'd find out if it's theoretically possible though...

I've got a file called letterhead.pdf and a file called letter.pdf. I'd like to print each page of letter.pdf superimposed on top of letterhead.pdf. So, I'd like to create a utility that might look have a commandline like this:
PrintOnLetterHead.exe <PdfDocument> <LetterHeadPg1> <LetterheadPgN>.
A call might look like:
PrintOnLetterHead.exe letter.pdf letterhead.pdf letterhead.pdf.

I'd love to be able to "merge" two pdf files, but this is more than what I need. What I'd be very happy with is to "print" the first page letterhead to a PrintDC, then "print" the first page of letter to that PrintDC. The result would be both pages, one on top of the other. I'd then repeat for each page.

Would this be possible with the SDK, or would each page printed to the DC include a pagefeed?

Oh yeah, and I've checked out apps that enable one to include a raster image "watermark" and the like. Doesn't accomplish what I'm looking for. I really need the letterhead to be a pdf.

BTW: any other suggestions to accomplish my task are welcome.

Thanks!

Pete

Dan Korn

unread,
Jun 26, 2003, 12:54:26 PM6/26/03
to
Yes. The function PDPageDrawContentsToWindow draws a page to a Device Content on Windows, and to a GWorld on Mac.

We use this in conjunction with AVPageViewAcquireMachinePort and other functions to put a "preview" of a composed PDF on top of the input PDF for our composition engine in the Acrobat window. The tricky part, as usual, is in the details (transforming AVRects into the right coordinates, dealing with zoom, etc.), but it does work.

You could do something similar and blit the bits to a print DC instead of a screen DC. Unfortunately I can't give you all the code (trade secrets and whatnot), but I think there's a sample somewhere that we started from.

Dan

Pete d'Oronzio

unread,
Jun 26, 2003, 12:56:55 PM6/26/03
to
Dan,

Thanks! That's all I needed to decide to get started.

btw: any reason you can think of that no one has created a utility like this? I see some multi-thousand $$ programs that include something like this, but no simple quick-overlay utilities like I am describing...

-pete

Dan Korn

unread,
Jun 26, 2003, 1:04:23 PM6/26/03
to
One caveat: I was looking at the doc for PDPageDrawContentsToWindow in the Acrobat Core API Reference and it does say that the DC "cannot be reliably used as the hDC for a printer device." However, I think that if you draw it to an offscreen bitmap, you should be able to then blit the bitmap to a print DC. You'll just have to try it and see if it works.

Good luck,
Dan

Pete d'Oronzio

unread,
Jun 26, 2003, 1:18:13 PM6/26/03
to
Hmmm.. I just dropped a couple of Acrobat reader controls into a Delphi form. You don't think I'll be able to print from them, or get the contents to a DC? .. I should know in a few...

Dan Korn

unread,
Jun 26, 2003, 1:16:15 PM6/26/03
to
Sorry, one more thing. In your original post, you say, "I'd like to create a utility that might [have] a commandline." You generally can't make a standalone executable with the Acrobat SDK, only Acrobat plug-ins. That said, there are ways to use inter-app communication to interface Acrobat, but you're opening up a can of worms. You want to look at something like the PDF library to build an application.

Also, you might want to consider just modifying the PDF file to merge the objects from your letterhead with the letter pages into a new temporary PDF document and printing that. It might be easier than messing around with the print DC.

Okay, that's all.

Dan

Pete d'Oronzio

unread,
Jun 26, 2003, 1:50:00 PM6/26/03
to
Ah. I made a mistake. I referred to the SDK, when I was thinking of the ActiveX control. The ActiveX control doesn't have any of this type of functionality interfaced...

So, I'd have to go license the SDK. May be worth it, but maybe not, based on your last post.

I'd prefer not to create a new .pdf if I don't have to. Really just want to print two pages without a printer reset.

I'll look up the PDF library, as I hadn't heard of that.

Thanks again.

-pete

Aandi Inston

unread,
Jun 26, 2003, 2:39:32 PM6/26/03
to
>Hmmm.. I just dropped a couple of Acrobat reader controls into a Delphi form.

There are no supported Acrobat Reader controls. That is not a part of
the SDK. Most of the SDK requires Acrobat, not the Reader.

Aandi Inston

Aandi Inston

unread,
Jun 26, 2003, 2:40:37 PM6/26/03
to
>So, I'd have to go license the SDK.

I should comment on that I think.

You don't license the SDK; however, parts of it are available only to
members of ASN.

The Acrobat SDK automates Acrobat (rarely Reader). So what you license
is not the SDK, but copies of Acrobat.

Aandi Inston

Pete d'Oronzio

unread,
Jun 26, 2003, 2:50:40 PM6/26/03
to
Well, ok, so what's my solution? What should I buy/license/etc.

I already own a license for Acrobat 5, and would be willing to buy Acrobat 6.

What I want, as described above, is the ability to produce a stand-alone application that can request Acrobat to print a single page to a MetaFile or Print HDC followed by another page without clearing the first.

Also, what would an end-user of my app be required to license from Adobe?

Thanks,

-pete

Aandi Inston

unread,
Jun 26, 2003, 2:52:35 PM6/26/03
to
That standalone application is possible, if awkward. You would write a
plug-in, in C or C++, and set up a private communication channel to
it. This could be OLE, though putting an OLE server in a plug-in can
be problematic.

The end user would simply need Acrobat too.

Aandi Inston

Pete d'Oronzio

unread,
Jun 26, 2003, 5:02:52 PM6/26/03
to

Corey Lapka

unread,
Jul 18, 2003, 11:26:00 AM7/18/03
to
My company just found a great OCX
http://www.visual.co.uk/Pcl2pdf.html

It's called Pcl2Pdf 5.0 and it takes the PCL file and changes it to a
PDF, but it can also add an overlay.


We're using it to add letterhead overlay to a PDF we have already
generated.

We had to buy the plug in for it called FormsElectric to create the
Overlays
But the plug in is pretty cheap.

Hope this helps
Corey

0 new messages