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

Text not showing on pdf?

Thread ID:

Created:

Updated:

Platform:

Replies:

89879 Sep 9,2009 03:06 PM UTC Sep 15,2009 11:40 AM UTC ASP.NET Web Forms (Classic) 2
loading
Tags: PDF
Daniel Carnahan
Asked On September 9, 2009 03:06 PM UTC

The problem I have is I am opening an existing pdf document, getting the 1st page, and writing some text on it using page.drawstring. Then I save the document. When I open the document in adobe reader, I don't see any text.

When I pick the "Select Text" tool, and choose "Select All", and then choose copy/paste into notepad, I see all my written text.

The only thing I can guess is that the text is written behind everything, is that possible? And how would I bring the text to the front if that's the case? I've tried using all sorts of coordinates to make sure that the text is written on the page, everything from (1,1) to (1100,1100).

I have done this numerous times in the past with no problems, but using a different pdf document. I am using the same code that I've used for the other 20 documents that I have done this with. Any ideas?

Jason Smith
Replied On September 11, 2009 05:24 PM UTC

How are you drawing the text. This type of code is working for me:

PdfLoadedDocument doc = new PdfLoadedDocument(@"C:\test.pdf");
PdfPageBase page = doc.Pages[0];
PdfGraphics graphics = page.Graphics;
PdfTextElement text = new PdfTextElement();

text.Font = new PdfStandardFont(PdfFontFamily.Helvetica, 16, PdfFontStyle.Bold);
text.Text = "Hello World!";
text.Draw(graphics, 100.0f, 100.0f);

doc.Save(@"C:\testresult.pdf");

Thiruvenkadam E [Syncfusion]
Replied On September 15, 2009 11:40 AM UTC

Hi Daniel,

Thank you for your interest in Syncfusion products.

Draw text on exiting pdf document

We can able to draw a text on a existing pdf document by using the "public void DrawString(string s, PdfFont font, PdfBrush brush, RectangleF layoutRectangle, PdfStringFormat format)" method.

Could you please find the sample from the below location and let me know if this helps.

http://files.syncfusion.com/support/Pdf.Windows/F89879/Text.zip

Please have a look at the above sample and if still the issue exists,

Could you please try to reproducing it in the above sample or send us few documents so that we could sort out the cause of the issue and provide you a solution?

Please let us know if you need any further information.

Regards,
Thiru

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

;