Results 1 to 8 of 8

Thread: I got the idea from PDF File

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Aug 2007
    Posts
    140

    I got the idea from PDF File

    Guy's

    I'm facing problems with my team when I try to send to them messages to them emails

    because I'm writing that messages with the attached font but that font is not available in them PCs so when they receive any message from me they will receive it with garbage fonts "confusing message" unclear

    also I do not like to install that font in them PCs

    because I'm looking for another solution to solve this problem

    is it possible to create application to let that message as the image like the PDF File can I select the text inside the PDF File also it'll let the text like the image without any confuse inside the PDF file despite that fonts is not available in the fonts folder



    is it possible to create application and write the message in side the application then copy the texts from the application to the message to let the message like the image

    I hope to get my point
    Attached Files Attached Files
    Last edited by alkater; Apr 18th, 2008 at 05:12 PM.

  2. #2

    Thread Starter
    Addicted Member
    Join Date
    Aug 2007
    Posts
    140

    Re: I got the idea from PDF File

    I'm waiting your reply

  3. #3
    VB For Fun Edgemeal's Avatar
    Join Date
    Sep 2006
    Location
    WindowFromPoint
    Posts
    4,255

    Re: I got the idea from PDF File

    Heres one way to do it, though note it captures the area where the textbox is, so if anything is on top of the textbox it would also get captured!

    Code:
    Option Explicit
    
    Private Type RECT
            Left As Long
            Top As Long
            Right As Long
            Bottom As Long
    End Type
    
    Private Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long
    
    Private Declare Function BitBlt Lib "gdi32" _
    (ByVal hDestDC As Long, ByVal X As Long, _
    ByVal Y As Long, ByVal nWidth As Long, _
    ByVal nHeight As Long, ByVal hSrcDC As Long, _
    ByVal xSrc As Long, ByVal ySrc As Long, _
    ByVal dwRop As Long) As Long
    
    Private Declare Function GetDC Lib "user32" _
    (ByVal hwnd As Long) As Long
    
    Private Declare Function ReleaseDC Lib "user32" (ByVal hwnd As Long, ByVal hdc As Long) As Long
    Code:
    Private Sub Command1_Click()
    ' // Example: Capture Text area and save to BMP file //
        
        Dim TxtArea As RECT
        Dim MyDC As Long
            
        MyDC = GetDC(0)
        
        If MyDC Then
            Picture1.AutoRedraw = True
            Picture1.BorderStyle = 0
            Picture1.Height = Text1.Height
            Picture1.Width = Text1.Width
    
            GetWindowRect Text1.hwnd, TxtArea
            
            ' copy text box area to pic box.
            BitBlt Picture1.hdc, 0, 0, TxtArea.Right - TxtArea.Left, _
            TxtArea.Bottom - TxtArea.Top, MyDC, TxtArea.Left, TxtArea.Top, vbSrcCopy
        
            ' Save as BMP file.
            SavePicture Picture1.Image, "C:\TEST.BMP"
                    
            ReleaseDC 0, MyDC
        End If
        
    End Sub
    If you rather save it as a JPG so it's a smaller size you could use this module.

    and change
    Code:
    SavePicture Picture1.Image, "C:\TEST.BMP"
    to
    Code:
    SaveJPG Picture1.Image, "C:\TEST.JPG", 100 ' 100 = best quality
    Last edited by Edgemeal; Apr 19th, 2008 at 04:54 PM.

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Aug 2007
    Posts
    140

    Re: I got the idea from PDF File

    it's very beautiful code



    but i want to when i try to press to Save As to ask me to where do you want to save the image , I do not like to save the image directly in C drive

    how to can I do that ?

    and is it possible to save the text as PDF , I'd like to create another button to Save it As PDF

    is it possible to do that
    Last edited by alkater; Apr 21st, 2008 at 05:20 PM.

  5. #5
    Hyperactive Member csKanna's Avatar
    Join Date
    Dec 2005
    Location
    Tech-Tips-Now.com
    Posts
    339

    Re: I got the idea from PDF File

    Why don't you just create PDf from your text file and send it to your friends ?
    Kanna

  6. #6
    VB For Fun Edgemeal's Avatar
    Join Date
    Sep 2006
    Location
    WindowFromPoint
    Posts
    4,255

    Re: I got the idea from PDF File

    Quote Originally Posted by alkater
    it's very beautiful code

    but i want to when i try to press to Save As to ask me to where do you want to save the image , I do not like to save the image directly in C drive

    how to can I do that ?
    For a "Save As" dialog personally I prefer using API code like this, or you could use the Common Dialog control in VB.

    and is it possible to save the text as PDF , I'd like to create another button to Save it As PDF

    is it possible to do that
    I think there is, offhand don't know, did you try searching? Check out Planet Source Code .com too, lots of code there.
    Last edited by Edgemeal; Apr 22nd, 2008 at 12:13 AM.

  7. #7

    Thread Starter
    Addicted Member
    Join Date
    Aug 2007
    Posts
    140

    Re: I got the idea from PDF File

    I'd like to do the step of PDF file by VB6 if that possible

    I'd like to get solution

  8. #8
    Frenzied Member
    Join Date
    Nov 2005
    Posts
    1,834

    Re: I got the idea from PDF File

    Here's code to create a PDF with VB.

    http://www.a1vbcode.com/app.asp?ID=2548

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width