Click here to Skip to main content
15,908,254 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: Removing anonymous access to web service Pin
balaji baskar4-Oct-07 8:46
balaji baskar4-Oct-07 8:46 
GeneralRe: Removing anonymous access to web service Pin
gauthee4-Oct-07 19:55
gauthee4-Oct-07 19:55 
QuestionProblem while creating .mdf file Pin
bhattiprolu4-Oct-07 4:58
bhattiprolu4-Oct-07 4:58 
AnswerRe: Problem while creating .mdf file Pin
Matthew Hazlett4-Oct-07 9:24
Matthew Hazlett4-Oct-07 9:24 
Questionweb server capture Pin
orsini4-Oct-07 4:42
orsini4-Oct-07 4:42 
QuestionImage to PDF Pin
armandolaser4-Oct-07 4:15
armandolaser4-Oct-07 4:15 
AnswerRe: Image to PDF Pin
Chajon4-Oct-07 7:18
Chajon4-Oct-07 7:18 
GeneralRe: Image to PDF Pin
armandolaser4-Oct-07 8:21
armandolaser4-Oct-07 8:21 
I'm actually using C# to work with my jpeg image. In fact hear is the code behind so you can get general idea as to what I'm talking about.

using System;
using System.IO;
using Microsoft.VisualBasic;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Windows.Forms;
using System.Drawing.Imaging;
using System.Drawing.Imaging;
using System.Design;
using System.Drawing.Drawing2D;
using System.Drawing.Text;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;

namespace TextOnImage

{
public partial class TextOnImage : System.Web.UI.Page
{
protected void Page_Load(object sender, System.EventArgs e)
{
//Load the Image to be written on.
Bitmap bitMapImage = new System.Drawing.Bitmap(Server.MapPath("Wayland_Tmp_RGB.jpg"));
Graphics graphicImage = Graphics.FromImage( bitMapImage );
SolidBrush brush = new SolidBrush(Color.FromArgb(12,39,120));


//Code for Name.
FileStream file = new FileStream(@"C:\Inetpub\wwwroot\Wayland\ImageMaker\proof\Name.txt",FileMode.OpenOrCreate,FileAccess.Read);
StreamReader name= new StreamReader(file);


//Code for Title1.
FileStream file1 = new FileStream(@"C:\Inetpub\wwwroot\Wayland\ImageMaker\proof\Title1.txt", FileMode.OpenOrCreate, FileAccess.Read);
StreamReader ttl1 = new StreamReader(file1);
//Code for Title2
FileStream file2 = new FileStream(@"C:\Inetpub\wwwroot\Wayland\ImageMaker\proof\Title2.txt", FileMode.OpenOrCreate, FileAccess.Read);
StreamReader ttl2 = new StreamReader(file2);
//Code for the Campus
FileStream file3 = new FileStream(@"C:\Inetpub\wwwroot\Wayland\ImageMaker\proof\Campus.txt", FileMode.OpenOrCreate, FileAccess.Read);
StreamReader cmp = new StreamReader(file3);
//Code for the CityStateZip
FileStream file4 = new FileStream(@"C:\Inetpub\wwwroot\Wayland\ImageMaker\proof\Line1.txt", FileMode.OpenOrCreate, FileAccess.Read);
StreamReader lin1 = new StreamReader(file4);
//Code for the Phone
FileStream file5 = new FileStream(@"C:\Inetpub\wwwroot\Wayland\ImageMaker\proof\Line2.txt", FileMode.OpenOrCreate, FileAccess.Read);
StreamReader lin2 = new StreamReader(file5);
//Code for the Fax


//Smooth graphics is nice.
//graphicImage.SmoothingMode = SmoothingMode.AntiAlias;
//graphicImage.CompositingQuality= CompositingQuality.HighQuality;
graphicImage.TextRenderingHint= TextRenderingHint.ClearTypeGridFit;




//Reads the text file info.
string n=name.ReadLine();
string t1=ttl1.ReadLine();
string t2=ttl2.ReadLine();
string c=cmp.ReadLine();
string ln1=lin1.ReadLine();
string ln2=lin2.ReadLine();

int x;

string read = null;
if ((read=t1)!=null)
{
x=1215;
//Title#1
graphicImage.DrawString(t1.PadLeft(t1.Length), new Font("Garamond", 8, FontStyle.Italic), brush, new Point(x-(t1.Length*12), 525));
//Name
x = x - (t1.Length*14);
graphicImage.DrawString(n, new Font("Garamond", 8, FontStyle.Bold), brush, new Point(x - (n.Length) * 16, 525));
}
else
{
x=1200;
//Name if there is no Title#1
graphicImage.DrawString(n, new Font("Garamond", 8, FontStyle.Bold), brush, new Point(x - (n.Length+2)*12 , 525));
}
//*****************************Title#2***And***Campus****************************************//
if (((read = t2) != null) & ((read = c) != null))
{

x = 1190;
//Title#2 if there is a Title#2
graphicImage.DrawString(t2, new Font("Garamond", 8, FontStyle.Italic), brush, new Point(x - (t2.Length) * 12, 575));
//Campus
x =1135;
graphicImage.DrawString(c, new Font("Garamond", 8, FontStyle.Italic), brush, new Point(x - (c.Length) * 12, 625));

}
//Code for Campus if there is now Title#2
else
{
if ((read = c) != null)
{
x = 1185;
graphicImage.DrawString(c, new Font("Garamond", 8, FontStyle.Italic), brush, new Point(x - (c.Length) * 12, 575));
}
else
{
//Title#2 if Campus is entered into Title@2
x=1215;
graphicImage.DrawString(t2, new Font("Garamond", 8, FontStyle.Italic), brush, new Point(x - (t2.Length) * 13, 575));

}
}
//**************************Line1****of**the**Card******************************************//
x=1200;
graphicImage.DrawString(ln1, new Font("Garamond", 7, FontStyle.Regular), brush, new Point(x - (ln1.Length) * 12, 700));
//**************************Line2****of**the**Card******************************************//
x = 1200;
graphicImage.DrawString(ln2, new Font("Garamond", 7, FontStyle.Regular), brush, new Point(x - (ln2.Length) * 12, 750));




//This code is to test the positioning of the information

// graphicImage.DrawString("|", new Font("Garamond", 10, FontStyle.Bold), brush, new Point(1200, 525));
//graphicImage.DrawString("|", new Font("Garamond", 10, FontStyle.Bold), brush, new Point(1200, 575));
//graphicImage.DrawString("|", new Font("Garamond", 10, FontStyle.Bold), brush, new Point(1200, 625));
//graphicImage.DrawString("|", new Font("Garamond", 10, FontStyle.Bold), brush, new Point(1200, 675));
//graphicImage.DrawString("|", new Font("Garamond", 10, FontStyle.Bold), brush, new Point(1200, 725));

//graphicImage.DrawString("|", new Font("Garamond", 10, FontStyle.Bold), brush, new Point(0, 525));
//graphicImage.DrawString("|", new Font("Garamond", 10, FontStyle.Bold), brush, new Point(1485, 525));








//Closing all files.

name.Close();
file.Close();
ttl1.Close();
file1.Close();
ttl2.Close();
file2.Close();
cmp.Close();
file3.Close();
lin1.Close();
file4.Close();
lin2.Close();
file5.Close();










//Set the content type
Response.ContentType="image/jpeg";

//Save the new image to the response output stream.
bitMapImage.Save(Response.OutputStream, ImageFormat.Jpeg);

//Clean house.
graphicImage.Dispose();
bitMapImage.Dispose();
}

//private Brush Color()
//{
// throw new Exception("The method or operation is not implemented.");
// }


#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}

///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///

private void InitializeComponent()
{
}
#endregion
}
}

I got the source code from someone in Code Project and kind of made my own thing with it, but like I said before the graphics dept. is unable to use the jpg image because when they convert it to cmyk all the brush strokes show up and we can't have that. Any suggestions at this point would be greatly appreciated.

Thanks,

ArmandoConfused | :confused:
GeneralRe: Image to PDF Pin
Christian Graus4-Oct-07 10:52
protectorChristian Graus4-Oct-07 10:52 
GeneralRe: Image to PDF Pin
armandolaser4-Oct-07 10:58
armandolaser4-Oct-07 10:58 
GeneralRe: Image to PDF Pin
Christian Graus4-Oct-07 11:40
protectorChristian Graus4-Oct-07 11:40 
GeneralRe: Image to PDF Pin
armandolaser4-Oct-07 11:49
armandolaser4-Oct-07 11:49 
GeneralRe: Image to PDF Pin
Christian Graus4-Oct-07 12:13
protectorChristian Graus4-Oct-07 12:13 
GeneralRe: Image to PDF Pin
armandolaser4-Oct-07 12:23
armandolaser4-Oct-07 12:23 
QuestionDifference betn Passthrough and Transform Mode of Literal in ASP.Net2.0 Pin
Sivan.G4-Oct-07 3:30
Sivan.G4-Oct-07 3:30 
AnswerRe: Difference betn Passthrough and Transform Mode of Literal in ASP.Net2.0 Pin
Guffa4-Oct-07 6:05
Guffa4-Oct-07 6:05 
QuestionFormview template controls not accessible? Pin
Richard Jones4-Oct-07 3:08
Richard Jones4-Oct-07 3:08 
QuestionHow to Use COM Dll in ASP.Net? Pin
swamy Narasimha4-Oct-07 3:04
swamy Narasimha4-Oct-07 3:04 
AnswerRe: How to Use COM Dll in ASP.Net? Pin
Christian Graus4-Oct-07 10:54
protectorChristian Graus4-Oct-07 10:54 
GeneralRe: How to Use COM Dll in ASP.Net? Pin
swamy Narasimha5-Oct-07 21:06
swamy Narasimha5-Oct-07 21:06 
QuestionSubtracting date value from Current date time Pin
Malayil alex4-Oct-07 3:01
Malayil alex4-Oct-07 3:01 
AnswerRe: Subtracting date value from Current date time Pin
talasila804-Oct-07 3:27
talasila804-Oct-07 3:27 
GeneralRe: Subtracting date value from Current date time Pin
Malayil alex4-Oct-07 21:32
Malayil alex4-Oct-07 21:32 
QuestionImport web part Pin
samerh4-Oct-07 2:48
samerh4-Oct-07 2:48 
QuestionAlignment problem in crystal viewer... with asp.net Pin
Hemant Thaker4-Oct-07 2:44
Hemant Thaker4-Oct-07 2:44 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.