Print Page | Close Window

Adding Images and Text Styles

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: I need help - I can help
Forum Description: Problems and solutions while programming with the Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=1969
Printed Date: 04 Apr 26 at 7:28PM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: Adding Images and Text Styles
Posted By: MoneyRan
Subject: Adding Images and Text Styles
Date Posted: 22 Sep 11 at 2:49PM
I am trying to add a picture to an exixting PDF file :
 

'Load PDF File

QP.LoadFromFile("C:\Users\mranade\Desktop\AppConfirm.pdf")

'Load Image from File

Dim logoID As Integer = QP.AddImageFromFile("C:\Users\mranade\Desktop\Manasi\logo.jpg", 0)

(this logoID is always 0)
 
'Select Added Image

Dim si As Integer = QP.SelectImage(logoID)

'Get Height and Width of Selected Image

Dim logoHeight As Integer = QP.ImageHeight()

Dim logoWidth As Integer = QP.ImageWidth()

'DrawImage on the PDF File

QP.DrawImage(450, 50, logoWidth, logoHeight)

'Save PDF File

QP.SaveToFile("C:\Users\mranade\Desktop\AppConfirm.pdf")

 
But this doesn't work. Am I missing something? I got the code from the QuickPDF Demo Library that I downloaded from the website. Also, I am trying to change text style by using QP.SetTextSize() and QP.AddStandard Font() functions, but these too don;t make any change in the file. Everything looks the same. Should I be doing something before using these functions?
 
 



Replies:
Posted By: AndrewC
Date Posted: 22 Sep 11 at 4:52PM
logoID should not be 0 and that is most likely the problem.  Can you create a support ticket and then send the LOGO.JPG file.  You can create a ticket from the following form -   http://www.quickpdflibrary.com/support/support-query.php - http://www.quickpdflibrary.com/support/support-query.php   - Once you get an initial reply with your ticket number you can reply and just attach the JPG in your email.

Andrew.


Posted By: MoneyRan
Date Posted: 22 Sep 11 at 6:59PM
I looked up the Function Reference and it said QuickPDF only supports .JPEG and not .JPG. I changed it and the problem was solved. But I will send the picture just in case.


Posted By: MoneyRan
Date Posted: 22 Sep 11 at 7:28PM
Another question: I want to apply three styles to a page. But everything looks th same except for the TextColor. This is my complete code:
 
 
    Dim dlastline As Integer = 550
 
Private Sub ButtonCreate_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ButtonCreate.Click
                Dim newdoc As Integer = QP.NewDocument()       
                FillHeaderData()           
                FillFooterAndSaveFile()
                DrawFigures()
            End If    
    End Sub
 
Public Sub FillHeaderData()
        '612 X 792 <-- PDF Document Dimensions
        QP.SetOrigin(1)
        QP.SetTextAlign(1)
 
        QP.SetTextSize(32)
        QP.AddStandardFont(5)
        QP.SetTextColor(120, 0, 0)
        QP.SaveStyle("HeaderStyle")
        QP.DrawText(306, 100, "Company Name")
 
        QP.RemoveStyle("HeaderStyle")
 
        QP.SetTextSize(14)
        QP.AddStandardFont(8)
        QP.SetTextUnderline(1)
        QP.SetTextColor(0, 0, 0)
        QP.SaveStyle("LetterHead")
        QP.DrawText(306, 125, "Meeting Agenda")
 
        QP.RemoveStyle("LetterHead")
 
        QP.SetTextAlign(0)
 
        QP.SetTextSize(8)
        QP.AddStandardFont(8)
        QP.SetTextColor(0, 0, 0)
        QP.SetTextUnderline(0)
        QP.SaveStyle("LetterBody")
        QP.DrawText(306, 250, "This is what we will do: ")
 End Sub
 
 Public Sub FillFooterAndSaveFile()    
        QP.DrawText(75, dlastline + 15, "End of Meeting Agenda.")
        QP.DrawText(75, dlastline + 90, "Sign Here. ")
        QP.DrawText(75, dlastline + 150, "John Smith")
     
        Dim save As Integer = QP.SaveToFile("C:\Users\mranade\Desktop\AppConfirm.pdf")
End Sub
 
DrawFigures() has the code I posted earlier in this thread.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.01 - http://www.webwizforums.com
Copyright ©2001-2014 Web Wiz Ltd. - http://www.webwiz.co.uk