Converting from PDF to mono TIFF and back from TIFF to PDF.

Q: I am working on a project where I will need to convert a multipage
PDF document created by Crystal Reports to a 1 bit grayscale TIFF
image. This image(s) will then be saved to the imaging system.

Then when I retrieve this image from the imaging system, then I will
need to convert it back to PDF. Can I use PDFNet for all of this?

The convert from PDF to an image will be done in a service that I will
code and the convert from image to PDF will be done in the web page
when the user requests it.
A: You can use PDFNet SDK ( to convert PDF to
monochrome TIFF and to crate a PDF from TIFF.

For conversion from PDF to 1 bpp TIFF you would use PDFDraw class as
shown in PDFDraw sample project (

To export monochrome, G4 compressed TIFF images you need to specify
"BPC" parameter in the optional render 'hints' object. For example:

// Initialize render 'gray_hint' parameter, that is used to control
// rendering process. In this case we tell the rasterizer to export
the image as
// 1 Bit Per Component (BPC) image.
// Note: Obj & ObjSet are located in the pdftron.SDF namespace
ObjSet hint_set=new ObjSet();
Obj mono_hint=hint_set.CreateDict();
mono_hint.PutNumber("BPC", 1);

pdfdraw.SetImageSize(1000, 1000);
pdfdraw.Export(page, "out.tif", "TIF", mono_hint);


Similarly you can render the PDF page in grayscale as follows:

// 'gray_hint' will tell the rasterizer to export the image as
Obj gray_hint=hint_set.createDict();
gray_hint.PutName("ColorSpace", "Gray");
pdfdraw.Export(page, "out2.tif", "TIF", gray_hint);

Please note that the same hint object (ObjSet) can be reused in any
number of export operations, so you don't need to keep on initializing
hint object for each export operation.

For conversion from TIFF to PDF you can use one of Image.Create()
methods as shown in AddImage sample project (

To serve PDF dynamically you could save the PDF to a memory buffer
instead of a temporary file as shown in PDFDocMemory sample project