Pergunta

Como eu poderia criar um gerador de assinatura do fórum dinâmico usando ASP.NET MVC. Eu tenho atualmente um fetcher Stats que recupera a informação do usuário a ser usado na assinatura do fórum.

Eu estou tentando criar um gerador de assinatura do fórum onde um usuário pode inserir seu nome de usuário e gerar uma imagem que pode colocar em sua assinatura do fórum que irá mostrar todos os dados de usuários.

algo assim http://www.xfire.com/miniprofile

Eu devo ter perdido a noção do que eu estava fazendo eu não quis dizer fornecimento tais informações pouco, mas eu acho que você vai ter uma idéia do que estou tentando fazer agora ..

Foi útil?

Solução

i usaria componente ABCpdf, a imagem seria um-res oi documento pdf.

Você, então, só precisa passar texto, fonte, cor, x, y, w, h

então o seu tornar o PDF como um fluxo jpg

a idéia básica para você ir poderia ser assim;

        private void addTextToPDF(string cmyk, int fs, string fontname, Double posx,
    Double posY, Double mWidth, Double mHeight, String text, Double hpos)
    {
        text = secure.reverseCleanup(text);
        int lettercount1 = 0;
        foreach (char c in text)
        { lettercount1 ++; }

        TheDoc.Color.String = cmyk;
        TheDoc.FontSize = fs;
        var theFont = fontname;
        TheDoc.Rect.Position(posx, posY);
        TheDoc.Rect.Width = mWidth;
        TheDoc.Rect.Height = mHeight;
        TheDoc.HPos = hpos;
        TheDoc.Font = TheDoc.EmbedFont(theFont, "Latin", false, true, true);
        int didwrite = TheDoc.AddText(text);
        string addedchars = TheDoc.GetInfo(didwrite, "Characters");
        var oldid = didwrite;

        if (addedchars != lettercount1.ToString())
            didwrite = 0;

        while (didwrite==0) // hits this if first run did not add text
        {
            TheDoc.Delete(oldid);
            fs = fs - 2;
            TheDoc.Color.String = cmyk;
            TheDoc.FontSize = fs;
            theFont = fontname;
            TheDoc.Rect.Position(posx, posY);
            TheDoc.Rect.Width = mWidth;
            TheDoc.Rect.Height = mHeight;
            TheDoc.HPos = hpos;
            TheDoc.Font = TheDoc.EmbedFont(theFont, "Latin", false, true, true);
            didwrite = TheDoc.AddText(secure.reverseCleanup(text));
            addedchars = TheDoc.GetInfo(didwrite, "Characters");
            oldid = didwrite;

            if (addedchars != lettercount1.ToString())
                didwrite = 0;
        }

    }

    public byte[] convertPDFToImageStream()
    {
        byte[] jpgBytes = null;
        byte[] theData = null;
        theData = TheDoc.GetData();
        TheDoc.Clear();
        TheDoc.Read(theData);
        TheDoc.Rendering.DotsPerInch = getDPI();
        TheDoc.Rendering.ColorSpace = "RGB";
        jpgBytes = TheDoc.Rendering.GetData("preview.jpg");

        return jpgBytes;
     }

que é o código para adicionar texto e também para tornar o PDF como um JPG fluxo muito, muito bom componente.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top