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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Removing page graphics

Thread ID:

Created:

Updated:

Platform:

Replies:

119280 Jun 1,2015 07:53 AM UTC Jun 2,2015 12:11 PM UTC WinRT 1
loading
Tags: PDF
karine lamaa
Asked On June 1, 2015 07:53 AM UTC

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 12:11 PM UTC

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.

Warning Icon 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.Close Icon

;