We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Removing page graphics

Thread ID:

Created:

Updated:

Platform:

Replies:

119280 Jun 1,2015 03:53 AM Jun 2,2015 08:11 AM WinRT 1
loading
Tags: PDF
karine lamaa
Asked On June 1, 2015 03:53 AM

I need to remove the graphics from a page in the PDF.

I started by drawing a line and then trying to remove it, using the Restore() function but it didn't work, I used the following code:

PdfLoadedDocument lDoc = new PdfLoadedDocument(stream);
PdfGraphics graphics = lDoc.Pages[0].Graphics;

PdfGraphicsState state = graphics.Save();
           
PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 14, PdfFontStyle.Bold);
graphics.DrawString("New page - Test", font, PdfBrushes.Red, new System.Drawing.PointF(200, 10));

PdfViewer.LoadDocument(lDoc);

and to delete the graphics:

graphics.Restore(state);


What should I do to remove the graphics ?

Karthik Krishnaraj [Syncfusion]
Replied On June 2, 2015 08:11 AM

Hi Karine,
Thank you for using syncfusion products,
As per your query regarding “Need to remove the graphics from the page”, we don’t have support to remove the page graphics. Here you used graphics.Restore() function to delete the page graphics, whereas the purpose of graphics.Restore() function is to restore the saved graphics state not to delete it. We can able to delete only the annotations from the page, I have attached a simple sample regarding this in the below link, please check through it and let us know if these helps.
Sample Link:
http://www.syncfusion.com/downloads/support/directtrac/139746/ze/RemoveGraphicsWRT-1791672907
Thanks,
Karthik

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;