Class Metered
Namespace: Aspose.Pdf
Assembly: Aspose.PDF.dll
ให้วิธีการในการตั้งค่าคีย์มิเตอร์
public class Metered
การสืบทอด
สมาชิกที่สืบทอด
object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
ตัวอย่าง
ในตัวอย่างนี้ จะมีการพยายามตั้งค่าคีย์สาธารณะและคีย์ส่วนตัวแบบมิเตอร์
var metered = new Metered();
metered.SetMeteredKey("PublicKey", "PrivateKey");</code></pre>
```csharp
Dim metered As Metered = New Metered
metered.SetMeteredKey("PublicKey", "PrivateKey")
แสดงวิธีการเปิดใช้งานใบอนุญาตแบบมิเตอร์และติดตามเครดิต/การใช้จ่าย
// ตั้งค่าคีย์สาธารณะและคีย์ส่วนตัวแบบมิเตอร์
var metered = new Aspose.Pdf.Metered();
metered.SetMeteredKey("PublicKey", "PrivateKey");
//รับเครดิตการใช้จ่ายและปริมาณปัจจุบัน
var wasCredit = Metered.GetConsumptionCredit();
var wasQuantity = Metered.GetConsumptionQuantity();
//ทำงานโดยใช้ Aspose.Pdf
var doc = new Document();
doc.Pages.Add();
doc.Save(dataDir + "example.pdf");
//รอเล็กน้อยเพื่อให้แน่ใจว่าการทำธุรกรรมเสร็จสิ้น
System.Threading.Thread.Sleep(10000);
//รับเครดิตการใช้จ่ายและปริมาณปัจจุบัน
var nowCredit = Metered.GetConsumptionCredit();
var nowQuantity = Metered.GetConsumptionQuantity();
//แสดงข้อมูล
Console.WriteLine("เครดิต: เคย={0} ตอนนี้={1} ความแตกต่าง={2}", wasCredit, nowCredit, nowCredit - wasCredit);
Console.WriteLine("ปริมาณ: เคย={0} ตอนนี้={1} ความแตกต่าง={2}", wasQuantity, nowQuantity, nowQuantity - wasQuantity);
```<pre><code class="lang-csharp">
' ตั้งค่าคีย์สาธารณะและคีย์ส่วนตัวแบบมิเตอร์
Dim metered = New Aspose.Pdf.Metered()
metered.SetMeteredKey("PublicKey", "PrivateKey")
'รับเครดิตการใช้จ่ายและปริมาณปัจจุบัน
Dim wasCredit = Metered.GetConsumptionCredit()
Dim wasQuantity = Metered.GetConsumptionQuantity()
'ทำงานโดยใช้ Aspose.Pdf
Dim doc = New Document()
doc.Pages.Add()
doc.Save(dataDir + "example.pdf")
'รอเล็กน้อยเพื่อให้แน่ใจว่าการทำธุรกรรมเสร็จสิ้น
System.Threading.Thread.Sleep(10000)
'รับเครดิตการใช้จ่ายและปริมาณปัจจุบัน
Dim nowCredit = Metered.GetConsumptionCredit()
Dim nowQuantity = Metered.GetConsumptionQuantity()
'แสดงข้อมูล
Console.WriteLine("เครดิต: เคย={0} ตอนนี้={1} ความแตกต่าง={2}", wasCredit, nowCredit, nowCredit - wasCredit)
Console.WriteLine("ปริมาณ: เคย={0} ตอนนี้={1} ความแตกต่าง={2}", wasQuantity, nowQuantity, nowQuantity - wasQuantity)
ตัวสร้าง
Metered()
public Metered()
วิธีการ
GetConsumptionCredit()
รับเครดิตการใช้จ่าย
public static decimal GetConsumptionCredit()
คืนค่า
ปริมาณการใช้จ่าย
GetConsumptionQuantity()
รับขนาดไฟล์การใช้จ่าย
public static decimal GetConsumptionQuantity()
คืนค่า
ปริมาณการใช้จ่าย
GetProductName()
รับชื่อผลิตภัณฑ์
public string GetProductName()
คืนค่า
ชื่อผลิตภัณฑ์
IsMeteredLicensed()
ตรวจสอบว่ามิเตอร์มีใบอนุญาตหรือไม่
public static bool IsMeteredLicensed()
คืนค่า
จริงหรือเท็จ
SetMeteredKey(string, string)
ตั้งค่าคีย์สาธารณะและคีย์ส่วนตัวแบบมิเตอร์ หากคุณซื้อใบอนุญาตแบบมิเตอร์ เมื่อเริ่มแอปพลิเคชัน API นี้ควรถูกเรียกใช้ โดยปกติแล้ว นี่เพียงพอ อย่างไรก็ตาม หากไม่สามารถอัปโหลดข้อมูลการใช้จ่ายได้ตลอดเวลาและเกิน 24 ชั่วโมง ใบอนุญาตจะถูกตั้งค่าเป็นสถานะการประเมิน เพื่อหลีกเลี่ยงกรณีเช่นนี้ คุณควรตรวจสอบสถานะใบอนุญาตเป็นประจำ หากอยู่ในสถานะการประเมิน ให้เรียกใช้ API นี้อีกครั้ง
public void SetMeteredKey(string publicKey, string privateKey)
พารามิเตอร์
publicKey
string
คีย์สาธารณะ
privateKey
string
คีย์ส่วนตัว