Sat Jan 30, 2016 4:40 pm
All I'm doing is taking a single page-size jpeg and inserting it into a new PDF and saving it. The code to do this is working perfectly in my development environment.
But I have 2 questions related to applying the license. This is a very simple one page web site, not a solution or a project, just a web site. So there's no mechanism to "include" a license file.
The relevant code reads like this:
Dim doc As New PdfDocument
Dim section As PdfSection = doc.Sections.Add
Dim page As PdfPageBase = doc.Pages.Add()
'Load a tif image from system
Dim image As PdfImage = PdfImage.FromFile(SitePath & "completedcards\" & filestring & ".jpg")
'Set image display location and size in PDF
Dim widthFitRate As Single = image.PhysicalDimension.Width / page.Canvas.ClientSize.Width
Dim heightFitRate As Single = image.PhysicalDimension.Height / page.Canvas.ClientSize.Height
Dim fitRate As Single = Math.Max(widthFitRate, heightFitRate)
Dim fitWidth As Single = image.PhysicalDimension.Width / fitRate
Dim fitHeight As Single = image.PhysicalDimension.Height / fitRate
page.Canvas.DrawImage(image, 30, 30, fitWidth, fitHeight)
doc.SaveToFile(SitePath & "completedcards\" & filestring & ".pdf")
doc.Close()
I've tried placing this line:
Spire.License.LicenseProvider.SetLicenseKey("xxxxxxxxxxxxx")
at the start of the the aspx.vb page that contains the above code. It still runs ok but the watermark doesn't disappear in my output pdf.
The other problem occurs on my production server. I've copied everything up to the server including the bin folder. Even though my code runs in VS2015, when I place it on the server it throws a compilation error at that "dim doc as pdfdocument" statement.
So I have 3 questions:
1) Do I need to convert site into a new project that compiles?
2) What does the license file actually look like? I received a license key but no sample file that I can include in my project after inserting my key.
3) Is there anything else I need to do to get this to compile and run on my production server.