Aspose.PDF c++ page content processing

Hello support.
It is possible to clean up a specified area of a sheet in a PDF document. I did with text. Is it possible to clear a part of the picture that has fallen into the selection area.

@PiterG,

Hi, I am not a C++ dev, but when I saw your question, I had an idea. Let me know if it can be done in C++.

Can you use Annotations? Specifically Redaction Annotation. If you do, you can redact a rectangle with the color of the page. Just an idea.

1 Like

thanks for the idea

Thanks for the idea. Now I can process images of the document.
QT C++ code snippet
auto stream = MakeObject( );
auto xIimage = imagePlacement->get_Image();
auto bitmap =MakeObject( xIimage->ToStream() );
QRect qRectangleImage;
auto imageRectangle = imagePlacement->get_Rectangle();
qRectangleImage.setCoords( imageRectangle->get_LLX(),
imageRectangle->get_LLY(),
imageRectangle->get_URX(),
imageRectangle->get_URY() );
QRect qAreaImage = intersectionAreaInImage( qRectangleImage, qRectangle, 2, 2 );
auto graphics = Graphics::FromImage( bitmap );
graphics->FillRectangle( color, 0, 0, 200, 200 );
bitmap->Save( stream, get_Bmp() );
auto rect = MakeObject< Rectangle>( imageRectangle->get_LLX(),
imageRectangle->get_LLY(),
imageRectangle->get_LLX() + imageRectangle->get_Width(),
imageRectangle->get_LLY() + imageRectangle->get_Height() );
stream->Seek( 0, Begin );
imagePlacement->Replace( stream );

1 Like

Might be useful to someone

Copying through the buffer spoils the code.

@PiterG,

Thanks for sharing the code. I am sure this will be useful for someone in the future!

1 Like