An inneficent approach to PDF stamping.

Q:

I have added the ability to draw an overlay on a PDF page during
viewing and printing.

The approach I am using is to get the bitmap by calling
pdfDraw.GetBitmap, creating a Graphics object, and drawing the
metafile onto the bitmap. I then draw the bitmap to the printer
graphics object.

When I print to a physical printer everything works fine. When I
print to a PDF printer the resulting file is VERY slow, almost appears
to be hung
---
A:

The slow printing to the software PDF driver it is probably due to the
size of spool file and the fact that the application is printing from
the main application thread (which most likely freezes the GUI).
Because you are rasterizing the entire page there is a large bitmap
that needs to be processed by PDF creation software. You could
probably speed things up by producing a smaller bitmap (i.e. set a
lower DPI). As an alternative, you can also try using GDI+ rasterizer
for printing
(pdfdraw.SetRasterizerType(PDFRasterizer.Type.e_GDIPlus))? In some
cases this will result in output that is faster to process by certain
software PDF printer drivers.

Also since you only need to add new content to existing PDF document,
why don't you simply stamp PDF pages directly (see
http://www.pdftron.com/net/faq.html#how_watermark). This will be both
faster and will produce smaller PDF documents that preserve the
original document quality.

We looked further in the test file you sent and it seems that the
output consist of thousands of little images (one for each scan line).
This seems like a problem in the PDF printer driver (or associated
settings).

In any case I would recommend stamping PDFs directly(http://
www.pdftron.com/net/faq.html#how_watermark) instead of recreating PDF
through a PDF printer driver.