I'm currently using the latest release of GdPicture v14. The system we're building will mostly handle image-only PDF files and a few TIFF files. Most cleanup and manipulation operations with TIFF files are trivial to implement by using a GdPictureImaging object, but I don't know if there is an easier way to do it when handling PDF files. This is an extract of a cropping operation on a PDF file composed of all images:
Code: Select all
//This assumes that the first page is selected and shown on a GdViewer and that the user has previously selected an area on the viewer float top = 0, left = 0, width = 0, height = 0; //extract the pdf page as an image int tempImage = gdPdf.RenderPageToGdPictureImage(200, false); //get the dimensions and position of the selected area imageViewer.GetRectCoordinatesOnDocumentInches(ref left, ref top, ref width, ref height); left *= 200; top *= 200; width *= 200; height *= 200; //crop the image to the dimensions of the selected area gdPicture.Crop(tempImage, (int)left, (int)top, (int)width, (int)height); //remove the original page from the pdf file gdPdf.DeletePage(1); //insert a new, blank page gdPdf.InsertPage(width, height, 1); //add the cropped image as a resource to the pdf string imageResx = gdPdf.AddImageFromGdPictureImage(tempImage, false, false); //draw it on the first page gdPdf.DrawImage(imageResx, 0, 0, width, height); //refresh viewer and thumbnails imageViewer.Redraw(); thumbnailViewer.RedrawItem(0);
Many thanks in advance for any advice I can get!