Display image in pdf

Display image in pdf

Forum member · Jun 25, 2008
Hi, I want to create pdf from the text file for that i am taking the reference of the FormattedTextContinuation example. My problem is that i also want to display the images whose path are in the text file. I am unable to do this. Please do some thing for this problem. I am also sending you the text file which I am using. this is my text file. I wanna create the pdf of this file with images. <FONT color=#0000ff size=2> <P>public</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>partial</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>class</FONT><FONT size=2> </FONT><FONT color=#008080 size=2>Consulting_CreatePdf</FONT><FONT size=2> : System.Web.UI.</FONT><FONT color=#008080 size=2>Page</P></FONT><FONT size=2> <P>{</P> <P></FONT><FONT color=#008000 size=2>// Template for document elements</P></FONT><FONT size=2> <P></FONT><FONT color=#0000ff size=2>private</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>static</FONT><FONT size=2> </FONT><FONT color=#008080 size=2>Template</FONT><FONT size=2> template = </FONT><FONT color=#0000ff size=2>new</FONT><FONT size=2> </FONT><FONT color=#008080 size=2>Template</FONT><FONT size=2>();</P> <P></FONT><FONT color=#0000ff size=2>private</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>static</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>bool</FONT><FONT size=2> imageSet = </FONT><FONT color=#0000ff size=2>false</FONT><FONT size=2>;</P> <P></FONT><FONT color=#0000ff size=2>static</FONT><FONT size=2> Consulting_CreatePdf()</P> <P>{</P> <P></FONT><FONT color=#008000 size=2>// Uncomment the line below to add a layout grid to the pages</P></FONT><FONT size=2> <P></FONT><FONT color=#008000 size=2>//template.Elements.Add( new LayoutGrid() );</P></FONT><FONT size=2> <P></FONT><FONT color=#008000 size=2>// Add the page numbering label to the page template</P></FONT><FONT size=2> <P></FONT><FONT color=#008080 size=2>PageNumberingLabel</FONT><FONT size=2> pageNumLabel = </FONT><FONT color=#0000ff size=2>new</FONT><FONT size=2> </FONT><FONT color=#008080 size=2>PageNumberingLabel</FONT><FONT size=2>(</FONT><FONT color=#800000 size=2>"Page %%CP%% of %%TP%%"</FONT><FONT size=2>, 0, 494, 684, 10, </FONT><FONT color=#008080 size=2>Font</FONT><FONT size=2>.Helvetica,</P> <P>10, </FONT><FONT color=#008080 size=2>TextAlign</FONT><FONT size=2>.Center);</P> <P>template.Elements.Add(pageNumLabel);</P> <P>}</P> <P><IMG alt="" hspace=0 src = "/TestDNH/UploadFile/Consulting/Article/yogesh/testing06252008112029AM/Images/Arrow.gif" align=baseline border=0></P> <P></FONT><FONT color=#0000ff size=2>private</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>void</FONT><FONT size=2> SetImage()</P> <P>{</P> <P></FONT><FONT color=#008000 size=2>// Adds the image to the page template if it has not already been added</P></FONT><FONT size=2> <P></FONT><FONT color=#008000 size=2>// This is done because MapPath cannot be used from a static constructor</P></FONT><FONT size=2> <P></FONT><FONT color=#0000ff size=2>if</FONT><FONT size=2> (!imageSet)</P> <P>{</P> <P></FONT>

Re: Display image in pdf

Support · Jun 25, 2008
Hello, You can not add the images through the FormattedTextArea element. Formatted text area do not have support for the image tag. You can refer to the Supported Tags in our help documentation. You can add the images by using the Image page element. You can refer to the Image page element on our help documentation. There is a workaround for adding this by reading the text until you get the image tag and add that text through the formatted text area and then you can add the image using the image page element. You will have to read the remaining text from the image again. You will have to take care of the Y position to add the image or the next formatted text. You can use the GetRequiredHeight method to get the required height of the formatted text area. Thanks, ceTe Software Support Team.

Re: Display image in pdf

Forum member · Jun 26, 2008
Hi, Thanks for replying. I have one query regarding to add the image. Now i am able to add the images in the pages but problem is y position. how to manage the y position . each time i am adding the images and text in the next page. you told me about the GetRequiredHeight method, how to use that method. send me some code snippet or related link. Thanks & regards.

Re: Display image in pdf

Support · Jun 26, 2008
Hello, Can you please send an email to our [^a|mailto:support@cete.com|Support Team^] so that they can send you some sample code using the method GetRequiredHeight. Thanks, ceTe Software Support Team.