Foros del Web » Programación para mayores de 30 ;) » .NET »

texto a imagen + fuente

Estas en el tema de texto a imagen + fuente en el foro de .NET en Foros del Web. Gracias X leerlo Amigos estoy probando el sgte codigo request.aspx Código PHP: <%@  Page Language = "VB"  Debug = "True"  %> <%@  Import Namespace = "System.Drawing"  %> ...
  #1 (permalink)  
Antiguo 23/04/2009, 08:39
Avatar de ACX_POISON  
Fecha de Ingreso: abril-2008
Ubicación: Talca-Chile
Mensajes: 750
Antigüedad: 16 años
Puntos: 7
Pregunta texto a imagen + fuente

Gracias X leerlo Amigos

estoy probando el sgte codigo
request.aspx
Código PHP:
<%@ Page Language="VB" Debug="True" %>
<%@ 
Import Namespace="System.Drawing" %>
<%@ 
Import Namespace="System.Drawing.Imaging" %>
<%@ 
Import Namespace="System.Drawing.Text" %>
<%
' Declare Vars
Dim objBMP        As System.Drawing.Bitmap
    Dim objGraphics As System.Drawing.Graphics
   
    Dim font_c As System.Drawing.Font
    Dim codigo_ingreso As String
    
Create new image bitmap
    objBMP 
= New Bitmap(45030)

' Create a graphics object to work with from the BMP
objGraphics = System.Drawing.Graphics.FromImage(objBMP)

Fill the image with background color
objGraphics
.Clear(Color.White)

' Set anti-aliasing for text to make it better looking
objGraphics.TextRenderingHint = TextRenderingHint.AntiAlias

    ' 
Configure font to use for text
    font_c 
= New Font("Code128"18FontStyle.Regular)
   

    
' Write out the text
    codigo_ingreso = Replace(Request.QueryString("text"), "'", "")
    objGraphics.DrawString(codigo_ingreso, font_c, Brushes.Black, 3, 3)


' Set the content type and return the image
Response.ContentType = "
image/GIF"
objBMP.Save(Response.OutputStream, ImageFormat.Gif)

    ' Kill our objects
    font_c.Dispose()
objGraphics.Dispose()
objBMP.Dispose()
%> 
ver.html
Código PHP:
<html>
<
head>
<
title>ASP 101s Generating Text Images on the Fly with ASP.NET Sample Code</title>
</
head>
<
body>

<
p>
The image tags and their attributes are the same as they
would be 
for any other image... just point at the .aspx
file instead of the 
.gif.
</
p>
<
br />
<
img src="request.aspx?text=1234567890123456789012345678901234567890" />

</
body>
</
html
la idea es que devuelva una imagen con el texto que se le envia via GET
eso funciona,, la cosa es que quiero utilizar un tipo de fuente extraño (para codigo de barras)

y pense que si agregaba esta fuente en el sistema y ponia esta linea funcionaria

Código PHP:
font_c = New Font("Code128"18FontStyle.Regular
pero aunque igual me genera la imagen no utiliza la funete que le especifico....

¿Que hago mal?
¿Existe alguan otra manera?
¿Que sistema utilizo para no necesitar que la fuente este instalada en el sistema?

Gracias---->
__________________
Me junto con los que Saben, Queriendo Saber.
  #2 (permalink)  
Antiguo 23/04/2009, 10:05
Avatar de ACX_POISON  
Fecha de Ingreso: abril-2008
Ubicación: Talca-Chile
Mensajes: 750
Antigüedad: 16 años
Puntos: 7
Respuesta: texto a imagen + fuente

Resuelto Fuente con Nombres cambiados ........ upsssss
Gracias =
__________________
Me junto con los que Saben, Queriendo Saber.
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 21:33.